Add ICONV_{GET,SET}_ILSEQ_INVALID iconvctl.  GNU iconv returns EILSEQ
when there is an invalid character in the output codeset while it is
valid in the input.  However, POSIX requires iconv() to perform an
implementation-defined conversion on the character.  So, Citrus iconv converts
such a character to a special character which means it is invalid in the
output codeset.

This is not a problem in most cases but some software like libxml2 depends
on GNU's behavior to determine if a character is output as-is or another form
such as a character entity (&#NNN;).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258537 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
- For kernel compiled only with KDTRACE_HOOKS and not any lock debugging
  option, unbreak the lock tracing release semantic by embedding
  calls to LOCKSTAT_PROFILE_RELEASE_LOCK() direclty in the inlined
  version of the releasing functions for mutex, rwlock and sxlock.
  Failing to do so skips the lockstat_probe_func invokation for
  unlocking.
- As part of the LOCKSTAT support is inlined in mutex operation, for
  kernel compiled without lock debugging options, potentially every
  consumer must be compiled including opt_kdtrace.h.
  Fix this by moving KDTRACE_HOOKS into opt_global.h and remove the
  dependency by opt_kdtrace.h for all files, as now only KDTRACE_FRAMES
  is linked there and it is only used as a compile-time stub [0].

[0] immediately shows some new bug as DTRACE-derived support for debug
in sfxge is broken and it was never really tested.  As it was not
including correctly opt_kdtrace.h before it was never enabled so it
was kept broken for a while.  Fix this by using a protection stub,
leaving sfxge driver authors the responsibility for fixing it
appropriately [1].

Sponsored by:	EMC / Isilon storage division
Discussed with:	rstone
[0] Reported by:	rstone
[1] Discussed with:	philip


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258541 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Comply to the XHCI specification. Certain input context fields should
always be zero.

MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258545 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add watchdog driver for rk3188.

Approved by: ray@


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258546 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add clock frequency for rk3188 watchdog.
Whilst here, replace "clocks" to "clock-frequency".

Approved by: ray@


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258547 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Enable reset mechanism for rk3188.

Approved by: ray@


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258548 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
drm: Dereference pointers given to qsort_r()'s cmp callback

drm_le_cmp() (qsort_r()'s callback) receives pointers to elements in the
array passed to qsort_r(), not the elements themselves.

Before this fix, the use of qsort_r() shuffled the array, not sorted it,
because the compare callback accessed random memory locations, not the
expected elements.

This bug triggered an infinite loop in KDE/xserver:

    1. KDE has a kded module called "randrmonitor" which queries xserver
       for current monitors at startup and then listens to RandR
       notifications from xserver.

    2. xserver handles the query from "randrmonitor" by polling the
       video device using the "drm_mode_getconnector()" ioctl. This
       ioctl returns a list of connectors and, for those with a
       connected monitor, the available modes. Each modes list is sorted
       by the kernel before returning. When xserver gets the connectors
       list, it sorts the modes lists again.

       In the case of this bug, when two modes are equal (in xserver's
       compare function PoV), their order is kept stable (ie. the
       kernel order is kept for those two modes). And because the list
       was shuffled by the kernel, the order of two equal modes was
       frequently changed in the final modes list in xserver.

    3. xserver compares the returned connectors list with the list
       obtained earlier. In particular, it compares the sorted
       modes lists for each connector. If a property of a connector
       changes (eg. modes), xserver sends a "RRNotify_OutputChange"
       notification.

       Because of the change of order between equal modes, xserver sent
       a notification after each polling of the connectors.

    4. "randrmonitor" receives a notification, triggered by its query. The
       notification doesn't contain the new connectors list, therefore, it
       asks for the new list using the same function: go back to step #2.

MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258549 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Do not create pkg.conf, as it is not necessary anymore and packagesite is deprecated

Reported by:	glebius
MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258550 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Install plain.test.mk.

This was missed when this file was first imported.  Its atf.test.mk
counterpart is already being installed and these are necessary if we
want "make" within the source tree (not via "buildworld") to work.

Approved by:	rpaulo (mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258551 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Generate plain sh test programs from a source file.

Instead of assuming that plain sh test programs exist in the source
tree in their final form and are marked as executable, generate them
from a list of sources.

By default, just assume that the source file for a program P is P.sh
but allow the caller to customize the inputs.  Similarly, also allow
the caller to apply sed(1) replacements on the output.  These will
both be useful in hooking existing test code from tools/regression/
into the test suite.

Approved by:	rpaulo (mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258552 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
drm: Fix build with gcc, broken with r258549

The code was easier to read without __DECONST and clang didn't report
any error. I thought the cast was enough...

MFC after:	3 days
X-MFC-With:	r258549


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258553 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFV r258386: 4322 ZFS deadlock on dp_config_rwlock

illumos/illumos-gate@c50d56f667f119d78fa3d94d6bef2c298ba556f6

This is a record-only commit as the the fix is already in FreeBSD as
ir258294.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258562 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Replace Sun RPC license with a 3-clause BSD license, with the explicit
permission of Sun Microsystems in 2009.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258564 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Import svn-1.8.5.  This contains a user-visible fix for svn:externals
handling (there are no svn:externals in freebsd repo), and two security
fixes for modules that we don't build for the apache http server stack.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258569 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Change sysinstall.8 references to bsdinstall.8.

Submitted by: skreuzer


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258570 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
pmc(3) does not document a dependency on <sys/types.h> but <pmc.h>
requires it, so include it explicitly from <pmc.h>.

MFC after:	1 month


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258572 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
MFV: removes strict-aliasing warnings from GCC in tcpdump.

Reported by:	tinderbox (gjb)
Submitted by:	glebius
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258573 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Only initialize some mutexes for the default VNET.

In r208160, sctp_it_ctl was made a global variable, across all VNETs.
However, sctp_init() is called for every VNET that is created.  This results
in the same global mutexes which are part of sctp_it_ctl being initialized.  This can result
in crashes if many jails are created.

To reproduce the problem:
  (1)  Take a GENERIC kernel config, and add options for: VIMAGE, WITNESS,
       INVARIANTS.
  (2)  Run this command in a loop:
       jail -l -u root -c path=/ name=foo persist vnet && jexec foo ifconfig lo0 127.0.0.1/8 && jail -r foo

       (see http://lists.freebsd.org/pipermail/freebsd-current/2010-November/021280.html )

Witness will warn about the same mutex being initialized.

Fix the problem by only initializing these mutexes in the default VNET.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258574 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Replace Sun RPC license in TI-RPC library with a 3-clause BSD license,
with the explicit permission of Sun Microsystems in 2009.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@258578 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add HPET device emulation to bhyve.

bhyve supports a single timer block with 8 timers. The timers are all 32-bit
and capable of being operated in periodic mode. All timers support interrupt
delivery using MSI. Timers 0 and 1 also support legacy interrupt routing.

At the moment the timers are not connected to any ioapic pins but that will
be addressed in a subsequent commit.

This change is based on a patch from Tycho Nightingale (tycho.nightingale@pluribusnetworks.com).


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