37 hours agokernel/netgraph7: Fix panic master
Markus Pfeiffer [Sat, 24 Feb 2018 14:11:06 +0000 (14:11 +0000)]
kernel/netgraph7: Fix panic

We just unset the M_HASH flag for the mbuf before queueing the
message to the netisr, making sure the handler doesn't run
on the wrong CPU.

2 days agolibc: Fix a comment in Makefile.inc.
Sascha Wildner [Fri, 23 Feb 2018 08:30:55 +0000 (09:30 +0100)]
libc: Fix a comment in Makefile.inc.

2 days agostring.3: Fix types of strlcat() and strlcpy() prototypes.
Sascha Wildner [Fri, 23 Feb 2018 07:57:14 +0000 (08:57 +0100)]
string.3: Fix types of strlcat() and strlcpy() prototypes.

3 days agosyscons - Detangle sysmouse from tty handling, implement a custom FIFO.
Imre Vadász [Thu, 22 Feb 2018 21:54:33 +0000 (22:54 +0100)]
syscons - Detangle sysmouse from tty handling, implement a custom FIFO.

* This avoids unnecessary IPIs and other overhead from the tty handling.

* This also makes reads from the character device always get only complete
  sysmouse packets.

3 days agosyscons - No special minor device number is needed anymore for sysmouse.
Imre Vadász [Thu, 22 Feb 2018 21:54:10 +0000 (22:54 +0100)]
syscons - No special minor device number is needed anymore for sysmouse.

3 days agoselect.2: timeout is restrict too.
Sascha Wildner [Thu, 22 Feb 2018 17:56:30 +0000 (18:56 +0100)]
select.2: timeout is restrict too.

3 days agoAdd missing restrict qualifiers to various manual pages.
Sascha Wildner [Thu, 22 Feb 2018 17:40:14 +0000 (18:40 +0100)]
Add missing restrict qualifiers to various manual pages.

3 days agokernel/u4b: Some additional work for the recent cdce(4) addition.
Sascha Wildner [Thu, 22 Feb 2018 13:37:35 +0000 (14:37 +0100)]
kernel/u4b: Some additional work for the recent cdce(4) addition.

* Add a manual page from FreeBSD.

* Add to LINT64.

* Adjust devd(8) configuration so that cdce.ko automatically loads upon

3 days agokernel/u4b: Use CDCE_LOCK/CDCE_UNLOCK macros
Markus Pfeiffer [Wed, 21 Feb 2018 23:57:23 +0000 (23:57 +0000)]
kernel/u4b: Use CDCE_LOCK/CDCE_UNLOCK macros

3 days agokernel: port if_cdce
Markus Pfeiffer [Mon, 19 Feb 2018 20:59:02 +0000 (20:59 +0000)]
kernel: port if_cdce

While here also update it to FreeBSD's

3 days agokernel/acpi: Remove the old APM emulation code.
Sascha Wildner [Thu, 22 Feb 2018 06:50:13 +0000 (07:50 +0100)]
kernel/acpi: Remove the old APM emulation code.

This is no longer needed by anything. The <machine/apm_bios.h> header
with APM ioctl defines can go as well.

While here, do a little adjustment of comments and manual pages too.

Pointed-out-by: ivadasz
4 days agoUPGRADING: Mention the recent removal of 'device virtio_pci'.
Sascha Wildner [Wed, 21 Feb 2018 10:01:29 +0000 (11:01 +0100)]
UPGRADING: Mention the recent removal of 'device virtio_pci'.

5 days agonrelease - Add missing headers to src-sys.tar.bz2
Matthew Dillon [Tue, 20 Feb 2018 18:47:26 +0000 (10:47 -0800)]
nrelease - Add missing headers to src-sys.tar.bz2

* Add missing headers to src-sys.tar.bz2 so 'make nativekernel'
  actually works.

Reported-by: Constantine A. Murenin
5 days agolibc/libc_rtld: Fix up some comments in the Makefiles.
Sascha Wildner [Tue, 20 Feb 2018 13:28:02 +0000 (14:28 +0100)]
libc/libc_rtld: Fix up some comments in the Makefiles.

5 days agogpt - Add a new directive called 'init'
Matthew Dillon [Tue, 20 Feb 2018 08:39:01 +0000 (00:39 -0800)]
gpt - Add a new directive called 'init'

* Add a new directive called 'init'.  This directive works like
  gpt create except it will also create a msdos slice 0 (and newfs_msdos
  it), and a "DragonFly Label64" slice 1, and
  'disklabel -r -w <slice1> auto'.

* If -B is also specified, the init directive will populate the msdos
  filesystem with efi/boot/bootx64.efi, and also supplies -B to the
  disklabel command.

* This command does not create the boot, swap, or root filesystem
  partitions in the disklabel.  It is meant to do something similar
  to what fdisk -IB used to do for us for legacy partitions (though
  I should note that fdisk -IB didn't initialize a new disklabel).  But
  we do for gpt.

5 days agokernel/ncr: Fix double assignment.
Sascha Wildner [Tue, 20 Feb 2018 07:36:41 +0000 (08:36 +0100)]
kernel/ncr: Fix double assignment.

Taken-from: FreeBSD

5 days agokernel/i915: Fix double assignment (Linux' ed58570f55e2c5755).
Sascha Wildner [Tue, 20 Feb 2018 07:30:16 +0000 (08:30 +0100)]
kernel/i915: Fix double assignment (Linux' ed58570f55e2c5755).

5 days agokernel/i915: Fix double assignment (Linux' 52eb92c6fe8f89c30).
Sascha Wildner [Tue, 20 Feb 2018 07:25:33 +0000 (08:25 +0100)]
kernel/i915: Fix double assignment (Linux' 52eb92c6fe8f89c30).

5 days agortadvd(8): Fix double assignment.
Sascha Wildner [Tue, 20 Feb 2018 07:10:06 +0000 (08:10 +0100)]
rtadvd(8): Fix double assignment.

ra->nd_ra_flags_reserved is initialized properly a few lines below.
Assigning 0 first is unnecessary.

5 days agokernel/urtw: Fix double assignments.
Sascha Wildner [Tue, 20 Feb 2018 07:05:43 +0000 (08:05 +0100)]
kernel/urtw: Fix double assignments.

This driver hasn't been properly ported and isn't built currently. The
fix is just to silence coccinelle when searching for double assignments.

Taken-from: FreeBSD

5 days agotools/w00t: Fix double assignment.
Sascha Wildner [Tue, 20 Feb 2018 06:57:52 +0000 (07:57 +0100)]
tools/w00t: Fix double assignment.

6 days agoFix two double assignments in the kernel and the boot code.
Sascha Wildner [Mon, 19 Feb 2018 12:46:53 +0000 (13:46 +0100)]
Fix two double assignments in the kernel and the boot code.

7 days agovirtio - Remove explicit load of virtio.ko. Remove device virtio_pci line.
Imre Vadász [Sun, 12 Mar 2017 12:54:48 +0000 (13:54 +0100)]
virtio - Remove explicit load of virtio.ko. Remove device virtio_pci line.

* virtio.ko never needs to be loaded explicitly, since virtio_pci.ko
  depends on it.

* Also get rid of device virtio_pci line in the kernel config. Similar to
  other buses, link virtio_pci statically into the kernel when both
  device virtio and device pci are configured.

7 days agoncurses: Make sure to pass NXCFLAGS to NXCC.
zrj [Mon, 5 Feb 2018 18:04:30 +0000 (20:04 +0200)]
ncurses: Make sure to pass NXCFLAGS to NXCC.

Only the -I... paths are needed for cpp invocation.

7 days agoLIBPRIV: Make sure sh(1) only depends on lib.so.
zrj [Wed, 7 Feb 2018 14:48:20 +0000 (16:48 +0200)]
LIBPRIV: Make sure sh(1) only depends on lib.so.

Avoid possible cases of failed installworld target.

7 days agosh(1): Add and use pregenerated headers.
zrj [Tue, 6 Feb 2018 21:56:48 +0000 (23:56 +0200)]
sh(1): Add and use pregenerated headers.

These only add 30k to the repo while ensuring that bin/sh would not be
affected by bad shell script invocation etc. As the bonus it solves the
issue in share/initrd too. Nothing in the generated headers should fail
for our use cases. If that would change, please report it.

7 days agodevinfo - Print info, whether a device is flagged as disabled.
Imre Vadász [Mon, 5 Feb 2018 17:19:52 +0000 (18:19 +0100)]
devinfo - Print info, whether a device is flagged as disabled.

* Also make -v print only enabled devices, specifying -v twice will also
  print disabled devices. This should make "devinfo -v" output less
  confusing on modern hardware with lots of non-present devices in the ACPI

7 days agolibdevinfo - Fix enum devinfo_state.
Imre Vadász [Mon, 5 Feb 2018 17:19:33 +0000 (18:19 +0100)]
libdevinfo - Fix enum devinfo_state.

7 days agokern - Add D_MEM flag to /dev/mem and /dev/kmem character devices.
Imre Vadász [Mon, 5 Feb 2018 20:24:11 +0000 (21:24 +0100)]
kern - Add D_MEM flag to /dev/mem and /dev/kmem character devices.

* This makes seeking actually work on these character devices, which fixes
  performance of various tools when reading from /dev/mem or /dev/kmem.

7 days agoatkbdc - Do not attach PS2 controller via legacy ISA bus, if FADT says so.
Imre Vadász [Thu, 1 Feb 2018 12:16:55 +0000 (13:16 +0100)]
atkbdc - Do not attach PS2 controller via legacy ISA bus, if FADT says so.

* If the FADT BootFlags value tells us that we shouldn't expect the PS2
  controller to be at the IO ports 0x60/0x64, we should instead only attach
  the atkbdc driver when there is a matching device in the ACPI namespace.

* This avoids attempts to attach the atkbdc PS2 controller driver on
  hardware which doesn't have a usable PS2 controller. This happens on
  many modern notebooks, and has been the case for some time on desktop
  hardware that doesn't provide an emulated PS2 controller for using USB
  input devices all the time (it either is never initialized, or might
  get disabled by some of the ACPI or USB initialization during bootup).

8 days agoReplace local array size calculations with NELEM().
Sascha Wildner [Sun, 18 Feb 2018 01:42:43 +0000 (02:42 +0100)]
Replace local array size calculations with NELEM().

8 days agoConvert from __arysize to NELEM
Eitan Adler [Fri, 16 Feb 2018 08:53:39 +0000 (00:53 -0800)]
Convert from __arysize to NELEM

Try to use a single macro across the board

Discussed-with: zrj, swildner

8 days agonfs.5: Adjust (c) year.
Sascha Wildner [Sat, 17 Feb 2018 22:35:11 +0000 (23:35 +0100)]
nfs.5: Adjust (c) year.

8 days agonfs.5: Remove unneeded .Pp
Sascha Wildner [Sat, 17 Feb 2018 22:31:09 +0000 (23:31 +0100)]
nfs.5: Remove unneeded .Pp

8 days agodevfs.5: Document sysctl.
Sascha Wildner [Sat, 17 Feb 2018 22:29:15 +0000 (23:29 +0100)]
devfs.5: Document sysctl.

Submitted-by: zrj
8 days agoffs.5: Document more sysctls.
Sascha Wildner [Sat, 17 Feb 2018 22:28:15 +0000 (23:28 +0100)]
ffs.5: Document more sysctls.

Move ffs sysctls to their own section.

Submitted-by: zrj
8 days agoAdd nfs(5) manpage.
Sascha Wildner [Sat, 17 Feb 2018 22:27:03 +0000 (23:27 +0100)]
Add nfs(5) manpage.

Document all sysctls.

Submitted-by: zrj
8 days agoAdd vfs(7) manpage.
Sascha Wildner [Sat, 17 Feb 2018 22:25:39 +0000 (23:25 +0100)]
Add vfs(7) manpage.

Document all sysctls except for sizeof stuct ones.

Submitted-by: zrj
8 days agokernel - Fix syscons's visual bell
Matthew Dillon [Sat, 17 Feb 2018 19:29:49 +0000 (11:29 -0800)]
kernel - Fix syscons's visual bell

* The visual bell code was completely broken.

* Refactor the callout, and use the new callout_init_lk facility
  to deal with races.

Reported-by: snurg
8 days agodrm/linux: Update hlist_for_each_entry_safe() from FreeBSD
François Tigeot [Sat, 17 Feb 2018 08:56:55 +0000 (09:56 +0100)]
drm/linux: Update hlist_for_each_entry_safe() from FreeBSD

9 days agosbin/hammer: Fix compile warning on Linux
Tomohiro Kusumi [Sat, 17 Feb 2018 01:49:39 +0000 (10:49 +0900)]
sbin/hammer: Fix compile warning on Linux

Warned by gcc 7.3.1 in Fedora.
Extend the size of destination string.
dirent::d_name[] is 256 bytes in Linux (and *BSD).

cmd_abort.c: In function 'hammer_cmd_abort_cleanup':
cmd_abort.c:73:44: warning: '%s' directive output may be truncated writing up to 255 bytes into a region of size 55 [-Wformat-truncation=]
    snprintf (pidfile, PIDFILE_BUFSIZE, "%s/%s",
cmd_abort.c:73:4: note: 'snprintf' output between 10 and 265 bytes into a destination of size 64
    snprintf (pidfile, PIDFILE_BUFSIZE, "%s/%s",
     pidfile_loc, den->d_name);

9 days agomille(6): minor nits
Eitan Adler [Fri, 16 Feb 2018 08:13:08 +0000 (00:13 -0800)]
mille(6): minor nits

- adding missing header
- remove unused variable
- static where possible

Reviewed-by: zrj

10 days agogcc50: Switch backends to use internal lib framework.
zrj [Wed, 14 Feb 2018 15:08:24 +0000 (17:08 +0200)]
gcc50: Switch backends to use internal lib framework.

Previously backends where implicitly using bsd.hostlib.mk that have few
unwanted side effects (backends are install targets). Avoid that.
No functional change for current master users.

Tested-with: WORLD_CCVER and _DEFAULT_CCVER combinations.

10 days agofish(6): Suppress -Wdiscarded-qualifiers warning.
zrj [Thu, 15 Feb 2018 13:43:06 +0000 (15:43 +0200)]
fish(6): Suppress -Wdiscarded-qualifiers warning.

10 days ago/usr/Makefile: Fix typo.
Sascha Wildner [Thu, 15 Feb 2018 14:19:30 +0000 (15:19 +0100)]
/usr/Makefile: Fix typo.

10 days agocorrect prior commit...
Eitan Adler [Thu, 15 Feb 2018 12:21:58 +0000 (04:21 -0800)]
correct prior commit...

10 days agolarn(6): fix open call
Eitan Adler [Thu, 15 Feb 2018 12:17:58 +0000 (04:17 -0800)]
larn(6): fix open call

Prior to this the ", 0666" was being treated like the comma operator
rather than an argument to open(2).

10 days agolarn(6): remove HIDEBYLINK
Eitan Adler [Thu, 15 Feb 2018 12:10:13 +0000 (04:10 -0800)]
larn(6): remove HIDEBYLINK

The implementation of HIDEBYLINK is a bit wonky, doesn't really work,
and includes its own reimplementation of bzero.

10 days agofish(6): fix several issues
Eitan Adler [Thu, 15 Feb 2018 11:52:52 +0000 (03:52 -0800)]
fish(6): fix several issues

- avoid use of _ in application namespace
- use posix_spawnp instead of system()
- prefer less(1) over more(1)
- mark usage as dead
- staticfy

This world-class programs deserves world-class source code.

10 days agoUpdate the pciconf(8) database.
Sascha Wildner [Thu, 15 Feb 2018 11:03:40 +0000 (12:03 +0100)]
Update the pciconf(8) database.

February 15, 2018 snapshot from https://pci-ids.ucw.cz

10 days ago<pthread.h>: Note that we are missing some functions in #if 0'd protos.
Sascha Wildner [Thu, 15 Feb 2018 09:10:34 +0000 (10:10 +0100)]
<pthread.h>: Note that we are missing some functions in #if 0'd protos.

10 days agodevd: only use correct argument in select(2)
Eitan Adler [Thu, 15 Feb 2018 08:53:49 +0000 (00:53 -0800)]
devd: only use correct argument in select(2)

Discussed-with: zrj
Reviewed-by: vangyzen@FreeBSD.org, ian@FreeBSD.org
Objected-to-by: imp@FreeBSD.org

10 days agoselect(2): mark as restrict in man page
Eitan Adler [Thu, 15 Feb 2018 08:40:34 +0000 (00:40 -0800)]
select(2): mark as restrict in man page

This has already been done in code, so change the man page

Discussed-with: swildner

10 days agoAdd missing restrict qualifiers in POSIX function definitions/declarations.
Sascha Wildner [Thu, 15 Feb 2018 08:54:34 +0000 (09:54 +0100)]
Add missing restrict qualifiers in POSIX function definitions/declarations.

This creates no further -Wrestrict warnings with gcc80 in buildworld.

10 days ago<sys/cdefs.h>: Add __restrict_arr to declare arrays as non-overlapping.
Sascha Wildner [Thu, 15 Feb 2018 08:26:09 +0000 (09:26 +0100)]
<sys/cdefs.h>: Add __restrict_arr to declare arrays as non-overlapping.

Based-on: glibc

11 days agokernel - Vet b_cmd in swap_pager_strategy().
Matthew Dillon [Wed, 14 Feb 2018 19:53:40 +0000 (11:53 -0800)]
kernel - Vet b_cmd in swap_pager_strategy().

* swap_pager_strategy() needs to properly vet b_cmd.  This doesn't fix
  any bugs per-say, but is needed for robustness to ensure that the code
  does not accidently corrupt the swapcache in a later evolution.

11 days agokernel - Fix rare missed wakeup() in lockmgr
Matthew Dillon [Wed, 14 Feb 2018 19:49:40 +0000 (11:49 -0800)]
kernel - Fix rare missed wakeup() in lockmgr

* Fix a rare missed wakeup() case in lockmgr.  lk_count can briefly
  become (SHARED | 0 counts | (EXREQ or UPREQ)).  Three competing cores
  can then cause a situation where undo_shreq() fails to issue a wakeup()
  to threads acquiring a shared lock that are blocked waiting for the

  Issue the missing wakeup() for this case.

* This race arises because of an optimization we make when dropping a
  shared lock.  atomic_fcmpset*() loops are fairly poor at dealing
  with concurrent increments and decrements, so undo_shreq() (which
  is also used when releasing a standard shared lock) decrements the
  shared lock count first, then deals with EXREQ or UPREQ afterwords.

  Usually a shared lock request bumps the shared lock count before
  blocking, which other lock releases use to determine the need for a
  wakeup().  However, shared lock requests cannot bump the shared lock
  count when the lock is already held SHARED but there is an EXREQ or
  UPREQ pending, because doing do basically grants the shared lock

  This combination leads to the brief situation which allows other cpu
  cores to squeeze in operations of their own without realizing that
  someone might be blocked trying to obtain a shared lock, but with no
  shared count present to indicate so.  If the undo_shreq()'s later
  atomic_fcmpset*() calls then fail, or find that there is no EXREQ or
  UPREQ pending, it fails to issue the needed wakeup().

11 days agohammer2 - Add missing bkvasync() (2)
Matthew Dillon [Wed, 14 Feb 2018 15:48:10 +0000 (07:48 -0800)]
hammer2 - Add missing bkvasync() (2)

* Add another missing bkvasync().  This fixes a temporary (memory-only)
  corruption issue which crops up in synth tests.

11 days agokernel - Document bkvasync() requirements
Matthew Dillon [Wed, 14 Feb 2018 15:45:26 +0000 (07:45 -0800)]
kernel - Document bkvasync() requirements

* Document that bkvasync() needs to be callable from multiple
  cpus concurrently (aka H2 shared buffering).  The lock has to be
  controlled by the caller (owned by the caller in some way), but the
  owner does not have to be the calling cpu.

11 days agoBump __DragonFly_version after %b and %r formats removal.
zrj [Wed, 14 Feb 2018 09:30:38 +0000 (11:30 +0200)]
Bump __DragonFly_version after %b and %r formats removal.

11 days agoddb: Some minor adjustments.
Sascha Wildner [Wed, 14 Feb 2018 08:49:50 +0000 (09:49 +0100)]
ddb: Some minor adjustments.

11 days agokernel: Add security.ptr_restrict sysctl.
zrj [Sun, 4 Feb 2018 17:13:02 +0000 (19:13 +0200)]
kernel: Add security.ptr_restrict sysctl.

Allow to prevent leaking kernel addresses back to the userland
(intentionally or not). We have quite a lot debug prints already and by
default we allow unprivileged processes to read kernel message buffers.

11 days agoUpdate porting_drivers.txt
zrj [Sun, 4 Feb 2018 15:58:34 +0000 (17:58 +0200)]
Update porting_drivers.txt

11 days agoworld: Remove references to %r and %b.
zrj [Sun, 4 Feb 2018 15:32:02 +0000 (17:32 +0200)]
world: Remove references to %r and %b.

While there, remove %r and %b and %y support from libstand(3).
Those format are not used in loaders and only eat space.

11 days agokernel: Remove last use cases of "%b" format.
zrj [Sun, 4 Feb 2018 14:50:03 +0000 (16:50 +0200)]
kernel: Remove last use cases of "%b" format.

Switch to args safe "%pb%i" internal format.

11 days agokernel/disk: Remove use of "%b" format.
zrj [Sun, 4 Feb 2018 14:27:27 +0000 (16:27 +0200)]
kernel/disk: Remove use of "%b" format.

Switch to args safe "%pb%i" internal format.

11 days agokernel/net: Remove use of "%b" format.
zrj [Sun, 4 Feb 2018 13:06:59 +0000 (15:06 +0200)]
kernel/net: Remove use of "%b" format.

Switch to args safe "%pb%i" internal format.

Note: the if_nfe.c used 0x%4b format, while %b was not handling the width.

11 days agokernel: Remove use of "%b" format in main kernel code.
zrj [Sun, 4 Feb 2018 12:30:53 +0000 (14:30 +0200)]
kernel: Remove use of "%b" format in main kernel code.

Switch to args safe "%pb%i" internal format.

11 days agokernel: Implement "%pb%i" as args safe "%b" replacement.
zrj [Sun, 4 Feb 2018 12:15:43 +0000 (14:15 +0200)]
kernel: Implement "%pb%i" as args safe "%b" replacement.

11 days agokernel: Nuke legacy FreeBSD "%r" format support.
zrj [Sat, 3 Feb 2018 19:27:51 +0000 (21:27 +0200)]
kernel: Nuke legacy FreeBSD "%r" format support.

Makes a quite a cleanup in subr_prf.c and less hits against things
like "%rip". Only one custom format remains - "%b".

11 days agokernel: Remove use of deprecated "%r" radix format.
zrj [Sat, 3 Feb 2018 18:42:11 +0000 (20:42 +0200)]
kernel: Remove use of deprecated "%r" radix format.

11 days agokernel: Implement makedev_unit_b32()
zrj [Sat, 3 Feb 2018 18:37:03 +0000 (20:37 +0200)]
kernel: Implement makedev_unit_b32()

It would be used to replace deprecated legacy FreeBSD "%r" formats.
Change tty_pty.c to use hex2ascii(), since it has only upto 32 devices.

11 days agoddb(4): Remove use of deprecated "%r" radix format.
zrj [Sat, 3 Feb 2018 13:08:21 +0000 (15:08 +0200)]
ddb(4): Remove use of deprecated "%r" radix format.

Use internal helpers like for "%z" to print numbers.

Taken-from: NetBSD (with adaptations by swildner)

11 days agokernel - Try to fix delayed mtime updates on SHARED+RW maps again
Matthew Dillon [Wed, 14 Feb 2018 07:02:18 +0000 (23:02 -0800)]
kernel - Try to fix delayed mtime updates on SHARED+RW maps again

* Attempt to fix continuing problems with mtime updates related to
  modifications made via SHARED+RW mmap()s.  As evidenced by builds
  under synth sometimes getting confused.

* Don't update vp->v_lastwrite_ts in vop_stdclose().  Instead, update
  the field and set a new flag VLASTWRITETS upon mmap(SHARED+PROT_WRITE)
  or upon mprotect(PROT_WRITE) on a SHARED mmap.

* Clear the flag on any regular write, utimes, or truncation.

* Adjust various filesystems to update mtime from vp->v_lastwrite_ts
  only upon UIO_NOCOPY writes, and only if VLASTWRITETS is set.

  tmpfs, ufs, hammer, hammer2 adjusted.

12 days agohammer2 - Add missing bkvasync()
Matthew Dillon [Wed, 14 Feb 2018 01:46:46 +0000 (17:46 -0800)]
hammer2 - Add missing bkvasync()

* Add missing bkvasync() when a file read receives a chain from the
  XOP helper thread.

12 days agopthread.3: Add missing functions.
Sascha Wildner [Tue, 13 Feb 2018 17:25:10 +0000 (18:25 +0100)]
pthread.3: Add missing functions.

12 days ago<signal.h>: Adjust #if 0'd prototype.
Sascha Wildner [Tue, 13 Feb 2018 17:23:21 +0000 (18:23 +0100)]
<signal.h>: Adjust #if 0'd prototype.

12 days agoChange __restrict -> restrict in two manual pages.
Sascha Wildner [Tue, 13 Feb 2018 17:22:38 +0000 (18:22 +0100)]
Change __restrict -> restrict in two manual pages.

12 days agosbin/hammer: Fix compile error on Linux
Tomohiro Kusumi [Tue, 13 Feb 2018 23:48:39 +0000 (08:48 +0900)]
sbin/hammer: Fix compile error on Linux

Failed with gcc 4.4.7 in CentOS 6.x.
cmd_recover.c:78: error: redefinition of typedef 'bigblock_t'
cmd_recover.c:55: note: previous declaration of 'bigblock_t' was here

12 days agosys/vfs/autofs: Remove AUTOFS_ASSERT_*LOCKED()
Tomohiro Kusumi [Tue, 13 Feb 2018 23:35:32 +0000 (08:35 +0900)]
sys/vfs/autofs: Remove AUTOFS_ASSERT_*LOCKED()

These macros came from FreeBSD, but more readable without these.

12 days agosys/vfs/autofs: Change autofs_mount::am_lock to use mutex(9)
Tomohiro Kusumi [Tue, 13 Feb 2018 22:13:13 +0000 (07:13 +0900)]
sys/vfs/autofs: Change autofs_mount::am_lock to use mutex(9)

12 days agosys/vfs/autofs: Change autofs_node::an_vnode_lock to use mutex(9)
Tomohiro Kusumi [Tue, 13 Feb 2018 21:57:32 +0000 (06:57 +0900)]
sys/vfs/autofs: Change autofs_node::an_vnode_lock to use mutex(9)

12 days agohammer(8): Remove include guards in a .c file.
Sascha Wildner [Tue, 13 Feb 2018 14:06:25 +0000 (15:06 +0100)]
hammer(8): Remove include guards in a .c file.

12 days agosys/vfs/autofs: Remove #if0'd export related code
Tomohiro Kusumi [Tue, 13 Feb 2018 18:33:30 +0000 (03:33 +0900)]
sys/vfs/autofs: Remove #if0'd export related code

Exporting is never going to be implemented.

12 days agosys/vfs/autofs: Cleanups
Tomohiro Kusumi [Tue, 13 Feb 2018 17:10:39 +0000 (02:10 +0900)]
sys/vfs/autofs: Cleanups

12 days agobinutils227: Add support for DWARF-4 line number tables.
zrj [Tue, 13 Feb 2018 09:56:13 +0000 (11:56 +0200)]
binutils227: Add support for DWARF-4 line number tables.

Backport from upstream trunk the c83344582375e65643c5efe68b3739e87db482f3

Work around the ld.gold issue when '.rela.debug_line' is populated.
We use ld.gold as default system linker that sigbus on DWARF-4 tables.
LDVER=ld.bfd seems to be unaffected, apply 2018-02-03 fix only for 227.
No functional change for default non-debug buildworlds (only for gcc80).

13 days ago<unistd.h>: Remove commented out ctermid() prototype. It's not needed here.
Sascha Wildner [Mon, 12 Feb 2018 20:05:42 +0000 (21:05 +0100)]
<unistd.h>: Remove commented out ctermid() prototype. It's not needed here.

13 days agoetc/autofs: Cleanup trailing whitespaces
Tomohiro Kusumi [Tue, 13 Feb 2018 02:28:15 +0000 (11:28 +0900)]
etc/autofs: Cleanup trailing whitespaces

This generates diff from FreeBSD.

13 days agoetc/autofs: Sync special_media with FreeBSD
Tomohiro Kusumi [Mon, 12 Feb 2018 10:24:24 +0000 (19:24 +0900)]
etc/autofs: Sync special_media with FreeBSD

13 days agousr.sbin/fstyp: Bring in exFAT support from FreeBSD
Tomohiro Kusumi [Mon, 12 Feb 2018 10:22:40 +0000 (19:22 +0900)]
usr.sbin/fstyp: Bring in exFAT support from FreeBSD

exFAT support was added by below FreeBSD@GitHub commit in 2017.

2 weeks agotmpfs - Fix data loss issues
Matthew Dillon [Sun, 11 Feb 2018 06:18:19 +0000 (22:18 -0800)]
tmpfs - Fix data loss issues

* Fix a data loss issue that can occur when vnodes are cycled.  This
  can be replicated by setting kern.maxvnodes to a fairly low value.
  Vnode recycling does not necessarily issue a vinvalbuf() when clean
  pages are present, which tmpfs needs to retain.

* Fix a data loss issue when swap becomes full or when the system has
  no swap configured.  When tmpfs tries to flush to swap and fails,
  pages can remain associated with the vnode after the vinvalbuf()
  call, and then lost when the vnode is recycled.

* The above fixes are accomplished by call vinvalbuf() on vnode deactivation
  to make sure that all buffers have been flushed, and then moving any
  pages that remain to tn_aobj.

  The pages are moved back when the vnode is reinstantiated and an open(),
  read(), write(), or setattr (i.e.  truncation or extension) is called.

  We try to avoid moving the pages back if the vnode is merely *stat()d
  or deleted.

* Use cluster_read() by default to try to improve read throughput when
  pages are swap-backed.

Reported-by: zrj, marino
2 weeks agokernel - syntax
Matthew Dillon [Sun, 11 Feb 2018 06:17:31 +0000 (22:17 -0800)]
kernel - syntax

* Improve a formatting issue.

2 weeks agokernel - Fix two rare namecache bugs
Matthew Dillon [Sun, 11 Feb 2018 06:11:18 +0000 (22:11 -0800)]
kernel - Fix two rare namecache bugs

* Fix calculations which use the vfscache_negs global.  This global
  is somewhat heuristical and can values which are a bit off, including
  0.  Copy to a local and limit the range, fixing a divide-by-zero
  bug and a negative-number handling bug.

* Fix a bug in the handling of a race in _cache_cleanneg().  We were
  unlocking the ncp but failing to drop it, leaving it with a ref.
  The accumulating namecache records prevent umount from succeeding.

  This race can only occur regularly when kern.maxvnodes is set to
  a low value.

2 weeks agoif: Allow user to override software queue length.
Sepherosa Ziehau [Sat, 10 Feb 2018 02:37:16 +0000 (10:37 +0800)]
if: Allow user to override software queue length.

2 weeks agoif: Remove ifq maxlen fixup in ifinit.
Sepherosa Ziehau [Sat, 10 Feb 2018 00:19:49 +0000 (08:19 +0800)]
if: Remove ifq maxlen fixup in ifinit.

It will not work, and no drivers in the base require this kind of fixup.

2 weeks ago<fcntl.h>: Add #if 0'd prototypes for posix_fa{dvise,llocate}().
Sascha Wildner [Thu, 8 Feb 2018 10:16:52 +0000 (11:16 +0100)]
<fcntl.h>: Add #if 0'd prototypes for posix_fa{dvise,llocate}().

2 weeks agosyscall.9: Explain better how errno and return value are set in userland.
Sascha Wildner [Wed, 7 Feb 2018 14:06:18 +0000 (15:06 +0100)]
syscall.9: Explain better how errno and return value are set in userland.

In-discussion-with: peeterm, zrj

2 weeks agoUse 'null' and 'NULL' instead of 'nil' in some manual pages.
Sascha Wildner [Tue, 6 Feb 2018 08:49:30 +0000 (09:49 +0100)]
Use 'null' and 'NULL' instead of 'nil' in some manual pages.

3 weeks agokernel - Do not panic on media size of zero in disk_probe()
Matthew Dillon [Sun, 4 Feb 2018 19:17:47 +0000 (11:17 -0800)]
kernel - Do not panic on media size of zero in disk_probe()

* Do not panic if the media size is zero in disk_probe().

3 weeks agokernel - Fix CAM peripheral error handling
Matthew Dillon [Sun, 4 Feb 2018 19:13:03 +0000 (11:13 -0800)]
kernel - Fix CAM peripheral error handling

* cam_periph.c was bcopy()ing the *ENTIRE* saved ccb back to the
  original when working through certain error results.  This completely
  destroys linked list entry fields.

* Refactor by hacking a restore_ccb() function which does not copy
  over the link list entry fields or the callout structure.

* Fixes panics with CDs, particularly audio CDs, and can also fix
  other panics.

  Panics are related to situations where an AHCI error or errors occur
  while multiple CCBs are queued.

* Also always initialize the state tracking field for various scsi
  periphals to ensure that stale data does not result in improper
  processing in scsi/*.c's *done() functions.

Reported-by: htse