4 years agoMerge branch 'vendor/LIBRESSL'
John Marino [Tue, 6 Sep 2016 16:03:50 +0000 (11:03 -0500)]
Merge branch 'vendor/LIBRESSL'

4 years agoif_iwm - Sync nvm parsing code with Linux iwlwifi.
Imre Vadász [Tue, 6 Sep 2016 18:37:05 +0000 (20:37 +0200)]
if_iwm - Sync nvm parsing code with Linux iwlwifi.

* sc->sc_nvm becomes sc->nvm_data and is now a pointer instead of an
  inlined struct.

* Add sc->eeprom_size and sc->nvm_hw_section_num configuration values to
  struct iwm_softc.

* For now continue to avoid negative error return-values, and use pointer
  variables for some return values, as before.

* Continue to omit LAR (location aware regulatory) related code as well.

4 years agoImport LibreSSL v2.4.2 to vendor branch
John Marino [Tue, 6 Sep 2016 16:00:43 +0000 (11:00 -0500)]
Import LibreSSL v2.4.2 to vendor branch

4 years agobcd(6): Add decoding option and few extras.
zrj [Tue, 6 Sep 2016 13:35:45 +0000 (16:35 +0300)]
bcd(6): Add decoding option and few extras.

While there, do the same for ppt(6).

Taken-from: OpenBSD

4 years agosys/vfs/hammer: Change HAMMER_VOLUME_NUMBER_XXX macros to inline functions
Tomohiro Kusumi [Tue, 6 Sep 2016 10:56:44 +0000 (19:56 +0900)]
sys/vfs/hammer: Change HAMMER_VOLUME_NUMBER_XXX macros to inline functions

I've added these macros in 78249d7f in 2015 for a bug fix,
but these macros should have been inline functions.
Not very readable.

4 years agosbin/hammer: Use inline CRC functions in userspace
Tomohiro Kusumi [Mon, 5 Sep 2016 14:45:34 +0000 (23:45 +0900)]
sbin/hammer: Use inline CRC functions in userspace

Remove crc32 prototypes in sbin/hammer/hammer_util.h.
Remove hammer_crc_test_leaf() which is a copy-pasted function
from kernel code.

4 years agosys/vfs/hammer: Add sys/vfs/hammer/hammer_crc.h
Tomohiro Kusumi [Mon, 5 Sep 2016 14:34:53 +0000 (23:34 +0900)]
sys/vfs/hammer: Add sys/vfs/hammer/hammer_crc.h

HAMMER's CRC functions currently defined in sys/vfs/hammer/hammer.h
could be exposed to userspace, since CRCs in various ondisk data
structures are a part of HAMMER's ondisk format. In fact, userspace
has a copy-pasted function from kernel code.

This commit adds a new file sys/vfs/hammer/hammer_crc.h for both
kernel and userspace. CRC functions are moved to this file.

The reason for adding a new file instead of adding these inlined
functions to hammer_{disk,btree,ioctl}.h is because crc32() requires
explicit function prototype in userspace.
(i.e. causes include order issues by userspace headers)

Having function prototypes in hammer_{disk,btree}.h should also be
avoided, because that brings in unnecessary dependencies that could
be avoided for headers for ondisk format.

4 years agokernel - Deal with lost IPIs (VM related)
Matthew Dillon [Tue, 6 Sep 2016 00:11:05 +0000 (17:11 -0700)]
kernel - Deal with lost IPIs (VM related)

* Some (all?) VMs appear to be able to lose IPIs.  Hopefully the same can't
  be said for device interrupts!  Add some recovery code for lost Xinvltlb
  IPIs for now.

  For synchronizing invalidations we use the TSC and run a recovery attempt
  after 1/16 second, and every 1 second there-after, if an Xinvltlb is not
  responded to (smp_invltlb() and smp_invlpg()).  The IPI will be re-issued.

* Some basic testing shows that a VM can stall out a cpu thread for an
  indefinite period of time, potentially causing the above watchdog to
  trigger.  Even so it should not have required re-issuing the IPI, but
  it seems it does, so the VM appears to be losing the IPI(!) when a cpu
  thread stalls out on the host!  At least with the VM we tested under,
  type unknown.

* IPIQ IPIs currently do not have any specific recovery but I think each
  cpu will poll for IPIQs slowly in the idle thread, so they might
  automatically recover anyway.

Reported-by: zach
4 years agoif_iwm - Make sure we call iwm_detach_local only once.
Imre Vadász [Mon, 5 Sep 2016 20:48:56 +0000 (22:48 +0200)]
if_iwm - Make sure we call iwm_detach_local only once.

* Add sc_attached variable to struct iwm_softc, to keep track of whether
  we already called iwm_detach_local.

4 years agoif_iwm - Remove calib_version field from struct iwm_nvm_data.
Imre Vadász [Mon, 5 Sep 2016 16:00:13 +0000 (18:00 +0200)]
if_iwm - Remove calib_version field from struct iwm_nvm_data.

* This value is only used for dvm devices in Linux iwlwifi.

4 years agoif_iwm - Sync iwm_nvm_read_chunk() function with Linux iwlwifi.
Imre Vadász [Sun, 4 Sep 2016 23:14:02 +0000 (01:14 +0200)]
if_iwm - Sync iwm_nvm_read_chunk() function with Linux iwlwifi.

4 years agoif_iwm - Sync if_iwm_phy_db code with Linux iwlwifi.
Imre Vadász [Sun, 4 Sep 2016 22:43:40 +0000 (00:43 +0200)]
if_iwm - Sync if_iwm_phy_db code with Linux iwlwifi.

* DragonFly requires NULL checks before kfree(9) calls.

4 years agoif_iwm - Remove some unneeded #include-s from all .c files.
Imre Vadász [Sun, 4 Sep 2016 20:19:55 +0000 (22:19 +0200)]
if_iwm - Remove some unneeded #include-s from all .c files.

4 years agokernel - Fix indefinite wait buffer during heavy swapping
Matthew Dillon [Mon, 5 Sep 2016 19:33:42 +0000 (12:33 -0700)]
kernel - Fix indefinite wait buffer during heavy swapping

* Fix a deadlock which can occur between CAM and the VM system due to
  a bug in uiomove_nofault() when called via vop_helper_read_shortcut().

  If the backing store is swapped out, vm_fault()/vm_fault_object() attempts
  to page the data in instead of telling uiomove_nofault() to give up.
  This can result in a deadlock against the underlying vm_page's in the
  file that might already be undergoing I/O.

* Probably also reported by other people over the years, but could never
  track it down until now.

Reported-by: Studbolt
4 years agofortune(6): Fix some typos in the datfiles.
Sascha Wildner [Mon, 5 Sep 2016 17:37:42 +0000 (19:37 +0200)]
fortune(6): Fix some typos in the datfiles.

4 years agofortune(6): Add new fortunes from FreeBSD
zrj [Mon, 5 Sep 2016 14:23:51 +0000 (17:23 +0300)]
fortune(6): Add new fortunes from FreeBSD

Tried to avoid dups.
While there, move few fortunes that were deemed non offencive.

Taken-from: FreeBSD

4 years agosys/vfs/hammer: Add inline CRC functions for mrec head
Tomohiro Kusumi [Mon, 5 Sep 2016 13:40:18 +0000 (22:40 +0900)]
sys/vfs/hammer: Add inline CRC functions for mrec head

4 years agosys/vfs/hammer: Add inline CRC functions for undo/redo fifo head
Tomohiro Kusumi [Mon, 5 Sep 2016 13:24:32 +0000 (22:24 +0900)]
sys/vfs/hammer: Add inline CRC functions for undo/redo fifo head

Note that undo->head is at offset 0 of undo,
and the same for redo->head.

4 years agofortune(6): Fix typos in some of the fortunes.
zrj [Mon, 5 Sep 2016 13:05:18 +0000 (16:05 +0300)]
fortune(6): Fix typos in some of the fortunes.

Minor style fixes, compact etc.
(mainly to reduce diffs against FreeBSD vartiant)
Also attempt to remove some dups.

4 years agokernel/clock: Solve aa85218e6 a bit better.
Sascha Wildner [Sun, 4 Sep 2016 22:12:50 +0000 (00:12 +0200)]
kernel/clock: Solve aa85218e6 a bit better.

4 years agoif_iwm - The HW Revision stepping constants should be in if_iwmreg.h.
Imre Vadász [Sun, 4 Sep 2016 16:07:16 +0000 (18:07 +0200)]
if_iwm - The HW Revision stepping constants should be in if_iwmreg.h.

4 years agoif_iwm - Remove more old unused scan API definitions.
Imre Vadász [Sun, 4 Sep 2016 13:43:51 +0000 (15:43 +0200)]
if_iwm - Remove more old unused scan API definitions.

* Use IWM_DEFAULT_SCAN_CHANNELS definition instead of
  IWM_MAX_NUM_SCAN_CHANNELS as default value for

4 years agosys/vfs/hammer: Add inline CRC functions for layer1/2
Tomohiro Kusumi [Sun, 4 Sep 2016 11:45:20 +0000 (20:45 +0900)]
sys/vfs/hammer: Add inline CRC functions for layer1/2

4 years agosys/vfs/hammer: Make the existing CRC functions inline
Tomohiro Kusumi [Sun, 4 Sep 2016 11:11:39 +0000 (20:11 +0900)]
sys/vfs/hammer: Make the existing CRC functions inline

4 years agosys/vfs/hammer: Add inline CRC functions hammer_crc_get_xxx()
Tomohiro Kusumi [Sun, 4 Sep 2016 05:50:21 +0000 (14:50 +0900)]
sys/vfs/hammer: Add inline CRC functions hammer_crc_get_xxx()

in addition to the existing hammer_crc_set_xxx() and hammer_crc_test_xxx().
Reduces overly duplicated crc32(&..., HAMMER_XXX_CRCSIZE);.

The only functional difference is that hammer_crc_test_leaf()
now compares (leaf->data_crc == 0) if hammer_crc_get_leaf()
returns 0 for inode whose length is not sizeof(hammer_inode_data).
It previously directly returned false for this case.

It is still expected that (leaf->data_crc == 0) would be false,
however inode size (not file size, but the size of inode itself)
other than sizeof(hammer_inode_data) is wrong which shouldn't
happen in the first place. hammer_crc_set_leaf() has assertion
for this like it did before, but only if INVARIANTS is set.

4 years agosbin/hammer: Use HAMMER_ENTRY_NAME_OFF
Tomohiro Kusumi [Sun, 4 Sep 2016 04:24:16 +0000 (13:24 +0900)]
sbin/hammer: Use HAMMER_ENTRY_NAME_OFF

4 years agoif_iwm - Remove deprecated scan API definitions.
Imre Vadász [Sun, 4 Sep 2016 11:26:25 +0000 (13:26 +0200)]
if_iwm - Remove deprecated scan API definitions.

* This removes deprecated scan API definitions, which have been unused
  since the upgrade to version 16 firmware in commit

* This commit matches the header-file changes in Linux git commit

4 years agoif_iwm - Remove wrappers around iwm_dma_contig_free() calls.
Imre Vadász [Sun, 4 Sep 2016 09:29:51 +0000 (11:29 +0200)]
if_iwm - Remove wrappers around iwm_dma_contig_free() calls.

Inspired-by: OpenBSD
4 years agoSync ACPICA with Intel's version 20160831.
Sascha Wildner [Sun, 4 Sep 2016 08:12:02 +0000 (10:12 +0200)]
Sync ACPICA with Intel's version 20160831.

* Improve support for the so-called "module-level code".

* Fixed a possible mutex error during control method auto-serialization.

* Implemented two new table handler events (table install/uninstall).

* New 'execute predef' subcommand in the AML debugger.

* Various issues fixed.

For a more detailed list, please see sys/contrib/dev/acpica/changes.txt.

4 years agokernel/scsi: Do not announce pass/sg in bootverbose.
zrj [Sun, 4 Sep 2016 06:58:01 +0000 (09:58 +0300)]
kernel/scsi: Do not announce pass/sg in bootverbose.

At least on one machine it causes reprobe of da0 that ends up with
strange geometry, stuck boot and other weirdness. TBI.

For now disable these, cause acpica update is comming.

4 years agolibc - Fix malloc() alignment for small allocations
Matthew Dillon [Sat, 3 Sep 2016 17:24:56 +0000 (10:24 -0700)]
libc - Fix malloc() alignment for small allocations

* malloc()'s slab allocator was set to use 8-byte alignment
  for any allocation < 128 bytes that was not otherwise on
  an integral alignment boundary.  This breaks GCC-7 which assumes
  16-byte alignment for non-16-integral sizes < 128 bytes.  e.g.
  if 18 bytes is allocated, GCC-7 assumes the resulting pointer will
  be 16-byte-aligned.

* The standard is somewhat deficient in its characterization of what the
  required alignment should be, because there are already instructions
  which prefer 32 and 64 byte alignments, but are relaxed on Intel to
  only require 16-byte alignments (aka %ymm and %zmm registers in the
  vector extensions), and its stupid to enforce even larger alignments
  for tiny allocations.

* But generally speaking it makes sense to enforce a 16-byte alignment
  for any allocations >= 16 bytes, regardless of the size being passed-in
  not being 16-byte aligned, and this change does that.  Allocations of
  less than 16 bytes will still be 8-byte aligned because it is phenominally
  wasteful for them not to be.

Reported-by: marino
4 years agosbin/newfs_hammer: Cleanup
Tomohiro Kusumi [Sat, 3 Sep 2016 15:11:44 +0000 (00:11 +0900)]
sbin/newfs_hammer: Cleanup

4 years agosbin/newfs_hammer: Don't bother initializing reserved ondisk field
Tomohiro Kusumi [Sat, 3 Sep 2016 12:59:53 +0000 (21:59 +0900)]
sbin/newfs_hammer: Don't bother initializing reserved ondisk field

pfsd is bzero'd, so no need to explicitly zero clear a reserved field
that isn't used for anything.

The numbering for reserved fields has been reassigned in 77f7bc0a
so as to cleanup mixed up name and numbering, based on the fact
that reserved fields are not touched by anyone *except* for this.
Doesn't break anything, but it should still just not care about it.

4 years agosbin/hammer: Remove unused zone field in struct zone_stat
Tomohiro Kusumi [Sat, 3 Sep 2016 12:38:47 +0000 (21:38 +0900)]
sbin/hammer: Remove unused zone field in struct zone_stat

Zone statistics' init api returns a pointer to calloc'd array
where an index represents zone itself, so this zone field isn't
necessary as the comment says it's unused.

4 years agosys/vfs/hammer: Integrate ondisk reserved fields and unused fields
Tomohiro Kusumi [Sat, 3 Sep 2016 10:53:02 +0000 (19:53 +0900)]
sys/vfs/hammer: Integrate ondisk reserved fields and unused fields

In addition to the previous commit, we could reassign the whole
numbering for reserved/unused fields since HAMMER1 ondisk format
has basically been fixed for years.

Integrate unusedXX fields into the existing reservedXX fields,
where XX starts from 01. Nothing changes (and shouldn't change)
in terms of ondisk format.

4 years agobsd-family-tree: Sync with FreeBSD (OpenBSD 6.0).
Sascha Wildner [Sat, 3 Sep 2016 12:03:15 +0000 (14:03 +0200)]
bsd-family-tree: Sync with FreeBSD (OpenBSD 6.0).

4 years agosys/vfs/hammer: Fix numbering of reserved fields for vol0
Tomohiro Kusumi [Sat, 3 Sep 2016 09:33:44 +0000 (18:33 +0900)]
sys/vfs/hammer: Fix numbering of reserved fields for vol0

Make vol0_reserved fields start from 00.

Reserved fields in volume header aren't in order from 00 to 11,
so it's not really important to keep whatever numbers assigned.

4 years agosys/vfs/hammer: Fix confusing comment
Tomohiro Kusumi [Sat, 3 Sep 2016 09:27:51 +0000 (18:27 +0900)]
sys/vfs/hammer: Fix confusing comment

This part is talking about hdr_seq in struct hammer_fifo_head.

It's confusing unless one is looking at it along with 02428fb6
which contains a diff that replaces reserved01 with hdr_seq.

4 years agosys/vfs/hammer: Fix comment on lo in direntry
Tomohiro Kusumi [Sat, 3 Sep 2016 08:08:18 +0000 (17:08 +0900)]
sys/vfs/hammer: Fix comment on lo in direntry

lo field in direntry actually has PFS# in its upper 16 bits,
and there's no alternative behavior, so remove "possible to".

Also see hammer_ip_add_direntry().

4 years agosys/vfs/hammer: Remove HAMMER_RECTYPE_LOWEST
Tomohiro Kusumi [Sat, 3 Sep 2016 07:48:31 +0000 (16:48 +0900)]
sys/vfs/hammer: Remove HAMMER_RECTYPE_LOWEST

No one needs the non-zero lowest rectype to be defined,
though the maximum possible (0xFFFF) is used on lookup.

4 years agosbin/hammer: Remove default volume initialization from alloc_bigblock()
Tomohiro Kusumi [Sat, 3 Sep 2016 05:11:18 +0000 (14:11 +0900)]
sbin/hammer: Remove default volume initialization from alloc_bigblock()

No one calls this with NULL when allocating a big-block for
one of the HAMMER volumes. A caller certainly has a pointer
to that volume. It should also be explicit.

4 years agosbin/hammer: Add assert_volume_offset()
Tomohiro Kusumi [Sat, 3 Sep 2016 03:19:32 +0000 (12:19 +0900)]
sbin/hammer: Add assert_volume_offset()

It's invalid to call functions that are based on vol_free_off/end
values unless these are properly initialized with zone-2 offsets.

4 years agosbin/hammer: Don't use hard-coded 1024 for # of layer1 per volume
Tomohiro Kusumi [Sat, 3 Sep 2016 03:07:14 +0000 (12:07 +0900)]
sbin/hammer: Don't use hard-coded 1024 for # of layer1 per volume

4 years agosbin/hammer: Use int64_t for zone stats blocks/items/used
Tomohiro Kusumi [Sat, 3 Sep 2016 02:58:45 +0000 (11:58 +0900)]
sbin/hammer: Use int64_t for zone stats blocks/items/used

4 years agosbin/hammer: Cleanup struct volume_info
Tomohiro Kusumi [Fri, 2 Sep 2016 14:08:45 +0000 (23:08 +0900)]
sbin/hammer: Cleanup struct volume_info

Mention vol_free_off,beg are initialized only by /sbin/newfs_hammer.
(i.e. these two are 0 when running /sbin/hammer)

4 years agosbin/hammer: Always call check_volume()
Tomohiro Kusumi [Fri, 2 Sep 2016 13:10:33 +0000 (22:10 +0900)]
sbin/hammer: Always call check_volume()

Calling ioctl(DIOCGPART) isn't any overhead compared to i/o workload,
so always just retrieve all the volume info whenever volume_info is
allocated rather than each command calling it on demand.

4 years agosbin/hammer: Move pidfile_loc[] to hammer.h
Tomohiro Kusumi [Fri, 2 Sep 2016 12:48:15 +0000 (21:48 +0900)]
sbin/hammer: Move pidfile_loc[] to hammer.h

It's more appropriate to define this in hammer.h than hammer_util.h,
as this string is only used by /sbin/hammer commands.

4 years agosbin/hammer: Make blockmap.c/misc.c include hammer_util.h (not hammer.h)
Tomohiro Kusumi [Fri, 2 Sep 2016 12:37:25 +0000 (21:37 +0900)]
sbin/hammer: Make blockmap.c/misc.c include hammer_util.h (not hammer.h)

If a file is to be linked from non /sbin/hammer (i.e. /sbin/newfs_hammer)
include hammer_util.h, but not hammer.h.

That's basically how things are defined in these two headers.

4 years agosbin/hammer: Remove hammer_cache_set()
Tomohiro Kusumi [Fri, 2 Sep 2016 12:15:09 +0000 (21:15 +0900)]
sbin/hammer: Remove hammer_cache_set()

4 years agofortune(6): Sync fortunes-o with FreeBSD
zrj [Thu, 1 Sep 2016 15:09:51 +0000 (18:09 +0300)]
fortune(6): Sync fortunes-o with FreeBSD

To prepare for dups removal.

4 years agofortunes: Fix typos in some of the fortunes.
zrj [Thu, 1 Sep 2016 15:08:43 +0000 (18:08 +0300)]
fortunes: Fix typos in some of the fortunes.

Also attempt to remove some dups.

Taken-from: FreeBSD (mostly)

4 years agofortune(6): Clean up the murphy.
zrj [Thu, 1 Sep 2016 11:00:54 +0000 (14:00 +0300)]
fortune(6): Clean up the murphy.

Fix few typos (most of them are already in fortunes).
Remove some dups (almost syncs us with FreeBSD)

4 years agofortune(6): Resort few fortunes databases.
zrj [Thu, 1 Sep 2016 10:05:28 +0000 (13:05 +0300)]
fortune(6): Resort few fortunes databases.

To make it easier to check them over (done w/ do_sort + manual edits).
Also take care of indenting quotes in startrek.

4 years agofortune(6): Remove some dup fortunes.
zrj [Thu, 1 Sep 2016 09:58:42 +0000 (12:58 +0300)]
fortune(6): Remove some dup fortunes.

4 years agofortune(6): Rework manpages.
zrj [Thu, 1 Sep 2016 08:00:30 +0000 (11:00 +0300)]
fortune(6): Rework manpages.

Taken-from: FreeBSD

4 years agofortune(6): Use arc4random_uniform(3).
zrj [Thu, 1 Sep 2016 07:38:29 +0000 (10:38 +0300)]
fortune(6): Use arc4random_uniform(3).

Also don't use rindex().

4 years agofortune(6): Add FORTUNE_PATH env variable.
zrj [Thu, 1 Sep 2016 07:15:36 +0000 (10:15 +0300)]
fortune(6): Add FORTUNE_PATH env variable.

There was a slight debug logic error in init_prob().
Also search for fortunes in default dports location too.

Taken-from: FreeBSD

4 years agofortune(6): Turn writing to disk a runtime option.
zrj [Thu, 1 Sep 2016 05:17:12 +0000 (08:17 +0300)]
fortune(6): Turn writing to disk a runtime option.

Add FORTUNE_SAVESTATE environment knob.
Using env variable avoids having non compilable code that might
get stale with future updates and/or changes in base system.

Fix -Werror=sign-compare case in this code.

Taken-from: FreeBSD

4 years agofortune(6): Use argc and argv.
zrj [Thu, 1 Sep 2016 04:54:44 +0000 (07:54 +0300)]
fortune(6): Use argc and argv.

While there disable speedup in collate_range_cmp() (recall causes problems).

4 years agofortune(6): Perform some cleanup.
zrj [Wed, 31 Aug 2016 14:44:35 +0000 (17:44 +0300)]
fortune(6): Perform some cleanup.

Mainly use static and fix indentatation.

While there fix NOTES (offensive fortunes are installed by default).

No functional change.

4 years agosbin/hammer: Make use of struct buffer_info::cache at offset 0
Tomohiro Kusumi [Thu, 1 Sep 2016 11:38:36 +0000 (20:38 +0900)]
sbin/hammer: Make use of struct buffer_info::cache at offset 0

No need to hold a pointer to each other.

4 years agosbin/hammer: Make struct volume_info::name const
Tomohiro Kusumi [Thu, 1 Sep 2016 11:27:45 +0000 (20:27 +0900)]
sbin/hammer: Make struct volume_info::name const

4 years agosbin/hammer: Don't expose VolList
Tomohiro Kusumi [Tue, 30 Aug 2016 12:54:29 +0000 (21:54 +0900)]
sbin/hammer: Don't expose VolList

This is just a cleanup to hide a volume list data itself from
each hammer command (actually only hammer recover command).
Use whatever apis provided instead of raw access to data.

Volume initialization part of hammer recover needs to be fixed
anyway. It needs to allow a broken header (at least to certain
extent) given that the purpose of this command is to recover
from a broken filesystem. It currently forces all the sanity
checks on volume header.

4 years agoif_iwm - Fix iwm_poll_bit() error value check in iwm_attach().
Imre Vadász [Wed, 31 Aug 2016 12:43:46 +0000 (14:43 +0200)]
if_iwm - Fix iwm_poll_bit() error value check in iwm_attach().

* The iwm(4) iwm_poll_bit() function returns 1 on success, and 0 on
  failure, whereas the iwl_poll_bit() in Linux iwlwifi returns < 0 on

4 years ago<sys/param.h>: Bump __DragonFly_version for global getline() visibility.
zrj [Wed, 31 Aug 2016 09:00:03 +0000 (12:00 +0300)]
<sys/param.h>: Bump __DragonFly_version for global getline() visibility.

Some world utilities and headers were touched.

4 years agoRemove usage of _WITH_GETLINE and _WITH_DPRINTF.
zrj [Sat, 20 Aug 2016 15:15:18 +0000 (18:15 +0300)]
Remove usage of _WITH_GETLINE and _WITH_DPRINTF.

While there, update RCS tags.

4 years ago<strio.h>: Drop ancient guards from getline() and dprintf().
zrj [Sat, 20 Aug 2016 14:30:54 +0000 (17:30 +0300)]
<strio.h>: Drop ancient guards from getline() and dprintf().

Since FreeBSD in r303524 removed these guards and most of freebsd-ports
are fixed, it is finally safe to do the same on DragonFly and dports.

While there, update manpages and add fix in vfprintf.c too.

Taken-from: FreeBSD

4 years agoRename getline with get_line to avoid collision with getline(3).
zrj [Sat, 20 Aug 2016 17:16:42 +0000 (20:16 +0300)]
Rename getline with get_line to avoid collision with getline(3).

Just as it was recently done over at FreeBSD.
While there, perform some style changes too (could not resist that).
Only readline() -> read_line() functional change was intended.

4 years agolibc/net: Rename dprintf() to not conflict with dprintf(3).
zrj [Sat, 20 Aug 2016 15:53:24 +0000 (18:53 +0300)]
libc/net: Rename dprintf() to not conflict with dprintf(3).

NOTE: there seems to be missing patches from NetBSD.
Network bits expert needed.

4 years ago<wchar.h>: Fix namespace pollution from <stdio.h>
zrj [Sat, 20 Aug 2016 12:28:19 +0000 (15:28 +0300)]
<wchar.h>: Fix namespace pollution from <stdio.h>

Quite cleaner way.
TODO: FILE should be only visible SUSv2 and POSIX.1-2001

4 years agoPrevent dports gcc "fixing" the last headers.
zrj [Sat, 20 Aug 2016 12:14:26 +0000 (15:14 +0300)]
Prevent dports gcc "fixing" the last headers.

Just mention _GCC_(PTRDIFF|SIZE|WCHAR)_T in comments to force 'gnu_types'
test to skip and not fix these headers. DragonFly types should be fine.

4 years ago<stdio.h>: Fix va_list visibility.
zrj [Sat, 20 Aug 2016 12:04:41 +0000 (15:04 +0300)]
<stdio.h>: Fix va_list visibility.

Looks like it should be visible only at POSIX.1-2008.
SUSv2 requirement to provide va_list definition makes is harder.
While there, mention __gnuc_va_list in comment and add inclusion of <stdarg.h>
for non __GNUC__ case to prevent dports gcc "fixing" this header.

4 years ago<wchar.h>: Explicitly add va_list definition.
zrj [Sat, 20 Aug 2016 11:35:56 +0000 (14:35 +0300)]
<wchar.h>: Explicitly add va_list definition.

Looks like there are serious namespace pollution going on in wchar.h.
Still this header should provide va_list definition as per POSIX and not
rely on pollution that once gets fixed the defintion would be still there.

While there, add empty #ifdef va_start block to prevent dports gcc compilers
from "fixing" this header and causing header shadowing (current variant is fine).

4 years ago<stdlib.h>: Fix MB_CUR_MAX return type.
zrj [Sat, 20 Aug 2016 11:29:46 +0000 (14:29 +0300)]
<stdlib.h>: Fix MB_CUR_MAX return type.

Looks like per POSIX it should be size_t (currently it was int).
While there, expand visibility for long long types (including _Exit())
for certain c++ implementations.

4 years ago<stdarg.h>: Change visibility of va_copy().
zrj [Sat, 20 Aug 2016 11:22:46 +0000 (14:22 +0300)]
<stdarg.h>: Change visibility of va_copy().

Looks like it should be visible in certain c++ level but not under -ansi.
Last case is taken to match private gcc/clang stdarg.h header variant.

4 years agoPrefer to use data model (like __LP64__) for basic types.
zrj [Sat, 20 Aug 2016 11:05:50 +0000 (14:05 +0300)]
Prefer to use data model (like __LP64__) for basic types.

Using architecture when setting basic data types is a bit misleading.
X86_64 technically could support ILP64 and even LLP64 or SILP64.

4 years agops - Adjust STATUS formatting
Matthew Dillon [Wed, 31 Aug 2016 05:17:28 +0000 (22:17 -0700)]
ps - Adjust STATUS formatting

* Remove the leading space for (%s) command display.  The leading space
  was causing indented output via -R to be incorrectly indented.

* Remove the 'L' STATUS flag, it hasn't been meaningful for a long time.
  The status is more likely to fit in its 6-char slot, which we need now
  that many systems have >= 10 cpus.

4 years agokernel - Fix LOOPMASK debugging for Xinvltlb
Matthew Dillon [Wed, 31 Aug 2016 02:36:53 +0000 (19:36 -0700)]
kernel - Fix LOOPMASK debugging for Xinvltlb

* Fix LOOPMASK debugging for Xinvltlb, the #if 1 can now be set to #if 0
  to turn off the debugging.

4 years agokernel: Remove useless if (...).
Sascha Wildner [Tue, 30 Aug 2016 17:36:45 +0000 (19:36 +0200)]
kernel: Remove useless if (...).

4 years agokernel - More threaded core dump fixes
Matthew Dillon [Tue, 30 Aug 2016 17:25:59 +0000 (10:25 -0700)]
kernel - More threaded core dump fixes

* Try to make a more comprehensive fix for this, fixing an endless cpu
  loop in the kernel in the process due to mismatched tests.  Incorporate
  the LWP_MP_WEXIT flag into a new test, STOPLWP().

* tsleep() is now more consistent in setting lwp_stat.

* lwpsignal() needs to allow SIGKILL through during the exit sequence
  in order to wakeup any PCATCH tsleep()s.

* Fix bug in the panic coredump code where the dump_stop_usertds variable
  could cause an endless tstop() loop.

Reported-by: zrj
4 years agobinutils 2.25 linkers: Set default interpreter to valid path
John Marino [Mon, 29 Aug 2016 19:10:42 +0000 (14:10 -0500)]
binutils 2.25 linkers: Set default interpreter to valid path

I originally thought these interpreter definitions didn't affect anything,
but they may explain random stderr messages during building.  In any case,
it doesn't hurt to correct the definitions and this was also done for
devel/binutils in dports.

4 years agoless(1): Upgrade from 471 to 481
John Marino [Mon, 29 Aug 2016 19:48:07 +0000 (14:48 -0500)]
less(1): Upgrade from 471 to 481

4 years agoMerge branch 'vendor/LESS'
John Marino [Mon, 29 Aug 2016 15:28:00 +0000 (10:28 -0500)]
Merge branch 'vendor/LESS'

4 years agoif_iwm - Fix off-by-one check in iwm_read_firmware().
Imre Vadász [Mon, 29 Aug 2016 20:11:09 +0000 (22:11 +0200)]
if_iwm - Fix off-by-one check in iwm_read_firmware().

* Fixes a potential buffer overrun, which was reported by Coverty Scan
  in FreeBSD.

4 years agoUpdate less from version 471 to 481
John Marino [Mon, 29 Aug 2016 19:19:49 +0000 (14:19 -0500)]
Update less from version 471 to 481

4 years agobmake: upgrade version 20141111 => 20160818
John Marino [Mon, 29 Aug 2016 17:25:19 +0000 (12:25 -0500)]
bmake: upgrade version 20141111 => 20160818

This restores the two local modifications reverted prior to the vendor
branch merge, and adds a couple of more to annotate unused variables.

4 years agoMerge branch 'vendor/BMAKE'
John Marino [Mon, 29 Aug 2016 13:21:47 +0000 (08:21 -0500)]
Merge branch 'vendor/BMAKE'

4 years agocontrib/bmake: remove 2 local modifications to prepare for merge
John Marino [Mon, 29 Aug 2016 17:10:29 +0000 (12:10 -0500)]
contrib/bmake: remove 2 local modifications to prepare for merge

4 years agokernel - Fix coredump race with threaded processes
Matthew Dillon [Mon, 29 Aug 2016 18:15:51 +0000 (11:15 -0700)]
kernel - Fix coredump race with threaded processes

* Fix an issue where a threaded process trying to coredump could race
  and cause some threads to get stuck in tstop() when the main thread
  is trying to finally exit.  This creates an unkillable blocked process.

Reported-by: zrj, marino
4 years agokernel - Remove coredump spew on console
Matthew Dillon [Mon, 29 Aug 2016 17:43:14 +0000 (10:43 -0700)]
kernel - Remove coredump spew on console

* Remove coredump warnings on the console when descriptors cannot be
  converted to file-handles in the coredump (NFS related descriptors

4 years agokernel - Attempt to fix panic during shutdown from tmpfs
Matthew Dillon [Mon, 29 Aug 2016 17:27:57 +0000 (10:27 -0700)]
kernel - Attempt to fix panic during shutdown from tmpfs

* When doing a forced-unmount on tmpfs an active vnode may wind up
  staying on the mount's dirty worklist, resulting in an assertion.

* Try to handle the case by forcefully removing the vnode from the dirty
  worklist in the forced-unmount case.

Reported-by: zrj (Rimvydas Jasinskas)
4 years agokernel - Fix STOP/CONT race
Matthew Dillon [Mon, 29 Aug 2016 17:26:14 +0000 (10:26 -0700)]
kernel - Fix STOP/CONT race

* Normally we should not be in LSSLEEP in the tsleep resume code, but a
  pending signal related to STOP/CONT or TSTOP/TCONT can cause us
  to skip the sleep and an interrupt race can change the lp status from
  STOP to SLEEP.  Make sure we are back in the RUN state.

4 years agoUpdate to bmake-20160818 on the vendor branch
John Marino [Mon, 29 Aug 2016 16:40:03 +0000 (11:40 -0500)]
Update to bmake-20160818 on the vendor branch

4 years agoRemove NO_OPENSSH variable functionality
John Marino [Mon, 29 Aug 2016 08:35:26 +0000 (10:35 +0200)]
Remove NO_OPENSSH variable functionality

There doesn't seem to be a legit use case for building with OpenSSL but
without ssh.  Remove the ability to do so to simplify makefiles which
also has the benefit of reducing the number of make.conf options.

The ssh program and openssh private library only consume about 2Mb.

4 years agosys/vfs/hammer: Use typedef'd for struct hammer_inode_data*
Tomohiro Kusumi [Mon, 29 Aug 2016 15:28:02 +0000 (00:28 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_inode_data*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

4 years agosys/vfs/hammer: Use typedef'd for struct hammer_snapshot_data*
Tomohiro Kusumi [Mon, 29 Aug 2016 15:25:28 +0000 (00:25 +0900)]
sys/vfs/hammer: Use typedef'd for struct hammer_snapshot_data*

The whole hammer code is mix of using struct and typedef'd.
Use typedef'd because majority of the code use typedef'd.

4 years agosys/vfs/hammer: Add typedefs for ondisk structures without typedefs
Tomohiro Kusumi [Mon, 29 Aug 2016 15:10:18 +0000 (00:10 +0900)]
sys/vfs/hammer: Add typedefs for ondisk structures without typedefs

Some ondisk data structures have typedefs, but others don't.

4 years agosys/kern: Make struct buf::b_dep a member of union
Tomohiro Kusumi [Mon, 29 Aug 2016 13:13:21 +0000 (22:13 +0900)]
sys/kern: Make struct buf::b_dep a member of union

struct buf::b_dep being a list head is too specific to UFS.
HAMMER or other filesystems want this to be a void* pointer.

It also forces HAMMER or other filesystems to define their own
struct worklist because no such struct is defined outside of
the UFS source which is insane in terms of a kernel structure
for general blk i/o.

Also see 71199586f.

4 years agosbin/hammer: Fix irrelevant comments
Tomohiro Kusumi [Mon, 29 Aug 2016 11:24:14 +0000 (20:24 +0900)]
sbin/hammer: Fix irrelevant comments

4 years agosbin/hammer: Sync zone statistics format with print_blockmap()
Tomohiro Kusumi [Mon, 29 Aug 2016 11:16:39 +0000 (20:16 +0900)]
sbin/hammer: Sync zone statistics format with print_blockmap()