7 hours agoUse nitems() from sys/param.h. master github/master
araujo [Sat, 30 Jul 2016 07:28:15 +0000 (07:28 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: (BSD Day Taiwan)

7 hours agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:15:54 +0000 (07:15 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: (BSD Day Taiwan)

8 hours agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:06:23 +0000 (07:06 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: (BSD Day Taiwan)

8 hours agoRestore an ifdef that should not have been removed in r303535.
markj [Sat, 30 Jul 2016 07:05:32 +0000 (07:05 +0000)]
Restore an ifdef that should not have been removed in r303535.

X-MFC-With: r303535

8 hours agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:04:46 +0000 (07:04 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: (BSD Day Taiwan)

8 hours agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 07:02:33 +0000 (07:02 +0000)]
Use nitems() from sys/param.h.

MFC after: 2 weeks.
Sponsored by: (BSD Day Taiwan)

8 hours agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 06:35:49 +0000 (06:35 +0000)]
Use nitems() from sys/param.h.

Sponsored by: (BSD Day Taiwan)
MFC after:  2 weeks.

8 hours agoUse nitems() from sys/param.h
araujo [Sat, 30 Jul 2016 06:32:18 +0000 (06:32 +0000)]
Use nitems() from sys/param.h

Sponsored by: (BSD Day Taiwan)

8 hours agoUse nitems() from sys/param.h.
araujo [Sat, 30 Jul 2016 06:19:34 +0000 (06:19 +0000)]
Use nitems() from sys/param.h.

Sponsored by: (BSD Day Taiwan)

10 hours agoExplicitly test for cu_fgets returning NULL or !NULL
ngie [Sat, 30 Jul 2016 04:40:44 +0000 (04:40 +0000)]
Explicitly test for cu_fgets returning NULL or !NULL

MFC after: 3 weeks
Sponsored by: EMC / Isilon Storage Division

11 hours agoAdd libprocstat prebuild library dependencies.
markj [Sat, 30 Jul 2016 03:43:55 +0000 (03:43 +0000)]
Add libprocstat prebuild library dependencies.

X-MFC-With: r303531

12 hours agoRework r303074 case 4. Don't immediatelly skip directory entries which
ache [Sat, 30 Jul 2016 03:11:54 +0000 (03:11 +0000)]
Rework r303074 case 4. Don't immediatelly skip directory entries which
cause MAXPATHLEN exceeded. Process them first through gl_errfunc() and

12 hours agoInclude fasttrap handling for DATAMODEL_ILP32 when compiling for amd64.
markj [Sat, 30 Jul 2016 03:11:53 +0000 (03:11 +0000)]
Include fasttrap handling for DATAMODEL_ILP32 when compiling for amd64.

MFC after: 1 month

12 hours agolibdtrace: Don't hard-code the native data model.
markj [Sat, 30 Jul 2016 03:09:57 +0000 (03:09 +0000)]
libdtrace: Don't hard-code the native data model.

MFC after: 1 month

12 hours agolibproc: Add proc_getmodel().
markj [Sat, 30 Jul 2016 03:09:23 +0000 (03:09 +0000)]
libproc: Add proc_getmodel().

This is used by libdtrace to determine the data model of target processes.
This allows for the creation of pid provider probes in 32-bit processes on

MFC after: 1 month

12 hours agoAdd descriptions for fields in struct proc_handle.
markj [Sat, 30 Jul 2016 03:07:14 +0000 (03:07 +0000)]
Add descriptions for fields in struct proc_handle.

Remove the unused kq field and some unnecessary includes.

MFC after: 1 month

12 hours agolibrtld_db: Use the auxv to figure out where to look up loader symbols.
markj [Sat, 30 Jul 2016 03:05:23 +0000 (03:05 +0000)]
librtld_db: Use the auxv to figure out where to look up loader symbols.

Previously, librtld_db just hardcoded /libexec/, which isn't
correct for processes that aren't using the native ABI. With this change,
librtld_db can be used to inspect non-native processes; in particular,
dtrace -c now works for 32-bit executables on amd64.

MFC after: 1 month

13 hours agoReset errno for readdirfunc() before contunue.
ache [Sat, 30 Jul 2016 02:09:11 +0000 (02:09 +0000)]
Reset errno for readdirfunc() before contunue.

13 hours agoRemove usage of _WITH_DPRINTF
bapt [Sat, 30 Jul 2016 01:16:06 +0000 (01:16 +0000)]
Remove usage of _WITH_DPRINTF

13 hours agoRemove last traces of _WITH_GETLINE
bapt [Sat, 30 Jul 2016 01:13:54 +0000 (01:13 +0000)]
Remove last traces of _WITH_GETLINE

14 hours agoRemove usage of _WITH_GETLINE from usr.sbin
bapt [Sat, 30 Jul 2016 01:10:05 +0000 (01:10 +0000)]
Remove usage of _WITH_GETLINE from usr.sbin

14 hours agoRemove usage of _WITH_GETLINE from usr.bin
bapt [Sat, 30 Jul 2016 01:07:47 +0000 (01:07 +0000)]
Remove usage of _WITH_GETLINE from usr.bin

14 hours agoindent(1): Yet more style issues.
pfg [Sat, 30 Jul 2016 01:04:18 +0000 (01:04 +0000)]
indent(1): Yet more style issues.

strchr(3) returns a pointer not a boolean.
Attempt to make the style somewhat more ocnsistent with what indent
had before recent changes.

Pointed out by: bde

14 hours agoRemove _WITH_GETLINE and _WITH_DPRINTF guards
bapt [Sat, 30 Jul 2016 01:00:16 +0000 (01:00 +0000)]

When adding getline(3) and dprintf(3) into libc, those guards were added
to prevent breaking too many ports.

7 years later the ports tree have been fixed, it is time to remove this

While here remove the extra parenthesis surrounding dprintf(3)

15 hours agoindent(1): Attempt to preserve some consistent style.
pfg [Fri, 29 Jul 2016 23:30:33 +0000 (23:30 +0000)]
indent(1): Attempt to preserve some consistent style.

Remove the excessive braces from r303485 and align the comments to the
right as done in the rest of the code. This is not nice but there is no
clear way to make it nice (and KNF).

Pointed out by: bde

17 hours agoVarious fixes to the t4/5nex character device.
jhb [Fri, 29 Jul 2016 22:11:29 +0000 (22:11 +0000)]
Various fixes to the t4/5nex character device.

- Remove null open/close methods.
- Don't set d_flags to 0 explicitly.
- Remove t5_cdevsw as the .d_name member isn't really used and doesn't
  warrant a separate cdevsw just for the name.
- Use ENOTTY as the error value for an unknown ioctl request.
- Use make_dev_s() to close race with setting si_drv1.

Sponsored by: Chelsio Communications

17 hours agolibunwind: correct return code in unwinding trace log message
emaste [Fri, 29 Jul 2016 21:37:00 +0000 (21:37 +0000)]
libunwind: correct return code in unwinding trace log message

Obtained from: LLVM r277215
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

17 hours agoFix markup for -j in cpuset(1) synopsis
vangyzen [Fri, 29 Jul 2016 21:18:20 +0000 (21:18 +0000)]
Fix markup for -j in cpuset(1) synopsis

MFC after: 3 days
Sponsored by: Dell Inc.

17 hours agoFix two return types in the cpuset(9) and bitset(9) man pages
vangyzen [Fri, 29 Jul 2016 21:12:48 +0000 (21:12 +0000)]
Fix two return types in the cpuset(9) and bitset(9) man pages

The *_FFS() and *_COUNT() functions return int, not size_t.

MFC after: 3 days
Sponsored by: Dell Inc.

18 hours agolibblacklist: Do not use %m for logging, use strerror(errno)
lidl [Fri, 29 Jul 2016 21:11:32 +0000 (21:11 +0000)]
libblacklist: Do not use %m for logging, use strerror(errno)

The blacklist library can accept a function to use for logging,
defaulting to vsyslog(), if no function is specified.  Make the
blacklist library use strerror(errno) explicitly, instead of %m,
so that the passed in function does not need to support the
syslog specific placeholder.

This matches a change already submitted and accepted upstream.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

18 hours agoUse vm_page_undirty() instead of manually setting a page field.
markj [Fri, 29 Jul 2016 21:05:37 +0000 (21:05 +0000)]
Use vm_page_undirty() instead of manually setting a page field.

Reviewed by: alc
MFC after: 3 days

18 hours agoMake resizewin.1 manpage use .Fx macro
lidl [Fri, 29 Jul 2016 21:05:17 +0000 (21:05 +0000)]
Make resizewin.1 manpage use .Fx macro

Fix capitalization of "PuTTY" also.

MFC after: 1 week

18 hours agoFix NTBT_QP_LINKS negotiation.
mav [Fri, 29 Jul 2016 21:03:30 +0000 (21:03 +0000)]
Fix NTBT_QP_LINKS negotiation.

I believe it never worked correctly for more the one queue even in Linux.
This fixes case when one of consumer drivers is not loaded on one side,
but its queues still announced as ready if something else brought link up.

While there, remove some pointless NULL checks.

18 hours agosdp: Destroy the RDMA ID after destroying the connection's queue pair.
markj [Fri, 29 Jul 2016 21:03:02 +0000 (21:03 +0000)]
sdp: Destroy the RDMA ID after destroying the connection's queue pair.

This is the ordering documented by rdma_destroy_qp(). Also add a useful
KASSERT to sdp_pcbfree().

Sponsored by: EMC / Isilon Storage Division

18 hours agosdp: Use malloc(9) instead of the Linux compat layer.
markj [Fri, 29 Jul 2016 21:01:04 +0000 (21:01 +0000)]
sdp: Use malloc(9) instead of the Linux compat layer.

SDP transmit and receive rings are always created in a sleepable context,
so we can use M_WAITOK and remove error checks.

Sponsored by: EMC / Isilon Storage Division

18 hours agosdp: Use the correct socket buffer in sdp_post_recvs_needed().
markj [Fri, 29 Jul 2016 20:54:43 +0000 (20:54 +0000)]
sdp: Use the correct socket buffer in sdp_post_recvs_needed().

Sponsored by: EMC / Isilon Storage Division

18 hours agoClear scratchpad after MSIX negotiation to not leak garbage.
mav [Fri, 29 Jul 2016 20:52:18 +0000 (20:52 +0000)]
Clear scratchpad after MSIX negotiation to not leak garbage.

18 hours agosdp: Always free received control packets after they're handled.
markj [Fri, 29 Jul 2016 20:51:52 +0000 (20:51 +0000)]
sdp: Always free received control packets after they're handled.

Sponsored by: EMC / Isilon Storage Division

18 hours agoFix the KASSERT format string arguments after r303507.
markj [Fri, 29 Jul 2016 20:48:42 +0000 (20:48 +0000)]
Fix the KASSERT format string arguments after r303507.

18 hours agosdp: Use the PCB as the rx completion handler argument.
markj [Fri, 29 Jul 2016 20:39:32 +0000 (20:39 +0000)]
sdp: Use the PCB as the rx completion handler argument.

The generic socket may be detached from the PCB before the completion
queue is drained and destroyed, so this change closes a race condition
in connection teardown.

Sponsored by: EMC / Isilon Storage Division

18 hours agosdp: Destroy the PCB lock before freeing to the zone.
markj [Fri, 29 Jul 2016 20:36:01 +0000 (20:36 +0000)]
sdp: Destroy the PCB lock before freeing to the zone.

Sponsored by: EMC / Isilon Storage Division

18 hours agosdp: Use an mbufq for received control packets.
markj [Fri, 29 Jul 2016 20:35:04 +0000 (20:35 +0000)]
sdp: Use an mbufq for received control packets.

This is simpler than the hand-rolled queue, and fixes a use-after-free.

Sponsored by: EMC / Isilon Storage Division

18 hours agosdp: Remove Linux build files.
markj [Fri, 29 Jul 2016 20:33:43 +0000 (20:33 +0000)]
sdp: Remove Linux build files.

They aren't useful here, and Linux seems to have largely abandoned SDP

Sponsored by: EMC / Isilon Storage Division

18 hours agoDon't treat NOCPU as a valid CPU to CPU_ISSET.
jhb [Fri, 29 Jul 2016 20:19:14 +0000 (20:19 +0000)]
Don't treat NOCPU as a valid CPU to CPU_ISSET.

If a thread is created bound to a cpuset it might already be bound before
it's very first timeslice, and td_lastcpu will be NOCPU in that case.

MFC after: 1 week

19 hours agoindent(1): Use NULL instead of zero for pointers.
pfg [Fri, 29 Jul 2016 19:36:10 +0000 (19:36 +0000)]
indent(1): Use NULL instead of zero for pointers.

20 hours agoFix locking issues with aio_fsync().
jhb [Fri, 29 Jul 2016 18:26:15 +0000 (18:26 +0000)]
Fix locking issues with aio_fsync().

- Use correct lock in aio_cancel_sync when dequeueing job.
- Add _locked variants of aio_set/clear_cancel_function and use those
  to avoid lock recursion when adding and removing fsync jobs to the
  per-process sync queue.
- While here, add a basic test for aio_fsync().

PR: 211390
Reported by: Randy Westlund <>
MFC after: 1 week
Sponsored by: Chelsio Communications
Differential Revision:

21 hours agoindent(1): Support "f" and "F" floating constant suffixes.
pfg [Fri, 29 Jul 2016 18:00:10 +0000 (18:00 +0000)]
indent(1): Support "f" and "F" floating constant suffixes.

Actually this just brings back r303487 with the correct commit log.

Differential Revision:  (Partial)
Obtained from: Piotr Stefaniak

21 hours agoRevert r303487: Wrong commit log.
pfg [Fri, 29 Jul 2016 17:55:38 +0000 (17:55 +0000)]
Revert r303487: Wrong commit log.

Will be brought back with the correct log.

21 hours agoAdd a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug.
jhb [Fri, 29 Jul 2016 17:54:21 +0000 (17:54 +0000)]
Add a loader tunable (hw.pci.enable_pcie_hp) to disable PCI-e HotPlug.

Some systems and/or devices (such as riser cards) do not include a
non-compliant implementation of PCI-e HotPlug that can result in devices
not being attached (e.g. the HotPlug code might assume that a card is
being unplugged and will power the slot off and detach it).  This
tunable can be set to 0 to disable support for PCI-e HotPlug ignoring
the incorrect HotPlug state on these slots.

PR: 211081
Reported by: Sergey Renkas <> (SuperMicro X7 riser card)
Reported by: Jeffrey E Pieper <>
  (Intel X520 adapter)
MFC after: 1 week
Relnotes: yes

21 hours agoChange the return type of freelocale(3) to void.
ed [Fri, 29 Jul 2016 17:18:47 +0000 (17:18 +0000)]
Change the return type of freelocale(3) to void.

Our version of this function currently returns an integer indicating
failure or success, whereas POSIX specifies that this function has no
return value. It returns void. Patch up the header, sources and man page
to use the right type. While there, use the opportunity to simplify the
body of this function.

Theoretically speaking, this change breaks the ABI of this function.
That said, I have yet to find any code that makes use of freelocale()'s
return value. I couldn't find any of it in the base system, nor did an
exp-run reveal any breakage caused by this change.

PR: 211394 (exp-run)

21 hours agoOnce more refactor KPI between ntb_transport(4) and if_ntb(4)..
mav [Fri, 29 Jul 2016 17:15:41 +0000 (17:15 +0000)]
Once more refactor KPI between ntb_transport(4) and if_ntb(4)..

New design allows to attach multiple consumers to ntb_transport(4) instance.
Previous design obtained from Linux theoretically allowed that, but was not
practically usable (Linux also has only one consumer driver now).

22 hours agoRemove a probe declaration that has been unused since r292469, when
alc [Fri, 29 Jul 2016 16:43:51 +0000 (16:43 +0000)]
Remove a probe declaration that has been unused since r292469, when
vm_pageout_grow_cache() was replaced.

MFC after: 3 days

22 hours agoRevert r291022: x86/intr: allow mutex recursion in intr_remove_handler
royger [Fri, 29 Jul 2016 16:35:58 +0000 (16:35 +0000)]
Revert r291022: x86/intr: allow mutex recursion in intr_remove_handler

This was only needed for Xen, and a better way to deal with this issue has
been found, so this commit can be reverted.

Sponsored by: Citrix Systems R&D
MFC after: 5 days
Reviewed by: kib
Differential revision:

22 hours agoxen-intr: fix removal of event channels during resume
royger [Fri, 29 Jul 2016 16:34:54 +0000 (16:34 +0000)]
xen-intr: fix removal of event channels during resume

Event channel handlers cannot be removed during resume because there might
be an interrupt thread running on a CPU currently blocked in the
cpususpend_handler, which prevents the call to intr_remove_handler from
finishing and completely freezes the system during resume. r291022 tried to
fix this by allowing recursion in intr_remove_handler, but that's clearly
not enough.

Instead don't remove the handlers at the interrupt resume phase, and let
each driver remove the handler by itself during resume. In order to do this,
change the opaque event channel handler cookie to use the global interrupt
vector instead of the event channel port. The event channel port cannot be
used because after resume all event channels are reset, and the port numbers
can change.

Sponsored by: Citrix Systems R&D
MFC after: 5 days

22 hours agoindent(1): Removed whitespace shouldn't be considered in column calculations.
pfg [Fri, 29 Jul 2016 16:34:16 +0000 (16:34 +0000)]
indent(1): Removed whitespace shouldn't be considered in column calculations.

This piece of code removed tabs and space characters from after colons
that follow labels by decrementing the e_lab (end of label) "pointer"
which is later used to calculate the width of the string that fprintf()
puts into "output". But pad_output() gets the length from the actual
string, so it miscalculated what the current column is.

Fixed by putting a string terminator at the e_lab "pointer".

Differential Revision:
Obtained from: Piotr Stefaniak

22 hours agoxen-netfront: fix trying to send packets with disconnected netfront
royger [Fri, 29 Jul 2016 16:33:45 +0000 (16:33 +0000)]
xen-netfront: fix trying to send packets with disconnected netfront

In certain circumstances xn_txq_mq_start might be called with num_queues ==
0 during the resume phase after a migration, which can trigger a KASSERT.
Fix this by making sure the carrier is on before trying to transmit, or else
return that the queues are full.

Just as a note, I haven't been able to reproduce this crash on my test
systems, but I still think it's possible and worth fixing.

Reported by: Karl Pielorz <>
Sponsored by: Citrix Systems R&D
MFC after: 5 days
Reviewed by: Wei Liu <>
Differential revision:

22 hours agoindent(1): fix struct termination detection.
pfg [Fri, 29 Jul 2016 16:28:51 +0000 (16:28 +0000)]
indent(1): fix struct termination detection.

Small style cleanup while here.

Differential Revision: (Partial)
Obtained from: Piotr Stefaniak

22 hours agoMention that basename(3) and dirname(3) will change in the future.
ed [Fri, 29 Jul 2016 16:25:09 +0000 (16:25 +0000)]
Mention that basename(3) and dirname(3) will change in the future.

Update the existing manual pages for basename(3) and dirname(3) to
mention that in future versions of FreeBSD, these functions will no
longer use internal buffers for storing the results.

MFC after: 1 week
Differential Revision:

22 hours agoindent(1): fix struct termination detection.
pfg [Fri, 29 Jul 2016 16:23:00 +0000 (16:23 +0000)]
indent(1): fix struct termination detection.

Semicolons inside struct declarations don't end the declarations.

Differential Revision: (Partial)
Obtained from: Piotr Stefaniak

22 hours agoindent(1): Fix breakage caused by single comment following "else".
pfg [Fri, 29 Jul 2016 16:17:54 +0000 (16:17 +0000)]
indent(1): Fix breakage caused by single comment following "else".

indent(1) simply wasn't taught that "else" may be followed by a comment
without any opening brace anywhere on the line, so it was very confused
in such cases.

Differential Revision: (Partial)
Obtained from: Piotr Stefaniak

22 hours agoindent(1): Avoid potential use-after-free.
pfg [Fri, 29 Jul 2016 16:14:03 +0000 (16:14 +0000)]
indent(1): Avoid potential use-after-free.

last_bl is a char pointer that tracks the last blank character in a
comment, which is used for wrapping long comment lines. Since the
underlying array may be reallocated, make sure last_bl is up to date when
that happens.

Differential Revision: (Partial)
Obtained from: Piotr Stefaniak

23 hours agoindent(1): Avoid out of bound access of array codebuf.
pfg [Fri, 29 Jul 2016 16:09:05 +0000 (16:09 +0000)]
indent(1): Avoid out of bound access of array codebuf.

dump_line() requires s_code to be a string, because it will call count_spaces().

Differential Revision: (Partial)
Obtained from: Piotr Stefaniak

23 hours agoFix typo.
imp [Fri, 29 Jul 2016 15:24:50 +0000 (15:24 +0000)]
Fix typo.

26 hours agoInclude FBT to modules build on RISC-V.
br [Fri, 29 Jul 2016 12:30:33 +0000 (12:30 +0000)]
Include FBT to modules build on RISC-V.

26 hours agoRemove unused variables.
br [Fri, 29 Jul 2016 12:29:17 +0000 (12:29 +0000)]
Remove unused variables.

26 hours agoRemove write-only variable.
trasz [Fri, 29 Jul 2016 12:15:55 +0000 (12:15 +0000)]
Remove write-only variable.

MFC after: 1 month

27 hours agoImprove error message.
trasz [Fri, 29 Jul 2016 11:33:23 +0000 (11:33 +0000)]
Improve error message.

MFC after: 1 month

27 hours agoFix MTP description in the comment.
trasz [Fri, 29 Jul 2016 11:33:01 +0000 (11:33 +0000)]
Fix MTP description in the comment.

MFC after: 1 month

30 hours agoAdd a generic EHCI USB driver based on the Allwinner A10 driver. It is ACPI
andrew [Fri, 29 Jul 2016 08:50:36 +0000 (08:50 +0000)]
Add a generic EHCI USB driver based on the Allwinner A10 driver. It is ACPI
only for now, but wouldn't be too difficult to add support for FDT.

Reviewed by: hselasky
Obtained from: ABT Systems Ltd
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision:

32 hours agohyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default.
sephe [Fri, 29 Jul 2016 06:22:11 +0000 (06:22 +0000)]
hyperv/storvsc: Use busdma(9) and enable PIM_UNMAPPED by default.

The UNMAPPED I/O greatly improves userland direct disk I/O performance
by 35% ~ 135%.

Submitted by: Hongjiang Zhang <honzhan microsoft com>
MFC after: 1 week
Sponsored by: Microsoft
Differential Revision:

33 hours agohyperv/vmbus: Revoke unnecessary exposure of vmbus softc
sephe [Fri, 29 Jul 2016 06:10:27 +0000 (06:10 +0000)]
hyperv/vmbus: Revoke unnecessary exposure of vmbus softc

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision:

33 hours agohyperv/vmbus: Move driver glue to the beginning of the files
sephe [Fri, 29 Jul 2016 05:58:24 +0000 (05:58 +0000)]
hyperv/vmbus: Move driver glue to the beginning of the files

Just as most of other drivers do.  And move sysinit function close
to its SYSINIT.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision:

33 hours agohyperv/vmbus: Forward declare static functions
sephe [Fri, 29 Jul 2016 05:49:12 +0000 (05:49 +0000)]
hyperv/vmbus: Forward declare static functions

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision:

35 hours agohyperv/vmbus: Reindent function declarations.
sephe [Fri, 29 Jul 2016 03:16:51 +0000 (03:16 +0000)]
hyperv/vmbus: Reindent function declarations.

MFC after: 1 week
Sponsored by: Microsoft
Differential Revision:

40 hours agoMove protocol specific stuff into a linker set object that's
imp [Thu, 28 Jul 2016 22:55:21 +0000 (22:55 +0000)]
Move protocol specific stuff into a linker set object that's
per-protocol. This reduces the number scsi symbols references by
cam_xpt significantly, and eliminates all ata / nvme symbols. There's
still some NVME / ATA specific code for dealing with XPT_NVME_IO and
XPT_ATA_IO respectively, and a bunch of scsi-specific code, but this
is progress.

Differential Revision:

40 hours agoSwitch to linker sets to find the xport callback object. This
imp [Thu, 28 Jul 2016 22:55:14 +0000 (22:55 +0000)]
Switch to linker sets to find the xport callback object.  This
eliminates the need to special case everything in cam_xpt for new
transports. It is now a failure to not have a transport object when
registering the bus as well. You can still, however, create a
transport that's unspecified (XPT_)

Differential Revision:

40 hours agoKill a few stray debug printfs.
imp [Thu, 28 Jul 2016 22:40:31 +0000 (22:40 +0000)]
Kill a few stray debug printfs.

40 hours agoRemove any mention of cache (PG_CACHE) pages from the comments in
alc [Thu, 28 Jul 2016 22:30:48 +0000 (22:30 +0000)]
Remove any mention of cache (PG_CACHE) pages from the comments in
vm_pageout_scan().  That function has not cached pages since r284376.

MFC after: 3 days

41 hours agoDon't create pointless backups of generated files in "make sysent".
brooks [Thu, 28 Jul 2016 21:29:04 +0000 (21:29 +0000)]
Don't create pointless backups of generated files in "make sysent".

Any sensible workflow will include a revision control system from which
to restore the old files if required.  In normal usage, developers just
have to clean up the mess.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Differential Revision:

41 hours agocxgbe's firmware module fails to build on mips64 as well as mips32 so
brooks [Thu, 28 Jul 2016 21:27:47 +0000 (21:27 +0000)]
cxgbe's firmware module fails to build on mips64 as well as mips32 so
disable for all mips.

Sponsored by: DARPA, AFRL

42 hours agoNote that not all optional ptrace events use SIGTRAP.
jhb [Thu, 28 Jul 2016 20:51:29 +0000 (20:51 +0000)]
Note that not all optional ptrace events use SIGTRAP.

New child processes attached due to PTRACE_FORK use SIGSTOP instead of
SIGTRAP.  All other ptrace events use SIGTRAP.

43 hours agoCall tcp_notify() directly to shoot down routes, rather than
gallatin [Thu, 28 Jul 2016 19:32:25 +0000 (19:32 +0000)]
Call tcp_notify() directly to shoot down routes, rather than
calling in_pcbnotifyall().

This avoids lock contention on tcbinfo due to in_pcbnotifyall()
holding the tcbinfo write lock while walking all connections.

Reviewed by: rrs, karels
MFC after: 2 weeks
Sponsored by: Netflix, Inc.
Differential Revision:

44 hours agoAdd tblgen to, as it was renamed to llvm-tblgen.
dim [Thu, 28 Jul 2016 18:40:43 +0000 (18:40 +0000)]
Add tblgen to, as it was renamed to llvm-tblgen.

Noticed by: pluknet
MFC after: 3 days

44 hours agoRemove BSD and USL copyright and update license block in in_prot.c, as the
stevek [Thu, 28 Jul 2016 18:39:30 +0000 (18:39 +0000)]
Remove BSD and USL copyright and update license block in in_prot.c, as the
code in this file was written by Robert N. M. Waston.

Move cr_can* prototypes from sys/systm.h to sys/proc.h

Reported by: rwatson
Reviewed by: rwatson
Approved by: sjg (mentor)
Differential Revision:

45 hours agoMark spg_len and fl_pktshift static.
jhb [Thu, 28 Jul 2016 17:37:12 +0000 (17:37 +0000)]
Mark spg_len and fl_pktshift static.

These variables are no longer exported to t4_netmap.c after r296478.

45 hours agoNormalise the CWARNFLAGS inter-word spacing: remove all leading
br [Thu, 28 Jul 2016 17:18:02 +0000 (17:18 +0000)]
Normalise the CWARNFLAGS inter-word spacing: remove all leading
and trailing space, and convert multiple consecutive spaces to
single space.

This helps to keep build output looking good.

46 hours agoindent: avoid calling write(2) with a negative second parameter.
pfg [Thu, 28 Jul 2016 16:54:12 +0000 (16:54 +0000)]
indent: avoid calling write(2) with a negative second parameter.

negative_returns: n is passed to a parameter that cannot be negative.
Fix a style issue while here.

CID: 1008107

46 hours agoFix up prototypes of basename(3) and dirname(3) to comply to POSIX.
ed [Thu, 28 Jul 2016 16:20:27 +0000 (16:20 +0000)]
Fix up prototypes of basename(3) and dirname(3) to comply to POSIX.

POSIX allows these functions to be implemented in a way that the
resulting string is stored in the input buffer. Though some may find
this annoying, this has the advantage that it makes it possible to
implement this function in a thread-safe way. It also means that they
can be implemented in a way that they work for paths of arbitrary
length, as the output string of these functions is never longer than
max(1, len(input)).

Portable code already needs to be written with this in mind, so in my
opinion it makes very little sense to allow the existing behaviour.
Prevent the base system from falling back to this by switching over to
POSIX prototypes.

I'm not going to bump the __FreeBSD_version for this. The reason is that
it's possible to account for this change in a portable way, without
depending on a specific version of FreeBSD. An exp-run was done some
time ago. As far as I know, all regressions as a result of this have
already been fixed.

I'll give this change some time to settle. In the long run I want to
replace our copies by ones that are thread-safe and don't depend on

47 hours agoPull a copy of the input string before calling basename() and dirname().
ed [Thu, 28 Jul 2016 16:06:37 +0000 (16:06 +0000)]
Pull a copy of the input string before calling basename() and dirname().

POSIX allows implementations of these functions to modify their input.

47 hours agoClean up use of basename() and dirname().
ed [Thu, 28 Jul 2016 16:02:30 +0000 (16:02 +0000)]
Clean up use of basename() and dirname().

Pull copies of the input pathname string before calling basename() and
dirname() to make this comply to POSIX. Free these copies at the end of
this function. While there, remove the duplication of the 's' ->
'logfname' string. There is no need for this.

47 hours agoDo not delegate a work to geom event thread which can be done inline.
kib [Thu, 28 Jul 2016 15:57:01 +0000 (15:57 +0000)]
Do not delegate a work to geom event thread which can be done inline.

In particular, swapongeom_ev() needed event thread context when swap
pager configuration was performed under Giant and geom asserted that
Giant is not owned.  Now both of the reason went away.

On the other hand, note that swpageom_release() is called from the
bio_done context, and possible close cannot be performed inline.

Also fix some minor issues.  The swapgeom() function does not use the
td argument, remove it.  Recheck that the vnode passed is still VCHR
and not reclaimed after the lock.

Reviewed by: mav
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

47 hours agoFix style and typo.
kib [Thu, 28 Jul 2016 15:49:51 +0000 (15:49 +0000)]
Fix style and typo.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

47 hours agoCall basename() and dirname() in the POSIXly correct way.
ed [Thu, 28 Jul 2016 15:33:19 +0000 (15:33 +0000)]
Call basename() and dirname() in the POSIXly correct way.

Pull copies of the input string, as these functions are allowed to
modify them. Free the copies after creating the new pathname string.

47 hours agoCall basename() in a portable way.
ed [Thu, 28 Jul 2016 15:19:47 +0000 (15:19 +0000)]
Call basename() in a portable way.

Pull a copy of the filename string before calling basename(). Change the
loop to not return on its own, so we can put a free() statement at the

47 hours agoDon't call basename() and dirname() in an unportable way.
ed [Thu, 28 Jul 2016 15:17:12 +0000 (15:17 +0000)]
Don't call basename() and dirname() in an unportable way.

POSIX allows these functions to modify their input buffer, so that they
have storage for the return value. Pull copies of the filename before
calling these utility functions.

2 days agoremove CONSTRUCTORS from kernel linker scripts
emaste [Thu, 28 Jul 2016 13:54:46 +0000 (13:54 +0000)]
remove CONSTRUCTORS from kernel linker scripts

The linker script CONSTRUCTORS keyword is only meaningful "when linking
object file formats which do not support arbitrary sections, such as
ECOFF and XCOFF"[1] and is ignored for other object file formats.

LLVM's lld does not yet accept (and ignore) CONSTRUCTORS, so just remove
CONSTRUCTORS from the linker scripts as it has no effect.


Reviewed by: kib
Sponsored by: The FreeBSD Foundation
Differential Revision:

2 days agoRegenerate src.conf.5 after r303394
emaste [Thu, 28 Jul 2016 13:35:46 +0000 (13:35 +0000)]
Regenerate src.conf.5 after r303394

2 days agoBuild ofw_bus_if.h for modules for RISC-V.
br [Thu, 28 Jul 2016 13:21:45 +0000 (13:21 +0000)]
Build ofw_bus_if.h for modules for RISC-V.

2 days agoBuild DTrace assym.o with -msoft-float flag for RISC-V so we have
br [Thu, 28 Jul 2016 13:18:10 +0000 (13:18 +0000)]
Build DTrace assym.o with -msoft-float flag for RISC-V so we have
correct flag in ELF file.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

2 days agoo Add warn flags required to build modules with GCC 6.1;
br [Thu, 28 Jul 2016 13:15:23 +0000 (13:15 +0000)]
o Add warn flags required to build modules with GCC 6.1;
o Sort GCC 4.8 warn flags.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5