]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
7 years agoMFC r314924:
ngie [Thu, 16 Mar 2017 01:59:41 +0000 (01:59 +0000)]
MFC r314924:

sbin/devfs: clarify usage

- Note existence of -m option.
- Note that -s applies to rule keyword, only, by adding usage text
  specifically for the `rule` and `ruleset` keywords.

Don't go into any further detail in usage(..) -- it's best that one
reads the manpage to get a better idea of how things work as there are
a number of different option-specific keywords and arguments, as well
as some rule grammar.

7 years agoMFC r315111:
ngie [Thu, 16 Mar 2017 01:58:06 +0000 (01:58 +0000)]
MFC r315111:

Remove /rescue/iscsictl and /rescue/iscsid if MK_ISCSI == no

7 years agoMFC r315114:
ngie [Thu, 16 Mar 2017 01:54:56 +0000 (01:54 +0000)]
MFC r315114:

Remove /rescue/zdb if MK_ZFS == no

Missed in r202452.

7 years agoMFC r314831:
ngie [Thu, 16 Mar 2017 01:53:21 +0000 (01:53 +0000)]
MFC r314831:

Don't rely on dependency in Makefile.inc1 for strfile; make datfiles depend on strfile

In most cases strfile is built as part of build-tools, but in the event that someone
cd'ed to the directory, tried to build from scratch, and had MK_GAMES=no previously,
the build would fail in .../datfiles , trying to find strfile .

Mark this directory tree "SUBDIR_PARALLEL" safe to help facilitate this, instead of
shuffling around the SUBDIR entries (all of the other Makefiles will build standalone).

7 years agoMFC r314895:
ngie [Thu, 16 Mar 2017 01:48:08 +0000 (01:48 +0000)]
MFC r314895:

Only install 900.tcpwrap if MK_INETD != "no" and MK_TCP_WRAPPERS != "no"

It relies on output from inetd that is triggered by MK_TCP_WRAPPERS=yes.

We need to check for both knobs being set -- otherwise the script doesn't
have much value.

PR: 217577

7 years agoMFC r314830:
ngie [Thu, 16 Mar 2017 01:38:07 +0000 (01:38 +0000)]
MFC r314830:

mergemaster: fix description of -p

-p only handles updating /etc/master.passwd and /etc/group . No more,
no less.

Also, mergemaster (and no other portions of the vanilla FreeBSD build
process) should be messing with __MAKECONF or SRCCONF as part of the
installworld or distribution process. Don't insinuate that mergemaster
does that as it's a false claim.

7 years agoMFC r314869,r314871,r314872:
ngie [Thu, 16 Mar 2017 01:36:09 +0000 (01:36 +0000)]
MFC r314869,r314871,r314872:

r314869:

Alphabetically sort variables

The only content change is minor rewording around CLEANDIRS/CLEANFILES to
accomodate sorting order.

r314871:

Fix LINKS example in bsd.prog.mk

LINKS appends DESTDIR -- don't suggest double-append in example.

r314872:

Add bsd.man.mk references for MAN under bsd.lib.mk and bsd.prog.mk

The latter set of manpages directly consume bsd.man.mk, so the bsd.man.mk
behavior should be the source of truth for underlying behavior, whereas
the other manpage fragment descriptions should document how they tweak
the variable behavior, if at all (bsd.prog.mk does tweak the default
value, as noted in its description)

7 years agoMFC r311172,r311194,r311226,r312389,r312390:
mjg [Thu, 16 Mar 2017 01:32:56 +0000 (01:32 +0000)]
MFC r311172,r311194,r311226,r312389,r312390:

mtx: reduce lock accesses

Instead of spuriously re-reading the lock value, read it once.

This change also has a side effect of fixing a performance bug:
on failed _mtx_obtain_lock, it was possible that re-read would find
the lock is unowned, but in this case the primitive would make a trip
through turnstile code.

This is diff reduction to a variant which uses atomic_fcmpset.

==

Reduce lock accesses in thread lock similarly to r311172

==

mtx: plug open-coded mtx_lock access missed in r311172

==

rwlock: reduce lock accesses similarly to r311172

==

sx: reduce lock accesses similarly to r311172

7 years agoMFC r305671:
mjg [Thu, 16 Mar 2017 01:04:30 +0000 (01:04 +0000)]
MFC r305671:

locks: add backoff for spin mutexes and thread lock

7 years agoMFC r312890,r313386,r313390:
mjg [Thu, 16 Mar 2017 00:51:24 +0000 (00:51 +0000)]
MFC r312890,r313386,r313390:

Sprinkle __read_mostly on backoff and lock profiling code.

==

locks: change backoff to exponential

Previous implementation would use a random factor to spread readers and
reduce chances of starvation. This visibly reduces effectiveness of the
mechanism.

Switch to the more traditional exponential variant. Try to limit starvation
by imposing an upper limit of spins after which spinning is half of what
other threads get. Note the mechanism is turned off by default.

==

locks: follow up r313386

Unfinished diff was committed by accident. The loop in lock_delay
was changed to decrement, but the loop iterator was still incrementing.

7 years agoMFC r308700:
mizhka [Wed, 15 Mar 2017 21:03:51 +0000 (21:03 +0000)]
MFC r308700:

[etherswitch] add RTL8366SR support

Add RTL8366SR support at etherswitch driver. Tested on RTL8366RB and
RTL8366SR.

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: adrian, mizhka
Approved by: adrian(mentor)
Differential Revision: https://reviews.freebsd.org/D6796

7 years agoMFC r310017-r310018
mizhka [Wed, 15 Mar 2017 21:01:03 +0000 (21:01 +0000)]
MFC r310017-r310018

r310017:
[spi] reformat message and ar5315_spi minor fix

This commit corrects print of nomatch (newline was too early) and fix
unit number for new child in ar5315_spi (was 0, now is -1 to calculate it
according to actual system state)

Submitted by: Hiroki Mori <yamori813@yahoo.co.jp>
Reviewed by: ray, loos, mizhka
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8749

r310018:
[gpiospi] add clock delay to avoid smashing of bits

Submitted by: Hiroki Mori <yamori83@yahoo.co.jp>
Reviewed by: loos, ray, mizhka
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D8749

7 years agoMFC r310232:
dim [Wed, 15 Mar 2017 19:50:58 +0000 (19:50 +0000)]
MFC r310232:

After r310171, the kernel version of sscanf() has format string checking
enabled.  This results in a -Werror warning in mlx4ib:

    sys/dev/mlx4/mlx4_ib/mlx4_ib_sysfs.c:90:22: error: format specifies type 'unsigned long long *' but the argument has type 'u64 *' (aka 'unsigned long *') [-Werror,-Wformat]
            sscanf(buf, "%llx", &sysadmin_ag_val);
                         ~~~~   ^~~~~~~~~~~~~~~~

Change sysadmin_ag_val to unsigned long long to avoid the warning.

Reviewed by: hselasky
Differential Revision: https://reviews.freebsd.org/D8831

7 years agoMFC r314643:
dchagin [Wed, 15 Mar 2017 17:16:43 +0000 (17:16 +0000)]
MFC r314643:

Hide Linux socketcall constants under corresponding #ifdef since
they are used only in i386 Linuxulator.

7 years agoMFC r314132:
dchagin [Wed, 15 Mar 2017 17:14:05 +0000 (17:14 +0000)]
MFC r314132:

Right clock defines specified in linux_timer.h.
Get rid of spirious clock defines from linux_misc.h.

7 years agoMFC r313940:
dchagin [Wed, 15 Mar 2017 17:11:01 +0000 (17:11 +0000)]
MFC r313940:

Implement rt_tgsigqueueinfo system call used by glibc for pthread_sigqueue(3).

7 years agoMFC r313913:
dchagin [Wed, 15 Mar 2017 17:06:04 +0000 (17:06 +0000)]
MFC r313913:

Initialize cap_rights before use.

MFC r313914:

Style(9), some XXX comments fix. No functional changes.

7 years agoMFC r305093 (by mjg@):
dchagin [Wed, 15 Mar 2017 16:38:39 +0000 (16:38 +0000)]
MFC r305093 (by mjg@):

fd: add fdeget_locked and use in kern_descrip

MFC r305756 (by oshogbo@):

fd: add fget_cap and fget_cap_locked primitives.
They can be used to obtain capabilities along with a referenced fp.

MFC r306174 (by oshogbo@):

capsicum: propagate rights on accept(2)

Descriptor returned by accept(2) should inherits capabilities rights from
the listening socket.

PR:           201052

MFC r306184 (by oshogbo@):

fd: simplify fgetvp_rights by using fget_cap_locked.

MFC r306225 (by mjg@):

fd: fix up fgetvp_rights after r306184

fget_cap_locked returns a referenced file, but the fgetvp_rights does
not need it. Instead, due to the filedesc lock being held, it can
ref the vnode after the file was looked up.

Fix up fget_cap_locked to be consistent with other _locked helpers and not
ref the file.

This plugs a leak introduced in r306184.

MFC r306232 (by oshogbo@):

fd: fix up fget_cap

If the kernel is not compiled with the CAPABILITIES kernel options
fget_unlocked doesn't return the sequence number so fd_modify will
always report modification, in that case we got infinity loop.

MFC r311474 (by glebius@):

Use getsock_cap() instead of fgetsock().

MFC r312079 (by glebius@):

Use getsock_cap() instead of deprecated fgetsock().

MFC r312081 (by glebius@):

Use getsock_cap() instead of deprecated fgetsock().

MFC r312087 (by glebius@):

Remove deprecated fgetsock() and fputsock().

Bump __FreeBSD_version as getsock_cap changed and
fgetsock/fputsock pair removed.

7 years agoMFC r315095, r315096, r315097, r315187:
pfg [Wed, 15 Mar 2017 15:33:32 +0000 (15:33 +0000)]
MFC r315095, r315096, r315097, r315187:
libc: small cleanups.

Rename nitems to numitems: it shares the anme with an existing macro in
sys/params.h. Also initialize the value later which avoids asigning the
value if we exit early.

Unsign setlen: it is local and will never be negative. Having one more bit
for growth is beneficial and it avoids a cast when it's going to be used
for allocation.

Remove unused initialization: "num" is properly defined before use.

Let calloc(3) do the multiplication.

7 years agoMFC r314489:
kib [Wed, 15 Mar 2017 10:53:40 +0000 (10:53 +0000)]
MFC r314489:
With the removal of IA64, the only arch which uses ia32 compat is amd64.

7 years agoMFC r307688:
kib [Wed, 15 Mar 2017 10:51:00 +0000 (10:51 +0000)]
MFC r307688:
With the removal of IA64, the only arch which uses ia32 compat is amd64.

7 years agoMFC r312724,r312901,r312902:
mjg [Tue, 14 Mar 2017 20:43:04 +0000 (20:43 +0000)]
MFC r312724,r312901,r312902:

hwpmc: partially depessimize munmap handling if the module is not loaded

HWPMC_HOOKS is enabled in GENERIC and triggers some work avoidable in the
common (module not loaded) case.

In particular this avoids permission checks + lock downgrade
singlethreaded and in cases were an executable mapping is found the pmc
sx lock is no longer bounced.

Note this is a band aid.

==

hwpmc: partially depessimize mmap handling if the module is not loaded

In particular this means the pmc sx lock is no longer taken when an
executable mapping succeeds.

==

hwpmc: annotate pmc_hook and pmc_intr as __read_mostly

7 years agoMFC r312888:
mjg [Tue, 14 Mar 2017 20:39:06 +0000 (20:39 +0000)]
MFC r312888:

Introduce __read_mostly and __exclusive_cache_line macros.

The intended use is to annotate frequently used globals which either rarely
change (and thus can be grouped in the same cacheline) or are an atomic counter
(which means it may benefit from being the only variable in the cacheline).

Linker script support is provided only for amd64. Architectures without it risk
having other variables put in, i.e. as if they were not annotated. This is
harmless from correctness point of view.

7 years agoMFC r312934:
pfg [Tue, 14 Mar 2017 20:14:57 +0000 (20:14 +0000)]
MFC r312934:
Make use of clang nullability attributes in C headers.

Replace uses of the GCC __nonnull__ attribute with the clang nullability
qualifiers. These are starting to get use in clang's static analyzer.

Replacement should be transparent for developers using clang. GCC ports
from older FreeBSD versions may need updating if the compiler was built
before r312860 (Jan-27-2017).

Hinted by: Apple's Libc-1158.20.4, Bionic libc

Relnotes: yes

7 years agoDirect commit to stable/11, a followup to fix r314591 on pc98.
kib [Tue, 14 Mar 2017 17:56:36 +0000 (17:56 +0000)]
Direct commit to stable/11, a followup to fix r314591 on pc98.

Reported by: rpokala
Sponsored by: The FreeBSD Foundation

7 years agoMFC r314179 r314206 r314424
vangyzen [Tue, 14 Mar 2017 17:52:43 +0000 (17:52 +0000)]
MFC r314179 r314206 r314424

Add sem_clockwait_np()

This function allows the caller to specify the reference clock
and choose between absolute and relative mode.  In relative mode,
the remaining time can be returned.

The API is similar to clock_nanosleep(3).  Thanks to Ed Schouten
for that suggestion.

While I'm here, reduce the sleep time in the semaphore "child"
test to greatly reduce its runtime.  Also add a reasonable timeout.

Relnotes: yes
Sponsored by: Dell EMC

7 years agoMFC r314553:
hselasky [Tue, 14 Mar 2017 15:59:51 +0000 (15:59 +0000)]
MFC r314553:

Implement taskqueue_poll_is_busy() for use by the LinuxKPI.
Refer to comment above function for a detailed description.

Discussed with: kib @
Sponsored by: Mellanox Technologies

7 years agoMFC r314328:
hselasky [Tue, 14 Mar 2017 15:55:17 +0000 (15:55 +0000)]
MFC r314328:

Fix startup race initialising ACPI CM battery structures on MacBookPro.

During acpi_cmbat_attach() the acpi_cmbat_init_battery() notification
handler is registered. It has been observed this notification handler
can be called instantly, before the attach routine has returned. In
the notification handler there is a call to device_is_attached() which
returns false. Because the softc is set we know an attach is in
progress and the fix is simply to wait and try again in this case.

Reviewed by: avg @

7 years agoMFC r313941:
hselasky [Tue, 14 Mar 2017 15:49:28 +0000 (15:49 +0000)]
MFC r313941:

Make sure the thread constructor and destructor eventhandlers are
called for all threads belonging to a procedure. Currently the first
thread in a procedure is kept around as an optimisation step and is
never freed. Because the first thread in a procedure is never freed
nor allocated, its destructor and constructor callbacks are never
called which means per thread structures allocated by dtrace and the
Linux emulation layers for example, might be present for threads which
don't need these structures.

This patch adds a thread construction and destruction call for the
first thread in a procedure.

Tested: dtrace, linux emulation
Reviewed by: kib @
Sponsored by: Mellanox Technologies

7 years agoMFC r313778:
hselasky [Tue, 14 Mar 2017 15:42:27 +0000 (15:42 +0000)]
MFC r313778:

Improve code readability and fix compilation error when using clang 4.x.

Found by: emaste @
Sponsored by: Mellanox Technologies

7 years agoMFC r312551:
hselasky [Tue, 14 Mar 2017 15:35:40 +0000 (15:35 +0000)]
MFC r312551:

Fix for race leading to endless timer interrupts related to
configtimer().

During normal operation "state->nextcallopt" will always be less than
or equal to "state->nextcall" and checking only "state->nextcallopt"
before calling "callout_process()" is sufficient. However when
"configtimer()" is called a race might happen requiring both of these
binary times to be checked.

Short description of race:

1) A configtimer() call will reset both "state->nextcall" and
"state->nextcallopt" to the same binary time.

2) If a "callout_reset()" call happens between "configtimer()" and the
next "callout_process()" call, "state->nextcallopt" will get updated
and "state->nextcall" will remain at the current time. Refer to logic
inside cpu_new_callout().

3) getnextcpuevent() only respects "state->nextcall" and returns this
value over and over again, even if it is in the past, until "now >=
state->nextcallopt" becomes true. Then these two time variables are
corrected by a "callout_process()" call and the situation goes back to
normal.

The problem manifests itself in different ways. The common factor is
the timer process(es) consume all CPU on one or more CPU cores for a
long time, blocking other kernel processes from getting execution
time. This can be seen by very high interrupt counts as displayed by
"vmstat -i | grep timer" right after boot.

When EARLY_AP_STARTUP was enabled in r310177 the likelyhood of hitting
this bug apparently increased.

Example output from "vmstat -i" before patch:
cpu0:timer                          7591         69
cpu9:timer                      39031773     358089
cpu4:timer                          9359         85
cpu3:timer                          9100         83
cpu2:timer                          9620         88

Example output from "vmstat -i" after patch:
cpu0:timer                          4242         34
cpu6:timer                          5531         44
cpu3:timer                          6450         52
cpu1:timer                          4545         36
cpu9:timer                          7153         58

Before the patch cpu9 in the example above, was spinning in a loop in
order to reach 39 million interrupts just a few seconds after
bootup. After the patch the timer interrupt counts are more or less
consistent.

Discussed with: mav @
Reported by: several people
Sponsored by: Mellanox Technologies

7 years agoMFC r312424:
hselasky [Tue, 14 Mar 2017 15:27:38 +0000 (15:27 +0000)]
MFC r312424:

Fix problem with suspend and resume when using Skylake chipsets. Make
sure the XHCI controller is reset after halting it. The problem is
clearly a BIOS bug as the suspend and resume is failing without
loading the XHCI driver. The same happens when using Linux and the
XHCI driver is not loaded.

Submitted by: Yanko Yankulov <yanko.yankulov@gmail.com>
PR: 216261

7 years agoMFC r312338:
hselasky [Tue, 14 Mar 2017 15:19:14 +0000 (15:19 +0000)]
MFC r312338:

Add USB audio support for S/PDIF output with C-Media CM6206 devices.

Submitted by: Julien Nadeau <vedge@hypertriton.com>
PR: 216131

7 years agoMFC r310806:
hselasky [Tue, 14 Mar 2017 15:12:58 +0000 (15:12 +0000)]
MFC r310806:

Add MSIX rewrite table quirk for use with VMs.

This patch solves IRQ generation problems using the mlx5en(4) driver
with xenserver v6.5.0 in SRIOV and PCI-passthrough modes.

Until further the hw.pci.msix_rewrite_table quirk must be set manually
in /boot/loader.conf .

Reviewed by: jhb @
Sponsored by:           Mellanox Technologies

7 years agoMFC r314851:
kib [Tue, 14 Mar 2017 10:09:50 +0000 (10:09 +0000)]
MFC r314851:
When selecting brand based on old Elf branding, prefer the brand which
interpreter exactly matches the one requested by the activated image.

7 years agoMFC r314850:
kib [Tue, 14 Mar 2017 10:08:12 +0000 (10:08 +0000)]
MFC r314850:
Require whole brand string matching for old Elf branding.

7 years agoMFC r314849:
kib [Tue, 14 Mar 2017 10:06:20 +0000 (10:06 +0000)]
MFC r314849:
Consistently use vm_ooffset_t type for the vm object offset in
elf_load_section.

7 years agoMFC r314375: Remove some locking not needed for modern CAM.
mav [Tue, 14 Mar 2017 07:06:05 +0000 (07:06 +0000)]
MFC r314375: Remove some locking not needed for modern CAM.

This driver is full of LORs.  This change allows to reduce deadlock chance
from 100% to level that allows some tests to be done.

7 years agoMFC r315225:
delphij [Tue, 14 Mar 2017 06:10:40 +0000 (06:10 +0000)]
MFC r315225:

Discard first 3072 bytes of RC4 keystream, this is a bandaid
that allows us to work on switching to a more modern PRNG.

Submitted by: Steven Chamberlain <steven pyro eu org>
Approved by: so

7 years agoMFC r314974, r315006:
pfg [Tue, 14 Mar 2017 02:13:59 +0000 (02:13 +0000)]
MFC r314974, r315006:
localedef(1): Fix small coverity issues.

- Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
- Buffer not null terminated (BUFFER_SIZE_WARNING)

CID: 13385571338565

Obtained from: illumos

7 years agoMFC r313982, r314068:
pfg [Tue, 14 Mar 2017 02:06:03 +0000 (02:06 +0000)]
MFC r313982, r314068:
sys: Replace zero with NULL for pointers.

Found with: devel/coccinelle

7 years agoMFC r314995:
jlh [Mon, 13 Mar 2017 22:45:51 +0000 (22:45 +0000)]
MFC r314995:
Add a very natural, binary version of the ASCII table.

Reviewed by:  bcr, eadler
Obtained from:    https://garbagecollected.org/2017/01/31/four-column-ascii/
Differential Revision:    https://reviews.freebsd.org/D9902

7 years agoMFC r315018:
markj [Mon, 13 Mar 2017 19:12:18 +0000 (19:12 +0000)]
MFC r315018:
Typo.

7 years agoSwitch from the usage of vm_map_find()/vm_map_insert() to vm_map_fixed().
kib [Mon, 13 Mar 2017 10:49:36 +0000 (10:49 +0000)]
Switch from the usage of vm_map_find()/vm_map_insert() to vm_map_fixed().

MFC r314487:
Use vm_map_insert() instead of vm_map_find() in elf_map_insert().

MFC r314773:
Instead of direct use of vm_map_insert(), call vm_map_fixed(MAP_CHECK_EXCL).

7 years agoMFC r314486:
kib [Mon, 13 Mar 2017 10:41:47 +0000 (10:41 +0000)]
MFC r314486:
When deallocating the vm object in elf_map_insert() due to
vm_map_insert() failure, drop the vnode lock around the call to
vm_object_deallocate().

7 years agoMFC r314715:
ae [Mon, 13 Mar 2017 08:04:25 +0000 (08:04 +0000)]
MFC r314715:
  Reject invalid object types that can not be used with specific opcodes.

  When we doing reference counting of named objects in the new rule,
  for existing objects check that opcode references to correct object,
  otherwise return EINVAL.

  PR: 217391

7 years agoMFC r314786: Import mpr(4) driver P12 to P14 diff from vendor site.
mav [Mon, 13 Mar 2017 06:51:50 +0000 (06:51 +0000)]
MFC r314786: Import mpr(4) driver P12 to P14 diff from vendor site.

This is mostly a version bump to stay in version number sync with firmware.
The only change there was cosmetic:  Display degraded speed message upon
receiving Active Cable Exception Event with DEGRADED reason code.

7 years agoMFC r314807:
ngie [Mon, 13 Mar 2017 01:34:40 +0000 (01:34 +0000)]
MFC r314807:

Move ATF_TC_WITHOUT_HEAD(getgrent) near the testcase it annotates

7 years agoMFC r314793,r314796,r314797,r314798,r314799,r314800,r314801,r314802,r314803,r314804...
ngie [Mon, 13 Mar 2017 01:17:33 +0000 (01:17 +0000)]
MFC r314793,r314796,r314797,r314798,r314799,r314800,r314801,r314802,r314803,r314804,r314805:

r314793:

Fix ATF_TP_ADD_TCS example in atf-c-api(3)

ATF_TP_ADD_TC should use `tp` as the second argument, not `tcs`, as
ATF_TP_ADD_TCS uses `tp` as its first argument.

Bump .Dd for the change.

r314796:

Fix atf-sh(3) manpage issues

- Fix spelling errors (specifiying -> specifying) [1]
- Escape '.' at start of lines using & to tell the roff processor
  that the line isn't meant to be treated as a command [2].

Bump .Dd for the change

r314797:

Fix grammar warning noted by igor

Remove surrounding ellipses in e.g. section and add a comma before and after
the e.g. reference.

r314798:

Fix out-of-order sections in atf-sh(1)

- `.Op` must be used in the SYNOPSIS section, not the NAME section.
- Move ATF_SHELL environment variable description up to first
  ENVIRONMENT section. Garbage collect the duplicate ENVIRONMENT
  section.

Bump .Dd for the change

r314799:

Fix manlint issues with atf-check(1)

- Use `.Bf Em`/`.Ef` instead of prefixing lines with `.Em`. The forms
  are equivalent with traditional roff, but unnecessarily verbose. The
  former form applies the .Em macro to the enclosed block.
- Move EXIT_STATUS section down so the section complies with section
  ordering specified by mdoc(7) and enforced by manlint(1).

Bump .Dd for the change

r314800:

Fix issues with atf-check(1) found by igor and refer to atf-check(1)

- Fix typo (specifiying -> specifying)
- Add atf-check(1) to SEE ALSO section for completeness. It's mentioned
  above, but by convention the SEE ALSO section should list all relevant
  references to other tools and APIs.

Bump .Dd for the change

r314801:

Fix igor/manlint issues with atf-c(3)

- Remove surrounding ellipses in i.e. section and add a comma before
  and after the i.e. reference [1].
- Fix typo (specifiying -> specifying) [1].
- Escape '.' at start of lines using & to tell the roff processor
  that the line isn't meant to be treated as a command [2].

Bump .Dd for the change

r314802:

Fix atf-c-api(3) manpage issues

- Fix typo (specifiying -> specifying).
- Remove surrounding ellipses in i.e. section and add a comma before
  and after the i.e. reference.

Bump .Dd for the change

r314803:

Fix typos

- specifiying -> specifying
- manged -> managed

Bump .Dd for the change

r314804:

Fix issues noted by igor/manlint

- Fix typos [1]:
-- manged -> managed
-- specifiying -> specifying
- Escape '.' at start of lines using & to tell the roff processor
  that the line isn't meant to be treated as a command [2].

Bump .Dd for the change

r314805:

Remove *-api(3) manpages removed in ATF 0.21

I overlooked the fact that these manpages had been removed upstream
and replaced with their non *-api(3) equivalents. Follow upstream's
lead and remove the unused manpages.

7 years agoMFC r314686: sh: Fix crash if a -T trap is taken during command substitution
jilles [Sun, 12 Mar 2017 18:38:03 +0000 (18:38 +0000)]
MFC r314686: sh: Fix crash if a -T trap is taken during command substitution

Code like  t=$(stat -f %m "$file")  segfaulted if -T was active and a trap
was taken while the shell was waiting for the child process to finish.

What happened was that the dotrap() call in waitforjob() was hit. This
re-entered command execution (including expand.c) at a point not expected by
expbackq(), and global state (unallocated stack string and argbackq) was
corrupted.

To fix this, change expbackq() to prepare for command execution to be
re-entered.

Reported by: bdrewery

7 years agoMFC r314637: sh: Add some already working tests that exercise new code paths
jilles [Sun, 12 Mar 2017 18:24:45 +0000 (18:24 +0000)]
MFC r314637: sh: Add some already working tests that exercise new code paths

7 years agoMFH (r314598): load default options before requesting ticket
des [Sun, 12 Mar 2017 13:22:35 +0000 (13:22 +0000)]
MFH (r314598): load default options before requesting ticket

PR: 213909

7 years agoMFH (r314554): fix date in previous commit
des [Sun, 12 Mar 2017 13:18:48 +0000 (13:18 +0000)]
MFH (r314554): fix date in previous commit

7 years agoMFH (r314528): update to reflect the state of SHA-1
des [Sun, 12 Mar 2017 13:14:49 +0000 (13:14 +0000)]
MFH (r314528): update to reflect the state of SHA-1

7 years agoMFC r314960:
kib [Sun, 12 Mar 2017 12:11:11 +0000 (12:11 +0000)]
MFC r314960:
Fix typo in comment.

7 years agoMFC r314308: Fix LUN enabling on wildcard target, as done by CTL.
mav [Sun, 12 Mar 2017 06:19:58 +0000 (06:19 +0000)]
MFC r314308: Fix LUN enabling on wildcard target, as done by CTL.

7 years agoMFC r314307: Add support for SIMs without autosense.
mav [Sun, 12 Mar 2017 06:18:08 +0000 (06:18 +0000)]
MFC r314307: Add support for SIMs without autosense.

If we asked to send sense data by setting CAM_SEND_SENSE, but SIM didn't
confirm transmission by setting CAM_SENT_SENSE, assume it was not sent.
Queue the I/O back to CTL for later REQUEST SENSE with ctl_queue_sense().
This is needed for error reporting on SPI HBAs like ahc(4)/ahd(4).

7 years agoMFC r314321:
pfg [Sun, 12 Mar 2017 05:35:28 +0000 (05:35 +0000)]
MFC r314321:
dc(1): Merge minor changes from OpenBSD.

Prefer setvbuf() to setlinebuf() for portability.
Some style(9) and redundant tests for NULL.

These are only meant to ease up merging newer changes.

Obtained from: OpenBSD

7 years agoMFC r314542:
ngie [Sun, 12 Mar 2017 04:59:02 +0000 (04:59 +0000)]
MFC r314542:

kern.cam.da.X.delete_method: add -width to .Bl macro call

Now the section width is set appropriately per the BIO_DELETE
parameter being described.

7 years agoMFC r314545:
ngie [Sun, 12 Mar 2017 04:57:35 +0000 (04:57 +0000)]
MFC r314545:

Add missing section to .Xr macro calls for wpifw(4)

The driver manpage for wpifw(4) is missing, but will be added soon. This
fixes the other 2 .Xr calls lacking sections to match the 3rd,
syntactically correct, reference in the SEE ALSO section.

7 years agoMFC r314610:
ngie [Sun, 12 Mar 2017 04:56:21 +0000 (04:56 +0000)]
MFC r314610:

Clean up ddb(4) slightly

- Delete empty Li macro uses [1]. This removes some spaces between
  the optional command/subcommand arguments.
- Attempt to clarify "show lock" subcommand by being more
  terse/direct. This addresses an issue with a contraction [2].

7 years agoMFC r314233:
ngie [Sun, 12 Mar 2017 04:55:06 +0000 (04:55 +0000)]
MFC r314233:

Parameterize out the length of struct filed->f_lasttime as `MAXDATELEN`

This removes the hardcoded value for the field (16) and the equivalent
hardcoded lengths in logmsg(..).

This change is being done to help stage future work to add RFC5424/RFC5434
support to syslogd(8).

Obtained from: Isilon OneFS (dcd33d13da) (as part of a larger change)

7 years agoMFC r314189,r314190,r314191:
ngie [Sun, 12 Mar 2017 04:53:48 +0000 (04:53 +0000)]
MFC r314189,r314190,r314191:

r314189:

Fix up NULL/'\0' uses and fix 2 derefs after NULL

CID: 10188981018899

r314190:

Fix some minor style nits: put parentheses around return values

r314191:

Fix up r314189

The conditional in do_buff_decode(..) after the while loop was accidentally
inverted. Only increment the pointer for fmt if it's not NUL.

7 years agoMFC r314650:
ngie [Sun, 12 Mar 2017 04:52:09 +0000 (04:52 +0000)]
MFC r314650:

Fix warnings in lib/msun/tests/... to help pave way for WARNS?= 6.

- Staticize variables.
- Use nitems liberally. Wherever nitems is used, use unsigned integers
- Remove unused variables (argc, argv, etc)

This fixes most issues -- some issues remain in logarithm_test though.

7 years agoMFC r314644:
ngie [Sun, 12 Mar 2017 04:41:38 +0000 (04:41 +0000)]
MFC r314644:

Fix "make depend" with geom_uzip.ko: add opt_geom.h to SRCS

7 years agoMFC r305283,r314649:
ngie [Sun, 12 Mar 2017 04:40:01 +0000 (04:40 +0000)]
MFC r305283,r314649:

r305283:

Skip :test_large on i386

More assertions are failing on ^/head now.

PR: 205446

r314649:

Convert lib/msun/ctrig_test from TAP to ATF

This is being done as a precursor for work needed to annontate failing
testcases with clang 4.0+.

PR: 217528

7 years agoMFC r314645:
ngie [Sun, 12 Mar 2017 04:33:44 +0000 (04:33 +0000)]
MFC r314645:

Fix "make depend" with nvme.ko: add opt_cam.h to SRCS

7 years agoMFC r314239:
ngie [Sun, 12 Mar 2017 04:32:15 +0000 (04:32 +0000)]
MFC r314239:

Add shutdown/poweroff support to rescue(8)

shutdown is a safer way to power off than reboot (in general), because of
the added shutdown process that it executes via /etc/rc.shutdown . It was
odd that it was missing from rescue(8) since reboot and friends were
added in past commits.

While here, alias poweroff to shutdown for parity with sbin/shutdown/Makefile

7 years agoMFC r314240:
ngie [Sun, 12 Mar 2017 04:12:22 +0000 (04:12 +0000)]
MFC r314240:

Conditionally compile certain programs into rescue(8) if requested

MK_CCD - ccdconfig
MK_ROUTED - routed, rtquery

7 years agoMFC 308106:
lwhsu [Sun, 12 Mar 2017 00:46:49 +0000 (00:46 +0000)]
MFC 308106:
- Use virtualbox-ose-additions-nox11 for vagrant image to reduce size

7 years agoMFC r314896:
cy [Sat, 11 Mar 2017 18:06:20 +0000 (18:06 +0000)]
MFC r314896:

Remove extraneous arguments and options, which don't make sense for
a file documented in volume 5.

7 years agoMFC r314768:
cy [Sat, 11 Mar 2017 17:57:22 +0000 (17:57 +0000)]
MFC r314768:

Fix mismerge of r280849.

Reported by: des

7 years agoMFC r312886:
cy [Sat, 11 Mar 2017 17:46:59 +0000 (17:46 +0000)]
MFC r312886:

Fix lookup of original destination address when using a redirect rule.
Transparent proxying, e.g. to squid, is an example of this.

Obtained from: NetBSD ip_nat.c r1.17, ip_nat6.c r1.10

7 years agoMFC r314274: l2arc: fix write size calculation broken by Compressed ARC commit
avg [Sat, 11 Mar 2017 15:30:28 +0000 (15:30 +0000)]
MFC r314274: l2arc: fix write size calculation broken by Compressed ARC commit

7 years agoMFC r314666: ioat: don't specify inline for function with variable argument list
avg [Sat, 11 Mar 2017 15:26:36 +0000 (15:26 +0000)]
MFC r314666: ioat: don't specify inline for function with variable argument list

7 years agoMFC r314253:
kib [Sat, 11 Mar 2017 09:22:53 +0000 (09:22 +0000)]
MFC r314253:
Do not leak mount references for dying threads.

7 years agoMFC r303464 (by brooks@):
dchagin [Sat, 11 Mar 2017 08:39:24 +0000 (08:39 +0000)]
MFC r303464 (by brooks@):

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.

7 years agoMFC r314556-r314558
brooks [Sat, 11 Mar 2017 02:51:29 +0000 (02:51 +0000)]
MFC r314556-r314558

r314556:
Correct MDSRCS use in <arch>/string/Makefile.inc.

- Remove .c files which duplicate entries in MISRCS.
- Use the same, less merge conflict prone style in all cases.
- Use MDSRCS for mips (.c and .S files both ended up in SRCS).
- Remove pointless sparc64 Makefile.inc.
- Remove uninformative foreign VCS ID entries.

Reviewed by: emaste, imp, jhb
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9841

r314557:
Correct an misunderstanding of MDSRCS.

MDSRCS it intended to allow assembly versions of funtions with C
implementations listed in MISRCS. The selection of the correct
machdep_ldis?.c for a given architecture does not follow this pattern
and the file should be added to SRCS directly.

Reviewed by: emaste, imp, jhb
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9841

r314558:
Garbage collect unused gdtoa related files on mips.

Reviewed by: emase, imp, jhb
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D9841

7 years agoMFC r313021, r313027, r313044:
gjb [Sat, 11 Mar 2017 02:20:11 +0000 (02:20 +0000)]
MFC r313021, r313027, r313044:

 r313021 (brd):
  Force a few variables to be upper case when they are evaulated.

 r313027 (brd):
  Add a new vagrant-box target, to make it easier and less redundant
  to only produce the Vagrant box and not upload it.

 r313044 (brd):
  Add some comments with examples on how to build Vagrant images.

Sponsored by: The FreeBSD Foundation

7 years agoMFC r314916:
gjb [Sat, 11 Mar 2017 02:12:39 +0000 (02:12 +0000)]
MFC r314916:
 Fix permissions on /tmp when installing the runtime package.

PR: 217574
Sponsored by: The FreeBSD Foundation

7 years agoMFC r314626
vangyzen [Fri, 10 Mar 2017 20:30:17 +0000 (20:30 +0000)]
MFC r314626

Fix grammar in some comments in subr_sleepqueue.c

While I'm here, remove trailing whitespace.

7 years agoMFC r313820
vangyzen [Fri, 10 Mar 2017 20:25:43 +0000 (20:25 +0000)]
MFC r313820

pf: use inet_ntoa_r() instead of inet_ntoa(); maybe fix IPv6 OS fingerprinting

inet_ntoa() cannot be used safely in a multithreaded environment
because it uses a static local buffer. Instead, use inet_ntoa_r()
with a buffer on the caller's stack.

This code had an INET6 conditional before this commit, but opt_inet6.h
was not included, so INET6 was never defined.  Apparently, pf's OS
fingerprinting hasn't worked with IPv6 for quite some time.
This commit might fix it, but I didn't test that.

Relnotes: yes (if I/someone can test pf OS fingerprinting with IPv6)
Sponsored by: Dell EMC

7 years agoMFC r314055
vangyzen [Fri, 10 Mar 2017 20:06:17 +0000 (20:06 +0000)]
MFC r314055

Make several improvements and corrections in the kenv(2) man page

Sponsored by: Dell EMC

7 years agoMFC r313817
vangyzen [Fri, 10 Mar 2017 19:33:37 +0000 (19:33 +0000)]
MFC r313817

acpica: remove a superfluous NULL check

The address-of operator can't produce NULL (in practice).
Remove an unnecessary NULL check.

Sponsored by: Dell EMC

7 years agoMFC r313748, r313749:
markj [Fri, 10 Mar 2017 18:56:23 +0000 (18:56 +0000)]
MFC r313748, r313749:
Register nss_atexit() before parsing nsswitch.conf for the first time.

7 years agoMFC r314153, r314154:
markj [Fri, 10 Mar 2017 18:54:48 +0000 (18:54 +0000)]
MFC r314153, r314154:
Fix some memory leaks in CDDL code.

7 years agoMFC r314625:
markj [Fri, 10 Mar 2017 18:53:44 +0000 (18:53 +0000)]
MFC r314625:
Fix a ticks comparison in sched_pctcpu_update().

7 years agoMFC r313841, r313850:
markj [Fri, 10 Mar 2017 18:51:47 +0000 (18:51 +0000)]
MFC r313841, r313850:
Prevent CPU migration when checking the DTrace nofault flag on x86.

7 years agoMFC r314211:
kib [Fri, 10 Mar 2017 10:58:31 +0000 (10:58 +0000)]
MFC r314211:
Remove cpu_deepest_sleep variable.

7 years agoMFC r314592: Fix JSON output.
mav [Fri, 10 Mar 2017 06:17:54 +0000 (06:17 +0000)]
MFC r314592: Fix JSON output.

7 years agoMFC r314614:
ae [Fri, 10 Mar 2017 05:44:14 +0000 (05:44 +0000)]
MFC r314614:
  Fix matching table entry value. Use real table value instead of its index
  in valuestate array.

  When opcode has size equal to ipfw_insn_u32, this means that it should
  additionally match value specified in d[0] with table entry value.
  ipfw_table_lookup() returns table value index, use TARG_VAL() macro to
  convert it to its value. The actual 32-bit value stored in the tag field
  of table_value structure, where all unspecified u32 values are kept.

  PR: 217262

7 years agoMFC r314145, r314158
pfg [Thu, 9 Mar 2017 02:58:02 +0000 (02:58 +0000)]
MFC r314145, r314158
vxge(4): double assignments.

Fix some suspicious code, likely caused by excessive copy-pasting.

Found with: coccinelle (da.cocci)

7 years agoMFC r314505:
pfg [Wed, 8 Mar 2017 22:38:40 +0000 (22:38 +0000)]
MFC r314505:
Split the ficl CFLAGS when they refer to an arch-specific include path.

This is a minimal attempt to keep consistency in the Makefiles so that
moving ficl to somwehere like contrib will be less error prone.

7 years agoMFC r314219
mmokhi [Wed, 8 Mar 2017 13:09:12 +0000 (13:09 +0000)]
MFC r314219
Add linux_preadv() and linux_pwritev() syscalls to Linuxulator.

Approved by: dchagin

7 years agoMFC r314497:
ae [Wed, 8 Mar 2017 07:59:45 +0000 (07:59 +0000)]
MFC r314497:
  Do not invoke the resize event when previous provider's size was zero.
  This is similar to r303637 fix for geom_disk.

7 years agoMFC r314061:
dim [Wed, 8 Mar 2017 07:58:29 +0000 (07:58 +0000)]
MFC r314061:

Add __int128-related symbols to libcxxrt's version map.  Put these into
the same CXXABI verions as recent libstdc++.

Note that __int128 types are only available on arches where long long is
128 bit wide.

Noticed by: harti

MFC r314104:

Surround any unmangled C++ names in libcxxrt's version map with 'extern
"C++"', otherwise ld refuses to make the symbols global in the final
library.  This causes the __int128-related symbols to go missing when
the library is stripped during installation.

Helpful hints: emaste

7 years agoPull in r291403 from upstream clang trunk (by Richard Smith):
dim [Tue, 7 Mar 2017 21:44:05 +0000 (21:44 +0000)]
Pull in r291403 from upstream clang trunk (by Richard Smith):

  PR30305: Implement proposed DR resolution to prevent slicing via
  inherited constructor.

  The rule we use is that a construction of a class type T from an
  argument of type U cannot use an inherited constructor if U is the
  same as T or is derived from T (or if the initialization would first
  convert it to such a type). This (approximately) matches the rule in
  use by GCC, and matches the current proposed DR resolution.

Pull in r291955 from upstream clang trunk (by Richard Smith):

  PR31606: Generalize our tentative DR resolution for inheriting
  copy/move constructors to better match the pre-P0136R1 behavior.

Together, these fix an issue with C++ using declarations sometimes
enabling illegal implicit casts.

Direct commit to stable/11, since head already has clang 4.0.0, which
includes this change.

Reported by: kami
PR: 215969

7 years agoMFC 313879
jpaetzel [Tue, 7 Mar 2017 18:27:35 +0000 (18:27 +0000)]
MFC 313879

MVF: 313876

7504 kmem_reap hangs spa_sync and administrative tasks

illumos/illumos-gate@405a5a0f5c3ab36cb76559467d1a62ba648bd809
https://github.com/illumos/illumos-gate/commit/405a5a0f5c3ab36cb76559467d1a62ba648bd80

https://www.illumos.org/issues/7504

  We see long spa_sync(). We are waiting to hold dp_config_rwlock for writer. Some
  other thread holds dp_config_rwlock for reader, then calls arc_get_data_buf(),
  which finds that arc_is_overflowing()==B_TRUE. So it waits (while holding
  dp_config_rwlock for reader) for arc_reclaim_thread to signal arc_reclaim_waiters_cv.
  Before signaling, arc_reclaim_thread does arc_kmem_reap_now(), which takes ~seconds.

Author: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>

7 years agoMFC r314058: zfs: lower priority of zio_write_issue threads by four
avg [Tue, 7 Mar 2017 15:27:40 +0000 (15:27 +0000)]
MFC r314058: zfs: lower priority of zio_write_issue threads by four

Obtained from: Panzura
Sponsored by: Panzura

7 years agoMFC r314429:
kib [Tue, 7 Mar 2017 12:16:47 +0000 (12:16 +0000)]
MFC r314429:
Initialize pcb_save for thread0.