]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
6 years agoMFC r318436:
ngie [Thu, 1 Jun 2017 06:41:27 +0000 (06:41 +0000)]
MFC r318436:

usr.bin/getconf: add some initial tests

Items tested via this commit are:
- Some basic POSIX constants.
- Some valid programming environments with -v.
- Some invalid programming environments via -v.

NOTE: this test makes assumptions about ILP32/LP32 vs LP64 that are
currently not true on all architectures to avoid hardcoding some
architectures in the tests. I'm working on improving getconf(1) to be
more sane about handling ILP32/LP32 vs LP64. Future commits are coming
soon to address this.

Tested with: amd64, i386

git-svn-id: svn://svn.freebsd.org/base/stable/10@319385 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318434:
ngie [Thu, 1 Jun 2017 06:39:55 +0000 (06:39 +0000)]
MFC r318434:

Make the `.gperf.c` suffix rule depend on fake-gperf.awk

Parameterize out fake-gperf.awk to avoid duplicating the path

git-svn-id: svn://svn.freebsd.org/base/stable/10@319382 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318177:
ngie [Thu, 1 Jun 2017 06:37:53 +0000 (06:37 +0000)]
MFC r318177:

Unconditionally install udp(4) and udplite(4) again

I added this to the MK_USB != no block in error in r278202.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319381 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r319157:
ngie [Thu, 1 Jun 2017 06:35:40 +0000 (06:35 +0000)]
MFC r319157:

fma_test: mute a warning about unreachable code on amd64 by restructuring
the #ifdef block to only handle the rest of the logic in the loop in the
#else case.

CID: 1346844

git-svn-id: svn://svn.freebsd.org/base/stable/10@319379 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r319158:
ngie [Thu, 1 Jun 2017 06:34:14 +0000 (06:34 +0000)]
MFC r319158:

logarithm_test: assert that feclearexcept succeeds

This helps ensure that test preconditons are fulfilled.

CID: 1346572

git-svn-id: svn://svn.freebsd.org/base/stable/10@319376 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318179:
ngie [Thu, 1 Jun 2017 06:31:25 +0000 (06:31 +0000)]
MFC r318179:

procstat(1): also reference icmp(4) and sctp(4)

This was missed in the previous commit by accident.

MFC with: r318178

git-svn-id: svn://svn.freebsd.org/base/stable/10@319375 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318175:
ngie [Thu, 1 Jun 2017 06:30:22 +0000 (06:30 +0000)]
MFC r318175:

procstat(1): clarify the Signal Disposition section

- Fix a typo (SIGIGN -> SIG_IGN). Use .Dv when referencing SIG_IGN.
- Use semi-colons as soft breaks when separating sentences for
  the FLAGS section.
- Tweak wording for C slightly to flow better and to be a bit
  more technically correct (signals with handlers installed will
  be caught by the target program).
- Reference signal(3) in the SEE ALSO section.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319374 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318178:
ngie [Thu, 1 Jun 2017 06:27:15 +0000 (06:27 +0000)]
MFC r318178:

procstat(1): document all possible `PRO` (network protocol) values

Reference the appropriate section 4 manpages for networking
protocols.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319373 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r319156,r319159:
ngie [Thu, 1 Jun 2017 06:16:57 +0000 (06:16 +0000)]
MFC r319156,r319159:

r319156:

:nvlist_unpack__duplicate_key : check the result of nvlist_pack(3)

This fixes a potential NULL pointer dereference.

CID: 1362051

r319159:

:dnvlist_get_string__default_value: fix a bogus string comparison test

Check actual_value vs "5", not "5" vs itself.

CID: 1362021

git-svn-id: svn://svn.freebsd.org/base/stable/10@319370 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoBump copyright years after previous commit.
gjb [Wed, 31 May 2017 17:42:07 +0000 (17:42 +0000)]
Bump copyright years after previous commit.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319348 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoWhitespace fixes to conform to FDP style.
gjb [Wed, 31 May 2017 17:42:06 +0000 (17:42 +0000)]
Whitespace fixes to conform to FDP style.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319347 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r318675, fix the client side krpc from doing TCP
gjb [Wed, 31 May 2017 17:42:05 +0000 (17:42 +0000)]
Document r318675, fix the client side krpc from doing TCP
reconnects for ERESTART from sosend().

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319346 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r309258, max_align_t for C11 compliance.
gjb [Wed, 31 May 2017 17:42:04 +0000 (17:42 +0000)]
Document r309258, max_align_t for C11 compliance.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319345 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318593:
asomers [Wed, 31 May 2017 17:20:55 +0000 (17:20 +0000)]
MFC r318593:

Fix build of AIO tests with -DDEBUG

Also, redefine some constants for clarity.  No functional change.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319344 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r313558, garbage IP addresses in UDP log_in_vain messages
gjb [Wed, 31 May 2017 13:44:54 +0000 (13:44 +0000)]
Document r313558, garbage IP addresses in UDP log_in_vain messages
fix.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319335 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r316040, kvm_close(3) return error fix.
gjb [Wed, 31 May 2017 13:44:53 +0000 (13:44 +0000)]
Document r316040, kvm_close(3) return error fix.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319334 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r317375, RTT used for receive buffer auto resizing.
gjb [Wed, 31 May 2017 13:44:53 +0000 (13:44 +0000)]
Document r317375, RTT used for receive buffer auto resizing.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319333 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r319243, rpcbind(8) warmstart support knob.
gjb [Wed, 31 May 2017 13:33:15 +0000 (13:33 +0000)]
Document r319243, rpcbind(8) warmstart support knob.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319332 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r319270, cxgbe(4) firmware update.
gjb [Wed, 31 May 2017 13:33:14 +0000 (13:33 +0000)]
Document r319270, cxgbe(4) firmware update.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319331 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r317434, ipf(4) 'keep frags' no longer implicit with
gjb [Wed, 31 May 2017 13:33:13 +0000 (13:33 +0000)]
Document r317434, ipf(4) 'keep frags' no longer implicit with
'keep state'

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319330 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r308915, zfsbootcfg(8).
gjb [Wed, 31 May 2017 13:33:13 +0000 (13:33 +0000)]
Document r308915, zfsbootcfg(8).

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319329 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r316046, WITHOUT_LIBTHR properly removes optional files.
gjb [Wed, 31 May 2017 13:33:12 +0000 (13:33 +0000)]
Document r316046, WITHOUT_LIBTHR properly removes optional files.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319328 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r313206, inetd(8) buildable without libwrap(3).
gjb [Wed, 31 May 2017 13:33:11 +0000 (13:33 +0000)]
Document r313206, inetd(8) buildable without libwrap(3).

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319327 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r309340, GARP retransmit capability.
gjb [Wed, 31 May 2017 13:33:10 +0000 (13:33 +0000)]
Document r309340, GARP retransmit capability.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319326 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r312359, r314019: alc(4) Killer E2400/E2500 support.
gjb [Wed, 31 May 2017 13:33:09 +0000 (13:33 +0000)]
Document r312359, r314019: alc(4) Killer E2400/E2500 support.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319325 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r311507, cxgbe(4) firmware 1.16.26.0.
gjb [Wed, 31 May 2017 13:33:08 +0000 (13:33 +0000)]
Document r311507, cxgbe(4) firmware 1.16.26.0.
Document r316485, qlnx(4) addition.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319324 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r319086:
kib [Wed, 31 May 2017 09:25:47 +0000 (09:25 +0000)]
MFC r319086:
Mention that the basep argument to getdirentries(2) can be NULL.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319311 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317632:
ngie [Wed, 31 May 2017 08:47:09 +0000 (08:47 +0000)]
MFC r317632:

Fix "make cscope-clean" when .OBJDIR already exists

The cscope generated files are always put in .CURDIR .

git-svn-id: svn://svn.freebsd.org/base/stable/10@319309 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316742:
ngie [Wed, 31 May 2017 08:43:45 +0000 (08:43 +0000)]
MFC r316742:

Clarify units for mediasize and sectorsize in DoFile(..)

They're byte quantities.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319306 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316740:
ngie [Wed, 31 May 2017 08:42:44 +0000 (08:42 +0000)]
MFC r316740:

Clarify `minfree` warning message in check_space(..)

- State that the units are kB.
- Be more complete/concise in terms of what is required (in this case
  `minfree` must be at least `X`kB)

git-svn-id: svn://svn.freebsd.org/base/stable/10@319305 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317311,r317312,r319019:
ngie [Wed, 31 May 2017 08:40:46 +0000 (08:40 +0000)]
MFC r317311,r317312,r319019:

r317311:

Check for failures from getpagesize(3)

Return errno on failure, similar to the open(2) call above it.

CID: 1193753

r317312:

Fix type for `pagesize` to match the return type for getpagesize(3)
to fix the build

Pointyhat to: ngie

r319019:

Remove getpagesize(3) error checking added in r317312

getpagesize(3) no longer fails as of r317436.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319303 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r319056,r319058,r319059,r319060,r319061,r319078:
ngie [Wed, 31 May 2017 08:36:47 +0000 (08:36 +0000)]
MFC r319056,r319058,r319059,r319060,r319061,r319078:

r319056:

tests/sys/file/ftruncate_test: use an exit code of 1 instead
of -1 with err*(3).

An exit code of -1 is implementation defined -- it's best to stick
with something well-defined (1).

r319058:

Create a deterministic file in the kyua sandbox, instead of a
temporary file outside the kyua sandbox

This helps ensure that the file is removed at test exit, and as
a side effect, cures a warning about umasks with Coverity.

r319059:

Use an exit code of 1 instead of -1 for reasons noted in r319056

r319060:

Use main(void) instead of main(argc __unused, argv __unused)

r319061:

Don't leak accept_fd on thread completion

CID: 1296068

r319078:

Tweak r319058 slightly

- Specify an explicit mode when using O_CREAT per open(2).
- Fix the error message (add missing enclosing parentheses).

MFC with: r319058

git-svn-id: svn://svn.freebsd.org/base/stable/10@319301 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r319027,r319028,r319029,r319030,r319031,r319033,r319034,r319035,r319036,r319037...
ngie [Wed, 31 May 2017 08:30:37 +0000 (08:30 +0000)]
MFC r319027,r319028,r319029,r319030,r319031,r319033,r319034,r319035,r319036,r319037,r319038,r319039,r319040,r319041,r319042,r319043,r319044,r319045,r319046:

r319027:

lib/libc/tests/nss: use calloc appropriately

The pattern used prior to this commit was `calloc(1, n * sizeof(type))`;
the pattern that should be used however is `calloc(n, sizeof(type))`.

r319028:

Sort make variables to suit style.Makefile(5)

This is being done prior to functional changes.

r319029:

Staticize functions and remove unused variables to aid with bumping WARNS

r319030:

Fix -Wsign-compare warnings

r319031:

getusershell_test: staticize run_tests(..) to fix warnings

r319033:

getserv_test: fix -Wsign-compare and -Wmissing-prototypes warnings

r319034:

getaddrinfo_test: fix -Wsign-compare warnings

r319035:

getrpc_test: fix -Wmissing-prototypes and -Wsign-compare warnings

r319036:

getproto_test: fix -Wmissing-prototypes and -Wsign-compare warnings

r319037:

getaddrinfo_test: mark unused function parameters __unused to fix -Wunused
warnings

r319038:

getusershell_test: mark mdata parameter in compare_usershell __unused

r319039:

getserv_test: mark unused parameters __unused to fix corresponding
warnings

r319040:

getrpc_test: fix -Wunused warnings

- Mark unused function parameters unused.
- Remove an unused function prototype.

r319041:

getproto_test: fix -Wunused warnings

Mark unused parameters __unused in functions.

r319042:

gethostby_test: fix multiple warning types

- Fix -Wmissing-declaration warning by staticizing run_tests.
- Fix -Wsign-compare warnings by casting size_t types to int
  for comparisons.

Reindent some of the code in sdump_hostent(..) to accomodate the
overall changes.

r319043:

getpw_test: fix -Wunused warnings

- Mark unused parameters __unused.
- Put dump_passwd under DEBUG as it's only used in that case.

r319044:

getgr_test: fix -Wunused warnings

r319045:

Fix -Wunused and -Wshadow warnings

r319046:

Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0

git-svn-id: svn://svn.freebsd.org/base/stable/10@319298 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318514-r318515, r318517, r318917
delphij [Wed, 31 May 2017 06:26:37 +0000 (06:26 +0000)]
MFC r318514-r318515, r318517, r318917

r318514:
Use size_t.

Inspired by: OpenBSD src/lib/libc/stdlib/qsort.c,v 1.11

r318515:
The current qsort(3) implementation ignores the sizes of partitions, and
always perform recursion on the left partition, then use a tail call to
handle the right partition.  In the worst case this could require O(N)
levels of recursions.

Reduce the possible recursion level to log2(N) by always recursing on the
smaller partition instead.

Obtained from: PostgreSQL 9d6077abf9d6efd992a59f05ef5aba981ea32096

r318517:
Sync qsort.c with userland r318515.

(Note that MIN macro is removed in favor of sys/param.h's version).

PR: 213922

r318917:
Disconnect heimdal version of qsort.c from build because we are already
using libc's version of qsort.

PR: bin/213922

git-svn-id: svn://svn.freebsd.org/base/stable/10@319291 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoPartial MFC r288030 (rodrigc):
delphij [Wed, 31 May 2017 06:19:12 +0000 (06:19 +0000)]
Partial MFC r288030 (rodrigc):

Use ANSI C prototypes.  Eliminates -Wold-style-definition warnings.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319290 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r279663,r279666 (pfg):
delphij [Wed, 31 May 2017 06:13:33 +0000 (06:13 +0000)]
MFC r279663,r279666 (pfg):

r279663:

qsort(3): enhance to handle 32-bit aligned data on 64-bit systems

Implement a small enhancement to the original qsort implementation:
If the data is 32 bit aligned we can side-step the long type
version and use int instead.

The change brings a modest but significant improvement in
32 bit workloads.

r279666:

qsort(3): small style(9) cleanups.

Basically spaces vs. tabs.
No functional change.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319289 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316649:
delphij [Wed, 31 May 2017 06:08:11 +0000 (06:08 +0000)]
MFC r316649:

Add missing double quote to fix r316635 commit.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319288 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r311989 (cem):
delphij [Wed, 31 May 2017 06:00:14 +0000 (06:00 +0000)]
MFC r311989 (cem):

libkern: Remove obsolete 'register' keyword

git-svn-id: svn://svn.freebsd.org/base/stable/10@319286 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316635:
delphij [Wed, 31 May 2017 05:38:57 +0000 (05:38 +0000)]
MFC r316635:

Enable 16-bit longest_match for x86.

This gives a ~2% improvement in compression tests.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319283 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r313327:
delphij [Wed, 31 May 2017 05:33:32 +0000 (05:33 +0000)]
MFC r313327:

Reflect actual NetBSD revision we already have.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319281 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r315272, r315370
delphij [Wed, 31 May 2017 05:11:28 +0000 (05:11 +0000)]
MFC r315272, r315370

r315272:
Implement INHERIT_ZERO for minherit(2).

INHERIT_ZERO is an OpenBSD feature.

When a page is marked as such, it would be zeroed
upon fork().

This would be used in new arc4random(3) functions.

PR: 182610
Reviewed by: kib (earlier version)
Differential Revision: https://reviews.freebsd.org/D427

r315370:
The adj_free and max_free values of new_entry will be calculated and
assigned by subsequent vm_map_entry_link(), therefore, remove the
pointless copying.

Submitted by: alc

git-svn-id: svn://svn.freebsd.org/base/stable/10@319278 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318774:
np [Wed, 31 May 2017 00:43:52 +0000 (00:43 +0000)]
MFC r318774:

cxgbe/iw_cxgbe: sodisconnect failures are harmless and should not be
treated as fatal errors.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@319272 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318762:
np [Wed, 31 May 2017 00:16:43 +0000 (00:16 +0000)]
MFC r318762:

cxgbe(4): Update the T4, T5, and T6 firmwares to 1.16.45.0.

The latest firmware has a number of link related fixes, support for a
new custom card, and the fix for a bug that affected rate limiting on
FreeBSD.

Relnotes: Yes
Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@319270 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318189:
asomers [Tue, 30 May 2017 22:54:52 +0000 (22:54 +0000)]
MFC r318189:

vdev_geom may associate multiple vdevs per g_consumer

vdev_geom.c currently uses the g_consumer's private field to point to a
vdev_t. That way, a GEOM event can cause a change to a ZFS vdev. For
example, when you remove a disk, the vdev's status will change to REMOVED.
However, vdev_geom will sometimes attach multiple vdevs to the same GEOM
consumer. If this happens, then geom events will only be propagated to one
of the vdevs.

Fix this by storing a linked list of vdevs in g_consumer's private field.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c

* g_consumer.private now stores a linked list of vdev pointers associated
  with the consumer instead of just a single vdev pointer.

* Change vdev_geom_set_physpath's signature to more closely match
  vdev_geom_set_rotation_rate

* Don't bother calling g_access in vdev_geom_set_physpath. It's guaranteed
  that we've already accessed the consumer by the time we get here.

* Don't call vdev_geom_set_physpath in vdev_geom_attach. Instead, call it
  in vdev_geom_open, after we know that the open has succeeded.

PR: 218634
Reviewed by: gibbs
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10391

git-svn-id: svn://svn.freebsd.org/base/stable/10@319268 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318141, r318143-r318144
asomers [Tue, 30 May 2017 22:48:17 +0000 (22:48 +0000)]
MFC r318141, r318143-r318144

r318141:
strcpy => strlcpy

Reported by: Coverity
CID: 1352771
Sponsored by: Spectra Logic Corp

r318143:
strcpy => strlcpy

Reported by: Coverity
CID: 1006715
Sponsored by: Spectra Logic Corp

r318144:
Don't depend on assert(3) getting evaluated

Reported by: imp
X-MFC-With: 318141, 318143
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@319267 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317759:
asomers [Tue, 30 May 2017 22:46:00 +0000 (22:46 +0000)]
MFC r317759:

Fix memory leaks in camcontrol

Reported by: Coverity
CID: 13316741331675
Reviewed by: ken
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10588

git-svn-id: svn://svn.freebsd.org/base/stable/10@319266 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317755, r317758
asomers [Tue, 30 May 2017 22:45:01 +0000 (22:45 +0000)]
MFC r317755, r317758

r317755:
Various Coverity fixes in ifconfig(8)

* Exit early if kldload(2) fails (1011259). This is the only change that
  affects ifconfig's behavior.
* Close memory and resource leaks (130562413052051007100)
* Mark usage() as _Noreturn (13058061305750)
* Fix some dereference after null checks (1011474, 270774)

Reported by: Coverity
CID: 130562413052051007100130580613057501011474,
CID: 270774, 1011259
Reviewed by: cem
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10587

r317758:
Unbreak ifconfig for mlx4en(4) after r317755

ifconfig doesn't correctly infer mlx interfaces' module names, so it will
attempt to load the mlx(4) module even when not necessary.

Reported by: rstone
X-MFC-With: 317755
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@319265 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317715:
asomers [Tue, 30 May 2017 22:44:05 +0000 (22:44 +0000)]
MFC r317715:

ifconfig displays ND6_IFF_NO_DAD as "IGNORELOOP"

PR: 218958
Reviewed by: kristof
Differential Revision: https://reviews.freebsd.org/D10543

git-svn-id: svn://svn.freebsd.org/base/stable/10@319264 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316856:
asomers [Tue, 30 May 2017 22:43:08 +0000 (22:43 +0000)]
MFC r316856:

MFV 316855

7900 zdb shouldn't print the path of a znode at verbosity < 5

Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Alan Somers <asomers@freebsd.org>

illumos/illumos-gate@e548d2fa41d1baa06662ed9abbb8bcec86e27dd9
https://www.illumos.org/issues/7900

Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@319263 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316760:
asomers [Tue, 30 May 2017 22:41:19 +0000 (22:41 +0000)]
MFC r316760:

Fix vdev_geom_attach_by_guids for partitioned disks

When opening a vdev whose path is unknown, vdev_geom must find a geom
provider with a label whose guids match the desired vdev. However, due to
partitioning, it is possible that two non-synonomous providers will share
some labels. For example, if the first partition starts at the beginning of
the drive, then ada0 and ada0p1 will share the first label. More troubling,
if the last partition runs to the end of the drive, then ada0p3 and ada0
will share the last label. If vdev_geom opens ada0 when it should've opened
ada0p3, then the pool won't be readable. If it opens ada0 when it should've
opened ada0p1, then it will corrupt some other partition when it writes the
3rd and 4th labels.

The easiest way to reproduce this problem is to install a mirrored root pool
with the default partition layout, then swap the positions of the two boot
drives and reboot.  Whether the bug manifests depends on the order in which
geom lists its providers, which is arbitrary.

Fix this situation by modifying the search algorithm to prefer geom
providers that have all four labels intact. If no such provider exists, then
open whichever provider has the most.

Reviewed by: mav
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10365

git-svn-id: svn://svn.freebsd.org/base/stable/10@319262 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316611:
asomers [Tue, 30 May 2017 22:36:24 +0000 (22:36 +0000)]
MFC r316611:

sbin/mount: strcpy -> strlcpy

Reported by: Coverity
CID: 10111731011174
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@319261 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316610:
asomers [Tue, 30 May 2017 22:35:36 +0000 (22:35 +0000)]
MFC r316610:

usr.bin/netstat: strcpy -> strlcpy

Reported by: Coverity
CID: 10067411006744
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@319260 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316548:
asomers [Tue, 30 May 2017 22:34:43 +0000 (22:34 +0000)]
MFC r316548:

Quiet 450.status-security when *_inline="YES"

Previously, 450.status-security would always set rc=3 in inline mode,
because it doesn't know whether "periodic security" is going to find
anything interesting. But this annoyingly results in daily reports that
simply say "Security check: \n\n-- End of daily output --".

This change fixes that by testing whether "periodic security" printed
anything, and setting 450.status-security's exit status to 3 if it did. An
alternative would be to change the exit status of periodic(8) to be the
worst of its scripts' exit statuses, but that would be a more intrusive
change.

Reviewed by: brian
Differential Revision: https://reviews.freebsd.org/D10267

git-svn-id: svn://svn.freebsd.org/base/stable/10@319259 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316535:
asomers [Tue, 30 May 2017 22:33:24 +0000 (22:33 +0000)]
MFC r316535:

Fix memory leak in "gpart bootcode"

Also, annotate that gpart_issue never returns

Reported by: Coverity
CID: 1007105
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@319258 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316501, r316523
asomers [Tue, 30 May 2017 22:02:55 +0000 (22:02 +0000)]
MFC r316501, r316523

r316501:
Fix file descriptor and memory leaks in pr(1)

Also, hook NetBSD's pr test into the build, and add three more test cases.

Reported by: Coverity, Valgrind
CID: 271650 271651 271652 271653 271654 271655 271656 271656
CID: 271657 271658 271659 1006939 1006940 1006941 1006942 1009098
Reviewed by: ngie
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9137

r316523:
Remove a duplicate fclose() that snuck into r316501

Reported by: Coverity
CID: 1373338
X-MFC-With: 316501
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@319257 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316500 (except the part to usr.bin/fortune)
asomers [Tue, 30 May 2017 21:58:53 +0000 (21:58 +0000)]
MFC r316500 (except the part to usr.bin/fortune)

strcpy => strlcpy, strcat => strlcat

Reported by: Coverity
CID: 1006703 978863 1006745 1347163
Reviewed by: cem
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D10192

git-svn-id: svn://svn.freebsd.org/base/stable/10@319256 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r314176 and r318973.
np [Tue, 30 May 2017 21:57:25 +0000 (21:57 +0000)]
MFC r314176 and r318973.

r314176:
Add support for RDMA from userspace with T6 cards.

r318973:
libcxgb4: Use memcpy instead of copying WRs 8B at a time in the userspace
RDMA library for cxgbe(4).

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@319255 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r315032-r315036, r315039, r315041
asomers [Tue, 30 May 2017 21:03:44 +0000 (21:03 +0000)]
MFC r315032-r315036, r315039, r315041

r315032:
Increase WARNS for iconv tests

ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by: ngie
Sponsored by: Spectra Logic Corporation
Differential Revision: https://reviews.freebsd.org/D9933

r315033:
Increase WARNS for nss tests

ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by:  ngie
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933

r315034:
Document that the msun tests require WARNS=0

ATF tests have a default WARNS of 0, unlike other usermode programs.  This
change is technically a noop, but it documents that the msun tests don't
work with any warnings enabled, at least not on all architectures.

Reviewed by:  ngie
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933

r315035:
Increase WARNS for libcrypt tests

ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by:  ngie, julian
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933

r315036:
Increase WARNS for libmp tests

ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by:  ngie, julian
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933

r315039:
Increase WARNS for libutil tests

ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by:  ngie, julian
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933

r315041:
Increase WARNS for pw tests

ATF tests have a default WARNS of 0, unlike other usermode programs.

Reviewed by:  ngie, julian
Sponsored by: Spectra Logic Corporation
Differential Revision:        https://reviews.freebsd.org/D9933

git-svn-id: svn://svn.freebsd.org/base/stable/10@319252 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoRegenerate src.conf(5) after adding MK_RPCBIND_WARMSTART_SUPPORT
ngie [Tue, 30 May 2017 17:48:41 +0000 (17:48 +0000)]
Regenerate src.conf(5) after adding MK_RPCBIND_WARMSTART_SUPPORT

git-svn-id: svn://svn.freebsd.org/base/stable/10@319245 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317168:
ngie [Tue, 30 May 2017 17:46:19 +0000 (17:46 +0000)]
MFC r317168:

Add a knob, WITH*_RPCBIND_WARMSTART_SUPPORT, to allow the end-user to build
rpcbind(8) with/without warmstart support.

The knob defaults to off to preserve POLA for the feature.

See rpcbind(8) for more details about the warmstart feature.

Relnotes: yes

git-svn-id: svn://svn.freebsd.org/base/stable/10@319243 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317154,r317155,r317162,r317163,r317164:
ngie [Tue, 30 May 2017 17:42:48 +0000 (17:42 +0000)]
MFC r317154,r317155,r317162,r317163,r317164:

r317154:

Print out the signal number on exit in terminate(..) if WARMSTART is compiled
into rpcbind.

The signal number can provide helpful diagnostic info.

Obtained from: Isilon OneFS

r317155:

rpcbind(8): wordsmith -h description and mention -W in the SYNOPSIS section

-W was already documented in the OPTIONS section.

r317162:

rpcbind(8): add a description for /var/run/rpcbind.sock under the FILES section

r317163:

rpcbind(8): post-humously document -w (warmstart) support added in r74462

warmstart support saves portmap/rpcbind(8) registration state on exit and
restores the saved registration state on restart.

r317164:

Fix indentation per style.Makefile(5)

git-svn-id: svn://svn.freebsd.org/base/stable/10@319242 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoDocument r315433, libarchive 3.3.1.
gjb [Tue, 30 May 2017 16:46:25 +0000 (16:46 +0000)]
Document r315433, libarchive 3.3.1.
Document r316958, tcsh 6.20.00.
Document r310490, amd(8) 6.2.
Document r316350, tzdata 2017b.
Document r309848, file(1) 5.29.
Document r309512, Subversion 1.9.5.
Document r312516, xz(1) 5.2.3.
Prune comments.
Bump copyright year.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319225 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r314341:
asomers [Tue, 30 May 2017 16:17:00 +0000 (16:17 +0000)]
MFC r314341:

Update devd.conf for ports change 421360

Ports change 421360 changed the name and UID of the postgres user

Reviewed by: trasz, imp, girgen
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9746

git-svn-id: svn://svn.freebsd.org/base/stable/10@319223 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r314148, r314150
asomers [Tue, 30 May 2017 16:15:52 +0000 (16:15 +0000)]
MFC r314148, r314150

r314148:
Misc Coverity fixes in xnb(4)

Most of these are null pointer dereferences or missing error checks in the
unit tests. One is a missing error check in xnb_attach_failed. None can
cause real problems in running systems.

Reported by: Coverity
CIDs: 1092469 1092468 1092467 2092466 1092465 1092512 1092511 1092510
CIDs: 1092510 1092509 1092508 1092507
Reviewed by: royger
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9234

r314150:
Fix the xnb(4) unit tests

One test was inadvertently expecting a bug in the kernel's sscanf
implementation circa 2012. I don't know when that bug got fixed.

Reported by: royger
Reviewed by: royger
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D9766

git-svn-id: svn://svn.freebsd.org/base/stable/10@319222 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r313069:
asomers [Tue, 30 May 2017 16:09:54 +0000 (16:09 +0000)]
MFC r313069:

Allow 999.local to run scripts in any language

If one of the scripts listed in (daily|weekly|monthly)_local is executable,
999.local should simply execute it. Only if the script isn't executable
should 999.local assume it needs /bin/sh.

Reviewed by: brian
Sponsored by: Spectra Logic Corp

git-svn-id: svn://svn.freebsd.org/base/stable/10@319221 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r301207:
asomers [Tue, 30 May 2017 16:05:11 +0000 (16:05 +0000)]
MFC r301207:

Fix exit status of "service routing start <af> <iface>"

etc/rc.d/routing
Ignore the exit status of options_{inet,inet6,atm}. It's
meaningless.

Reviewed by: hrs
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D6687

git-svn-id: svn://svn.freebsd.org/base/stable/10@319220 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318606:
cy [Tue, 30 May 2017 03:33:48 +0000 (03:33 +0000)]
MFC r318606:

Refactor & compact struct i6addr_t #ifdef: remove redundant structure
definintion when USE_INET6 is false.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319179 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318588:
cy [Tue, 30 May 2017 03:30:53 +0000 (03:30 +0000)]
MFC r318588:

Fix up two assertions following malloc(). vangyzen@ notified me of
the second one. The first one is fixed as well.

Reported by: vangyzen@

git-svn-id: svn://svn.freebsd.org/base/stable/10@319178 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318578:
cy [Tue, 30 May 2017 03:27:59 +0000 (03:27 +0000)]
MFC r318578:

Fix non-recoverable name resolution failures due to negative cache
entries never expiring. This patch honours the negative cache timeout.

To test/experience the failure do the following:

1. Edit /etc/ncd.conf to adjust the cache timeouts as follows:

positive-time-to-live hosts 30
negative-time-to-live hosts 1

2. Ensure that nsswitch.conf hosts line contains something like:

hosts: files cache dns

Note that cache must be specified before dns.

3. Start nscd.

4. Run the following command:

while true; do nc -z -w 3 www.google.com 80; sleep 5; done

5. While running the command, remove or comment out all nameserver
   statements in /etc/resolv.conf. After a short while you will notice
   non-recoverable name rsolution failures.

6. Uncomment or replace all nameserver statements back into
   /etc/resolv.conf. Take note that name resolution never recovers.
   To recover nscd must be restarted. This patch fixes this.

PR: 207804
Submitted by: Jov <amutu@amutu.com>

git-svn-id: svn://svn.freebsd.org/base/stable/10@319177 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318745:
cy [Tue, 30 May 2017 03:25:05 +0000 (03:25 +0000)]
MFC r318745:

Remove redundant variable declaration.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319176 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r319015:
ngie [Tue, 30 May 2017 02:56:37 +0000 (02:56 +0000)]
MFC r319015:

Use calloc instead of malloc + memset

git-svn-id: svn://svn.freebsd.org/base/stable/10@319170 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317313:
ngie [Mon, 29 May 2017 18:20:29 +0000 (18:20 +0000)]
MFC r317313:

gctl_test.t: catch errors with the mdcfg directive

While here, add a note about certain testcases relying on `count=1024` in
the "create" portion.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319154 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318303:
kib [Mon, 29 May 2017 13:00:39 +0000 (13:00 +0000)]
MFC r318303:
Style.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319131 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318299:
kib [Mon, 29 May 2017 12:59:24 +0000 (12:59 +0000)]
MFC r318299:
Simplify cleanup on failure in realpath(3).

git-svn-id: svn://svn.freebsd.org/base/stable/10@319130 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318298:
kib [Mon, 29 May 2017 12:58:30 +0000 (12:58 +0000)]
MFC r318298:
Fix several buffer overflows in realpath(3), and other minor issues.

PR: 219154

git-svn-id: svn://svn.freebsd.org/base/stable/10@319129 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r315561:
ngie [Mon, 29 May 2017 06:31:04 +0000 (06:31 +0000)]
MFC r315561:
r315561 (by trasz):

Bring back the "i".  The point is to make it easy to find via "apropos
iscsi", along with all the other relevant components.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319097 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316179,r316180,r316181,r316260:
ngie [Mon, 29 May 2017 06:25:59 +0000 (06:25 +0000)]
MFC r316179,r316180,r316181,r316260:

r316179 (by cem):

t_msgsnd: Use msgsnd()'s msgsz argument correctly to avoid overflow

msgsnd's msgsz argument is the size of the message following the 'long'
message type.  Don't include the message type in the size of the message
when invoking msgsnd(2).

CID: 1368712

r316180 (by cem):

Follow-up to r316179: More of the same

CIDs: 1368705136870613687071368710

r316181 (by cem):

t_msgctl: Fix the same msgsnd() misuse as t_msgsnd

msgsnd(2)'s msgsz argument does not describe the full structure, only the
message component.

CIDs: 13687031368711

r316260:

Annotate all changes made in r316178-r316180 with __FreeBSD__

Restore the stock (upstream) code under an #else block, so it's easier
for me to visualize and understand the code that needs to be upstreamed.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319094 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318315:
ngie [Mon, 29 May 2017 06:22:12 +0000 (06:22 +0000)]
MFC r318315:

lib/libc/gen/realpath_test: make check result from getcwd(3)

This is being done to avoid dereferencing a NULL pointer via strlcat,
obscuring the underlying issue with the getcwd(3) call.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319093 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318688: "struct ata_params" field "reserved206[2]" actually starts at
rpokala [Mon, 29 May 2017 05:23:09 +0000 (05:23 +0000)]
MFC r318688: "struct ata_params" field "reserved206[2]" actually starts at
offset 20*7*.

Sponsored by: Panasas

git-svn-id: svn://svn.freebsd.org/base/stable/10@319090 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318860:
hselasky [Sun, 28 May 2017 10:44:43 +0000 (10:44 +0000)]
MFC r318860:
Declare the "snd_fxdiv_table" once. This shaves around 24Kbytes of
binary data from sound.ko and the kernel.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319066 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318872:
gjb [Sun, 28 May 2017 03:59:33 +0000 (03:59 +0000)]
MFC r318872:
 Enable DHCP and IPv6 autoconfig on non-cloud VM images.

PR: 203653
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@319032 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r309412,r316109,r316132:
ngie [Sun, 28 May 2017 01:14:59 +0000 (01:14 +0000)]
MFC r309412,r316109,r316132:

r309412 (by imp):

dd is currently a bootstrap tool. It really doesn't have any business
being a bootstrap tool. However, for reproducible build output,
FreeBSD added dd status=none because it was otherwise difficult to
suppress the status information, but retain any errors that might
happen. There's no real reason that dd has to be a build tool, other
than we use status=none unconditional. Remove dd from a bootstrap tool
entirely by only using status=none when available. This may also help
efforts to build the system on non-FreeBSD hosts as well.

r316109:

Don't hardcode input files for stage 1/2 bootloaders; use .ALLSRC instead

This is a better pattern to follow when creating the bootloaders and doing
the relevant space checks to make sure that the sizes aren't exceeded (and
thus, copy-pasting is a bit less error prone).

r316132:

Parameterize out 7680 (15 * 512) as BOOT2SIZE, similar to sys/boot/i386/zfsboot/...

This is being done to make it easier to change in the future--this action might be
needed sooner rather than later because of gcc 6.3.0 bailing, stating that there
is negative free space left (deficit) in the boot2 bootloader.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319025 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316131:
ngie [Sun, 28 May 2017 00:47:02 +0000 (00:47 +0000)]
MFC r316131:

Fix up r316081 by using nitems(cam_errbuf) instead of sizeof(cam_errbuf)

Part of my original reasoning as far as converting the snprintf
calls was to permit switching over from char[] to wchar_t[] in the
future, as well as futureproof in case cam_errbuf's size was ever
changed.

Unfortunately, my approach was bugged because it conflated the
number of items with the size of the buffer, instead of the number of
elements being a fixed size != 1 byte.

Use nitems(..) instead which counts the quantity of items of a specific
type, as opposed to an unqualified sizeof(..) (which assumes that the
number of characters is equal to the buffer size).

Noted by: cem

git-svn-id: svn://svn.freebsd.org/base/stable/10@319023 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317310,r317316:
ngie [Sun, 28 May 2017 00:25:44 +0000 (00:25 +0000)]
MFC r317310,r317316:

r317310:

Minor style(9) fixups

Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

r317316:

Minor style(9) fixups

Delete trailing whitespace and sort headers.

Leave libgeom.h's placement alone, per reasoning in r317289.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319018 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317290,r317291,r317292,r317293,r317294,r317295,r317304,r317306,r317307,r317308...
ngie [Sat, 27 May 2017 23:31:59 +0000 (23:31 +0000)]
MFC r317290,r317291,r317292,r317293,r317294,r317295,r317304,r317306,r317307,r317308,r317309:

r317290:

Fix -Wimplicit-function-declaration compilation warning by moving libgeom.h
#include below the stdio.h #include.

gctl_dump(3) needs stdio.h, per reasoning noted in r317289.

PR: 218809

r317291:

Rename gctl.t to gctl_test.t and test.c to gctl_test_helper.c

This is being done to reduce ambiguity and to make the tests more portable
in the future to other locations in the source tree.

r317292:

gctl_test.t: use make to compile gctl_test_helper instead of calling cc directly

r317293:

gctl_test_helper: apply polish

- Staticize variables to fix warnings.
- Sprinkle asserts around for calls that can fail
- Apply style(9) for main(..) definition.
- ANSIify usage(..) definition.

r317294:

Bump WARNS to 6 per previous commits which fixed warnings

Tested with: clang (4.0), gcc (4.2.1, 6.3.0)

r317295:

The GPT class no longer exists; use the PART class instead

r317304:

gctl_test_helper: add diagnostic output for parse_retval(..)

This will help end-users better diagnose issues with the function.

r317306:

gctl_test.t: minor tweaks

- Declare $count with the `my` scope operator to permit `use strict`.
- Add `use strict`.
- Use `use warnings` instead of using `-w` in the shebang.
- Don't unlink $cmd when done (prevents unnecessary rebuilding).
- Improve the error message when running with insufficient permissions, e.g.,
  non-root.

r317307:

Use verb=delete not verb=remove

The `remove` verb hasn't been present in geom_part*(4) for well
over a decade, if ever. I couldn't find any references to it in
^/stable/5 at least, which is around the timeframe that this test
was written.

r317308:

gctl_test.t: more tweaks to try and update the code and get it functional (again?)

- Make the logfile for $out be built off the basename for $cmd, instead of $cmd.
  (r317292 broke this assumption).
- Rename $mntpt to $mntpt_prefix for clarity, as this variable is a prefix for
  mountpoints.
- Reindent the umount directive block while here to match the rest of the code.

r317309:

gctl_test.t: improve error reporting with mdcfg and mount directives

If the commands had failed previously, it would press on and result in a
series of cascading failures. Fail early and continue on to the next case
instead of executing additional commands after a previously failed series
of steps.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319014 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r316099:
ngie [Sat, 27 May 2017 23:26:10 +0000 (23:26 +0000)]
MFC r316099:

lib/libkvm: start adding basic tests for kvm(3)

- kvm_close: add a testcase to verify support for errno = EINVAL / -1
  (see D10065) when kd == NULL is provided to the libcall.
- kvm_geterr:
-- Add a negative testcase for kd == NULL returning "" (see D10022).
-- Add two positive testcases:
--- test the error case using kvm_write on a O_RDONLY descriptor.
--- test the "no error" case using kvm_read(3) and kvm_nlist(3) as
    helper routines and by injecting a bogus error message via
    _kvm_err (an internal API) _kvm_err was used as there isn't a
    formalized way to clear the error output, and because
    kvm_nlist always returns ENOENT with the NULL terminator today.
- kvm_open, kvm_open2:
-- Add some basic negative tests for kvm_open(3) and kvm_open2(3).
   Testing positive cases with a specific
   `corefile`/`execfile`/`resolver` requires more work and would require
   user intervention today in order to reliably test this out.

MFC note:
  lib/libkvm/kvm_open2_test is not compiled/tested because ^/stable/10
  lacks the kvm_open2(3) libcall.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319012 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318546:
ngie [Sat, 27 May 2017 23:04:48 +0000 (23:04 +0000)]
MFC r318546:

sys/fs/tmpfs/vnd_test: make md(4) allocation dynamic

The previous logic was flawed in the sense that it assumed that /dev/md3
was always available. This was a caveat I noted in r306038, that I hadn't
gotten around to solving before now.

Cache the device for the mountpoint after executing mdmfs, then use the
cached value in basic_cleanup(..) when unmounting/disconnecting the md(4)
device.

Apply sed expressions to use reuse logic in the NetBSD code that could
also be applied to FreeBSD, just with different tools.

git-svn-id: svn://svn.freebsd.org/base/stable/10@319007 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317288,r317289:
ngie [Sat, 27 May 2017 22:57:07 +0000 (22:57 +0000)]
MFC r317288,r317289:

r317288:

libgeom(3): apply minor polish

- Use .Dv when mentioning NULL per mdoc(7).
- Reword `g_device_path`, `g_open_by_ident`, and `g_providername`'s descriptions
  so they're less wordy.
- Fix a typo in `g_device_path` (can not -> cannot).

Tested with: igor, make manlint

r317289:

libgeom(3): note that stdio.h is required when referencing gctl_dump(3)

gctl_dump(3) is only exposed when stdio.h is #include'd first, per its
addition in r112510. The reasoning noted for the conditional "exposure"
of the function was to "limit #include pollution".

This addresses an issue I found with the documentation when looking at
bug 218809, which in turn addresses a -Wimplicit-function-declaration
compiler warning in `tools/regression/geom_gpt/test.c` (it uses
gctl_dump(3)).

git-svn-id: svn://svn.freebsd.org/base/stable/10@319003 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318900:
bapt [Sat, 27 May 2017 11:21:20 +0000 (11:21 +0000)]
MFC r318900:

update pci_vendors to 2017.05.25

git-svn-id: svn://svn.freebsd.org/base/stable/10@318984 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318820:
hselasky [Sat, 27 May 2017 08:27:11 +0000 (08:27 +0000)]
MFC r318820:
Increase the allowed maximum number of audio channels from 31 to 127
in the PCM feeder mixer. Without this change a value of 32 channels is
treated like zero, due to using a mask of 0x1f, causing a kernel
assert when trying to playback bitperfect 32-channel audio. Also
update the AWK script which is generating the division tables to
handle more than 18 channels. This commit complements r282650.

git-svn-id: svn://svn.freebsd.org/base/stable/10@318979 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318353:
hselasky [Sat, 27 May 2017 08:17:59 +0000 (08:17 +0000)]
MFC r318353:
Avoid use of contiguous memory allocations in busdma when possible.

This patch improves the boundary checks in busdma to allow more cases
using the regular page based kernel memory allocator. Especially in
the case of having a non-zero boundary in the parent DMA tag. For
example AMD64 based platforms set the PCI DMA tag boundary to
PCI_DMA_BOUNDARY, 4GB, which before this patch caused contiguous
memory allocations to be preferred when allocating more than PAGE_SIZE
bytes. Even if the required alignment was less than PAGE_SIZE bytes.

This patch also fixes the nsegments check for using kmem_alloc_attr()
when the maximum segment size is less than PAGE_SIZE bytes.

Updated some comments describing the code in question.

Differential Revision: https://reviews.freebsd.org/D10645
Reviewed by: kib, jhb, gallatin, scottl
Sponsored by: Mellanox Technologies

git-svn-id: svn://svn.freebsd.org/base/stable/10@318977 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r314935 (thompsa):
gjb [Fri, 26 May 2017 19:02:46 +0000 (19:02 +0000)]
MFC r314935 (thompsa):
 Change ec2.conf to use the pkg tool from a chroot rather than trying
 to bootstrap it and fail from the livecd readonly filesystem.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@318963 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318748:
gjb [Fri, 26 May 2017 13:09:16 +0000 (13:09 +0000)]
MFC r318748:
 Honor WITHOUT_TFTP for check-old* and delete-old* targets.

PR: 217949
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@318949 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318516: Fix time handling in cv_timedwait_hires().
mav [Fri, 26 May 2017 00:26:08 +0000 (00:26 +0000)]
MFC r318516: Fix time handling in cv_timedwait_hires().

pthread_cond_timedwait() receives absolute time, not relative.  Passing
wrong time there caused two threads of zdb to spin in a tight loop.

git-svn-id: svn://svn.freebsd.org/base/stable/10@318910 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318527
truckman [Thu, 25 May 2017 22:41:34 +0000 (22:41 +0000)]
MFC r318527

Fix the queue delay estimation in PIE/FQ-PIE when the timestamp
(TS) method is used.  When packet timestamp is used, the "current_qdelay"
keeps storing the last queue delay value calculated in the dequeue
function.  Therefore, when a burst of packets arrives followed by
a pause, the "current_qdelay" will store a high value caused by the
burst and stick to that value during the pause because the queue
delay measurement is done inside the dequeue function.  This causes
the drop probability calculation function to calculate high drop
probability value instead of zero and prevents the burst allowance
mechanism from working properly.  Fix this problem by resetting
"current_qdelay" inside the drop probability calculation function
when the queue length is zero and TS option is used.

Submitted by: Rasool Al-Saadi <ralsaadi@swin.edu.au>

git-svn-id: svn://svn.freebsd.org/base/stable/10@318905 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318511
truckman [Thu, 25 May 2017 17:23:26 +0000 (17:23 +0000)]
MFC r318511

The result of right shifting a negative signed value is implementation
defined.  On machines without arithmetic shift instructions, zero bits
may be shifted in from the left, giving a large positive result instead
of the desired divide-by power-of-2.  Fix this by operating on the
absolute value and compensating for the possible negation later.

Reverse the order of the underflow/overflow tests and the exponential
decay calculation to avoid the possibility of an erroneous overflow
detection if p is a sufficiently small non-negative value.  Also
check for negative values of prob before doing the exponential decay
to avoid another instance of of right shifting a negative value.

Tested by: Rasool Al-Saadi <ralsaadi@swin.edu.au>

git-svn-id: svn://svn.freebsd.org/base/stable/10@318886 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318863:
jlh [Thu, 25 May 2017 09:34:29 +0000 (09:34 +0000)]
MFC r318863:
  Replace stale handbook URL with the proper oneb.

git-svn-id: svn://svn.freebsd.org/base/stable/10@318865 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318014, r318091, r318125, and r318263.
np [Thu, 25 May 2017 02:00:37 +0000 (02:00 +0000)]
MFC r318014, r318091, r318125, and r318263.

r318014:
cxgbe(4): Fixes related to the knob that controls link autonegotiation.

- Do not leak the adapter lock in sysctl_autoneg.
- Accept only 0 or 1 as valid settings for autonegotiation.
- A fixed speed must be requested by the driver when autonegotiation is
  disabled otherwise the firmware will reject the l1cfg command.  Use
  the top speed supported by the port for now.

r318091:
cxgbe(4): Do not assume that if_qflush is always followed by inteface-down.

r318125:
Adjust whitespace and fix a comment.  No functional change.

r318263:
cxgbe(4): netmap-only interrupts for a VI do not have an associated rxq
or ofld_rxq and should be ignored by vi_intr_iq.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@318855 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r318646:
gjb [Thu, 25 May 2017 01:45:43 +0000 (01:45 +0000)]
MFC r318646:
 Allow PORTSDIR to be overridden in the pkg-stage target.

PR: 218393
Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/10@318853 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

6 years agoMFC r317702, r317847, r318307
np [Thu, 25 May 2017 01:43:28 +0000 (01:43 +0000)]
MFC r317702, r317847, r318307

r317702:
cxgbe(4): Support routines for Tx traffic scheduling.

- Create a new file, t4_sched.c, and move all of the code related to
  traffic management from t4_main.c and t4_sge.c to this file.
- Track both Channel Rate Limiter (ch_rl) and Class Rate Limiter (cl_rl)
  parameters in the PF driver.
- Initialize all the cl_rl limiters with somewhat arbitrary default
  rates and provide routines to update them on the fly.
- Provide routines to reserve and release traffic classes.

r317847:
cxgbe(4): The Tx scheduler initialization either works or doesn't.  It
doesn't need a refresh in either case.

r318307:
cxgbe(4): Avoid an out of bounds access when an attempt to unbind a tx
queue from a traffic class fails.

Sponsored by: Chelsio Communications

git-svn-id: svn://svn.freebsd.org/base/stable/10@318851 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f