Having a man page disappear before the read the end (if it indeed appears
at all) is pretty annoying. Equally annoying is using the "more" command
on a file with few lines only to see nothing. The default behavior of
xterm console had few fans.

This removes the smcup and rmcup codes from xterm-basic, the basis for
the xterm console definitions. Now man pages are left on the screen
after viewing, and the pagers work as expected.

* Start reworking the APIs to accomodate routed messages. Start by
creating a hammer2_router structure and adjusting most of the msg
functions to pass it instead of the iocom.

* Fix hammer2_state races by moving the state allocation to
hammer2_msg_alloc() instead of hammer2_msg_write(). This gives
code a chance to assign the state->any.* field without having to
worry about the state getting ripped out from under us.

* Because we allow loops in the graph the loss of a feeder node can
result in a tail-chasing loop of SPAN updates with an ever-growing
distance parameter.

To deal with this a spanning tree distance limit is required, beyond
which no propagation occurs which terminates the chase. The tail
then catches up to the head and the node is finally removed from
the spanning tree entirely.

This fixes the propagation of spanning tree deletions e.g. when we
umount a HAMMER2 PFS.

* Fix a state insertion bug. A structure was being inserted into the
red-black tree before the required fields were being initialized.
Corrects a SPAN propagation fault.

The RX max coalesce BDs is limited to 255, which means that the chip will
generate ~5800 interrupts/s when it sinks 1.48Mpps tiny packets. However,
interrupt rate at 4000Hz is already enough for the chip to sink 1.48Mpps
tiny packets, so ticks based RX interrupt moderation should be prefered.

- Use ifnet serializer to protect driver data. This should fix the
various panics that were observed on the network output path.
- Fix busdma setup.
- Always allocate the descriptor rings and status blocks at the lower
4GB. The original way will require the RX/TX bufs to be located at
the lower 4GB, which is a great waste of bounce buffers, cpu cycles
and memory bandwidth.
- Don't mess up M_PKTHDR on RX path.
- Allocate mbuf w/ MB_WAIT on initialization path.
- Enable MSI by default.

Without the macro SET_NEED_WCHAR_H defined, the ncurses header will not
include wchar.h which is where the wint_t type is defined. This breaks
any program loading ncurses.h without defining this macro because several
functions use the wint_t type.

Define wint_t as int if wchar.h isn't included. This fixes the ncurses
check on several pkgsrc configuration checks and allows the package to
build with the system ncurses.

TODO: Issue higher level protocol transaction messages over these
circuits based on VNOPS, caching, mirroring, etc.
(transactional failures can occur when the LNK_SPAN state
changes, forcing a retry, etc).

* Userland now accepts the LNK_CONN and uses the open transaction to
install tracking structures for those connections participating in
the SPAN protocol.

* Userland now installs tracking structures for received SPAN messages.

* Start fleshing out the userland side of the SPAN relay/transmit code.
This will involve yet more structures to track which SPANs are being
relayed over each connection, so changes can be propagated (not yet
implemented).

With the recent O_DIRECTORY addition, this apparent bug in the script was
exposed. Using -isysroot/-isystem doesn't seem to cut it for what we want
here (which is to completely override the /usr/include path).

I didn't verify in 100% detail, but all evidence looks like the reason is
that when -I is present on the command line, the paths of the headers
which are included by headers from this directory are not prefixed with
-isysroot's argument.

So for now, use -iprefix and -iwithbeforeprefix for /usr/include, which
seem to do what we want.

* Using fcntl(2) just after open(2) is not enough to avoid race conditions
in programs doing fork+exec sequences. Child processes may be created
before fcntl() is run and inherit the parent's file descriptors.

* In some circonstances this behavior may even create security issues.

* O_CLOEXEC can be used to atomically set the close-on-exec flag for new
file descriptors, avoiding the whole mess in the first place.

Whenever we messed with our ioctls or certain definitions
(like fcntl(2)'s O_* flags), kdump and truss could break
quickworld because their generated ioctl.c and kdump_subr.c
files in /usr/obj would still have removed stuff.