DTrace's pid provider works by inserting breakpoint instructions at probe
sites and installing a hook at the kernel's trap handler. The fasttrap code
will emulate the overwritten instruction in some common cases, but otherwise
copies it out into some scratch space in the traced process' address space
and ensures that it's executed after returning from the trap.

In Solaris and illumos, this (per-thread) scratch space comes from some
reserved space in TLS, accessible via the fs segment register. This
approach is somewhat unappealing on FreeBSD since it would require some
modifications to rtld and jemalloc (for static TLS) to ensure that TLS is
executable, and would thus introduce dependencies on their implementation
details. I think it would also be impossible to safely trace static binaries
compiled without these modifications.

This change implements the functionality in a different way, by having
fasttrap map pages into the target process' address space on demand. Each
page is divided into 64-byte chunks for use by individual threads, and
fasttrap's process descriptor struct has been extended to keep track of
any scratch space allocated for the corresponding process.

With this change it's possible to trace all libc functions in a program,
e.g. with

  pid$target:libc.so.*::entry {@[probefunc] = count();}

Previously this would generally cause the victim process to crash, as
tracing memcpy on amd64 requires the functionality described above.

Tested by:	Prashanth Kumar <pra_udupi@yahoo.co.in> (earlier version)
MFC after:	6 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264434 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Ensure that all eight syscall arguments are available to dtrace_probe(),
rather than just the first five. This is done by calling dtrace_probe()
through a function pointer, as in illumos.

MFC after:	3 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264435 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix some off-by-one errors. The kve_end and rdl_eaddr fields contain the
first address after the end of the map entry and should therefore be
excluded.

MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264436 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix typo in debug/log statement.

Submitted by:	Rick Miller <vmiller@hostileadmin.com>


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264448 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
- Move davidxu to the alumni section

Approved by:	core (implicit)


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

PR:		188582
Submitted by:	Michael Hall
MFC after:	3 days


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264453 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
units(1): add libedit support

Add line editing and history support to units(1) via libedit.

Reviewed by:	bdrewery


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264458 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
units(1): parse config file after setting defaults

Parse the config file after setting the defaults to permit the user to change
things (e.g., editing mode)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264459 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Document the xdev* targets.

PR:		188519
Submitted by:	Idwer Vollering <vidwer at gmail.com>
Reviewed by:	bapt
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264460 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Commit various fixes for the SolarFlare drivers, in particular
this set of patches fixes support for systems with > 32 cores.

Details include

sfxge: RXQ index (not label) comes from FW in flush done/failed events

Change the second argument name of the efx_rxq_flush_done_ev_t and
efx_rxq_flush_failed_ev_t prototypes to highlight that RXQ index (not label)
comes from FW in flush done and failed events.

sfxge: TXQ index (not label) comes from FW in flush done event

Change the second argument name of the efx_txq_flush_done_ev_t prototype to
highlight that TXQ index (not label) comes from FW in flush done event.

sfxge: use TXQ type as label to support more than 32 TXQs

There are 3 TXQs in event queue 0 and 1 TXQ (with TCP/UDP checksum offload)
in all other event queues.

Submitted by:	Andrew Rybchenko <Andrew.Rybchenko at oktetlabs.ru>
Sponsored by:   Solarflare Communications, Inc.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264461 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
units(1): support reading multiple units files

GNU units(1) supports reading up to 25 -f options.  We support an arbitrary
number.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264462 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
units(1): Add U option

For increased compatibility with GNU units: support a -U option which tests for the
existence of the default units file and prints it to the screen.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264463 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Prefer /etc/login.conf for some of these environment values.

PR:		conf/186085
Reported by:	Glen Neff <glen.neff@emc.com>
MFC after:	2 weeks
Sponsored by:	EMC


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264465 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Fix err() usage in libcapsicum(3) example.

MFC after:	3 days
Sponsored by:	The FreeBSD Foundation


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264466 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Take into account when zpool history block grows exceeding 128KB in zpool(8)
and zdb(8) by growing the buffer on demand with a cap of 1GB (specified in
spa_history_create_obj()).

PR:		bin/186574
Submitted by:	Andrew Childs <lorne cons org nz> (with changes)
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264467 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Add support for emulating the slave PIC.

Reviewed by:	grehan, jhb
Approved by:	grehan (co-mentor)


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264468 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Lagg did not set the value of if_hw_tsomax, so when lagg
was stacked on top of network interfaces that set if_hw_tsomax,
tcp_output() would see the default value instead of the value
set by the network interface(s). This patch modifies lagg so that
it sets if_hw_tsomax to the minimum of the value(s) for the
underlying network interfaces.

Reviewed by:	glebius
MFC after:	2 weeks


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264469 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
units(1): Add v option: verbose

For increased compatibility with GNU units: support a -v option which
produces more verbose output when spitting out the answer.
GNU -v does additional work in the version, information, and check output which
we do not (yet?) replicate.


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264470 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Refine r264422: set buf to NULL only when we don't allocate memory,
and free buf unconditionally.

Requested by:	kib
MFC after:	1 week


git-svn-id: svn+ssh://svn.freebsd.org/base/head@264471 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
units(1): Add 'static' and sort list.

Inspired by:	DragonflyBSD


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