use getopt to parse options, add one option to set
the wait time for link-up events


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234168 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
use correct selinfo pointer for the generic interrupt handler
(it is never used in current FreeBSD drivers).


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234169 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Propagate the current state of rtld_bind_lock to dlopen_object() calls
through the filter loading call chain. This fixes attempts to
write-lock the already locked rtld_bind_lock when filter loading is
initiated by relocation of dlopening dso.

Reported and tested by:	Taku YAMAMOTO <taku tackymt homeip net>
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234170 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
remove an unnecessary #define


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234171 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add thread-private flag to indicate that error value is already placed
in td_errno. Flag is supposed to be used by syscalls returning
EJUSTRETURN because errno was already placed into the usermode frame
by a call to set_syscall_retval(9). Both ktrace and dtrace get errno
value from td_errno if the flag is set.

Use the flag to fix sigsuspend(2) error return ktrace records.

Requested by:	bde
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234172 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Keep a copy of the original pointer returned by openpam_readline() so
we can free it later, instead of trying to free a pointer that points
to the end of the buffer.

Committed to head because this code no longer exists upstream.

Submitted by:	jasone@


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234173 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Some code restructuring to bring the memory allocator out of netmap.c
and make it easier to replace it with a different implementation.
On passing, also fix indentation.

NOTE: I know that #include "foo.c" is ugly, but the alternative
(add another entry to sys/conf/files, add a separate header with
structs and prototypes, and expose functions that are meant to
be private) looks even worse to me.
We need a more modular way to specify dependencies and build options.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234174 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Read backup GPT header from the last LBA only when primary GPT header and
table aren't valid. If they are ok, use hdr_lba_alt value to read backup
header. This will make gptboot happy when GPT used atop of some GEOM
provider, e.g. GEOM_MIRROR.

Reviewed by:	pjd
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234176 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Refactor da(4) to remove one of two code paths used to query capacity
data.

Reviewed by:	ken, mav (earlier version)
Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234177 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Remove block reallocation used to make room for the cylinder group
summary structure.  From now on, when there is no room for it,
we simply allocate new one in a newly added cylinder group.

This patch removes a conditional in updcsloc(), reindents some code
there, and removes unused routines.  I decided to do it this way instead
of disabling reallocation when the filesystem is live and leaving it
as it is otherwise, because this allows for removal of lots of complicated
and hard to test code.  Also, conditionally disabling it would result
in a different layout in filesystems resized online and offline, which
would look somewhat weird.

Reviewed by:		mckusick
No objections from:	kib
Sponsored by:		The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234178 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Don't update if_obytes when transmitting packets.  That is already done
in IFQ_HANDOFF() when the packet is passed to the start routine, so doing
it here resulted in double counting.

Reported by:	Alex Tutubalin  lexa lexa ru
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234182 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add OFED and the associated options and drivers to x86 LINT builds:
- Mark 'sdp' as requiring 'inet'.
- Always include "opt_inet.h" and "opt_inet6.h" and modify the IB
  driver Makefiles to honor WITH/WITHOUT_INET/INET6/_SUPPORT options
  to determine what should be enabled during a module build.
- Fix the mlxen(4) driver and the core IB code to compile without
  if INET is disabled (including when both INET and INET6 are disabled).

Reviewed by:	bz
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234183 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix error messages containing the executed command name

Before, we took the first argument to pam_exec(8). With the addition of
options in front of the command, this could be wrong.

Now, options are parsed before calling _pam_exec() and messages contain
the proper command name.

While here, fix a warning.

Sponsored by:	Yakaz (http://www.yakaz.com)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234184 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Apparently the length field in advanced descriptors
does not include the CRC irrespective of the setting
of CRCSTRIP. The 82599 data sheets (sec. 7.1.6) say differently.
Very strange. Need to check what happens on legacy descriptors,
but for the time being this restores functionality.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234185 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
If a linker file contains at least one module, but all of the modules
fail to load (the MOD_LOAD event fails) during a kldload(2), unload the
linker file and fail the kldload(2) with ENOEXEC.

Reported by:	gcooper
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234186 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Update the swi_add prototype after struct ithd was split up into
struct intr_event and struct intr_thread.

PR:		docs/166864
Reviewed by:	jhb (older version)
MFC after:	1 week


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


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234189 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
- Extend the KDB interface to add a per-debugger callback to print a
  backtrace for an arbitrary thread (rather than the calling thread).
  A kdb_backtrace_thread() wrapper function uses the configured debugger
  if possible, otherwise it falls back to using stack(9) if that is
  available.
- Replace a direct call to db_trace_thread() in propagate_priority()
  with a call to kdb_backtrace_thread() instead.

MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234190 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add missing LibUSB 1.0 API function.

Reported by:	lme @
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@234193 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Complete polled-mode operation by using a callout if the device will be
used in polled-mode. The callout invokes uart_intr, which rearms the timeout.
Implemented for bhyve, but generically useful for e.g. embedded bringup
when the interrupt controller hasn't been setup, or if it's not deemed
worthy to wire an interrupt line from a serial port.

Submitted by:	neel
Reviewed by:	marcel
Obtained from:	NetApp
MFC after:	3 weeks


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