- Make sure random_adaptor accesses happen only when
   random_adaptors_lock is held.
 - Use sx_sleep instead of tsleep in read and write path to allow
   another thread that registers a new random adapter when waiting.
   Assert that random_adaptor is not NULL after reacquiring the lock.
 - Capture EINTR/ERESTART from sx_sleep to allow the blocking cycle be
   stopped when user requests so, while there also make short
   read/write's return 0.
 - Move M_WAITOK allocations out of lock scope.

In collobration with:	kib, markm, ian, jilles
Reviewed by:	kib, markm
Approved by:	so


git-svn-id: svn+ssh://svn.freebsd.org/base/head@273997 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Do not try to create a /dev/log symlink in a jail.

PR:	179828


git-svn-id: svn+ssh://svn.freebsd.org/base/head@273999 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix up some session-related races in devfs.

One was introduced with r272596, the rest was there to begin with.

Noted by: jhb


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274000 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
filedesc: create a dedicated zone for struct filedesc0

Currently sizeof(struct filedesc0) is 1096 bytes, which means allocations from
malloc use 2048 bytes.

There is no easy way to shrink the structure <= 1024 an it is likely to grow in
the future.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274005 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Don't assert random_adaptors_lock in random_adaptor_read_rate().

Reported by:	many
Pointy hat to:	delphij (for not testing the commit with WITNESS)
Approved by:	so


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274006 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
filedesc: plug unnecessary fdp NULL checks in fdescfreee and fdcopy

Anything reaching these functions has fd table.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274007 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Integrate usr.sbin/useradd/t_useradd.sh from NetBSD into FreeBSD as pw_test

- Suffix useradd/userdel commands with pw
- Remove the atf_expect_fail for bin/39546

Phabric: D921
Reviewed by: brd
Sponsored by: EMC / Isilon Storage Division


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274011 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
filedesc: plus sys/kdb.h include which crept in with r274007


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274012 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Integrate pjdfstest test suite execution into kyua

pjdfstest execution is opt-in and must be done as root due to some of the
assumptions made by the test suite and lack of error checking in the non-root
case

A description of how to execute pjdfstest with kyua is provided in
share/pjdfstest/README

Phabric: D824 (an earlier prototype patch)
MFC after: 1 month
Relnotes: yes
Sponsored by: EMC / Isilon Storage Division


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274016 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Provide an on-stack temporary buffer for small ioctl requests.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274017 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Reduce boot verbosity.

MFC:		3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274020 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove explicit KYUAFILE=yes from tests/sys/Makefile

This causes the directory traversing Kyuafile to be installed, which in turn
causes tests/sys/pjdfstest to always be run from /usr/tests/sys

Let KYUAFILE default to auto, so the file generated by suite.test.mk gets
installed instead

MFC after: 1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274021 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Require root when running the pw_delete and pw_modify test programs (pw(8)
requires it)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274022 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
When other end of the pipe closed during the write, but some bytes
were written, return short write instead of EPIPE.

Update comment.

Discussed with:	bde (long time ago)
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274023 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
drm: Take vt(4) default mode from loader tunables

By default, vt(4) gets the "preferred mode" from DRM, when using a DRM
video driver as its backend. The preferred mode is usually the native
screen resolution.

Now, if this mode isn't appropriate, a user can use loader tunables to
select a mode. The tunables are read in the following order:
    1. kern.vt.fb.modes.$connector_name
    2. kern.vt.fb.default_mode

For example, to set a 1024x768 mode, no matter the connector:
    kern.vt.fb.default_mode="1024x768"

To set a 800x600 mode only on the laptop builtin screen:
    kern.vt.fb.modes.LVDS-1="800x600"

MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274031 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
s/icl_pdu_new/icl_pdu_new_empty/g; no functional changes.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274033 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove check for obsolete FreeBSD versions

PR:		194517
Submitted by:	François Tigeot <ftigeot@wolfpond.org>


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274035 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
s/icl_pdu_new_bhs/icl_pdu_new/; no functional changes, just a little
nicer code.

Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274036 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Clean up confusing comment.  Move it to the place of code which is
talked about.  Explain where the mentioned trampoline located
(usermode), and the fact that attempt to exit last thread is denied in
kernel (by delegating the work to usermode).

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274038 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
agp_intel.c provides support for AGP on Intel chipsets from 440/BX to
875.  This intersects with the agp_i810.c, which supports all Intels
from i810 to Core i5/7.  Both agp_intel.c and agp_i810.c are compiled
into kernel when device agp is specified in config, and agp_i810
attach seems to be selected by chance due to linking order.

Strip support for 810 and later from agp_intel.c.  Since 440-class
chipsets do not support any long-mode capable CPUs, remove agp_intel.c
from amd64 kernel file list.  Note that agp_intel.c is not compiled
into agp.ko on amd64 already.

Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@274040 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f