MFC: Small textdump enhancements.

Bring this into TrueNAS so that we can textdump successfully.

Details:

Allow textdumps to be called explicitly from DDB.

If "dump" is called in DDB and textdumps are enabled then abort the
dump and tell the user to turn off textdumps.

Add options TEXTDUMP_PREFERRED to turn textdumps on by default.
Add options TEXTDUMP_VERBOSE to be a bit more verbose while textdumping.

(cherry picked from commit cd0388b11405d2b867570a1cda97a2bc7e5ac3eb)
Include <signal.h> (for SIGINFO).

(cherry picked from commit ab024da22a5794cc5f63022f338a6383990226d6)
Whitespace cleanups.

(cherry picked from commit 495e41102c22ac36eaafd71701b1b83781d1653c)
If we are not going to clear the dump (we are either just checking if the dump
exists or we want to keep it), open device read-only.

Obtained from:	WHEEL Systems

(cherry picked from commit be35b917f67c88f9817e7d11a1ea3ed4df4c8212)
The clear option (-c) is not compatible with keep (-k) and compress (-z)
options.

Obtained from:	WHEEL Systems

(cherry picked from commit ce1012669cdccdfc0e70feb7c62b2136647e82ca)
- When checking if a dump exists on the given device there is no need to
  provide dump directory. Eliminate this redundant argument. This changes
  the usage, but the only risk here is that a warning will be printed
  about directory given as device.

- Update usage of -C option.

- When clearing dump header from the given device there is also no need to
  provide dump directory, although additional arguments for -c were not
  documented.

- Document that -v can be used with -c and that list of devices can be given.

Obtained from:	WHEEL Systems

(cherry picked from commit dc8ab61e9c62eec7d16c948a025e8ceec7b590fc)
Prefer snprintf() over sprintf().

Obtained from:	WHEEL Systems

(cherry picked from commit ddfe29309ef68b36aa0f1898a9dca5bf0c7aac90)
Sort flags properly.

Obtained from:	WHEEL Systems

(cherry picked from commit 37dd69b3e656a89b97eca508296dd403cff77927)
Make use of the fact that we changed working directory to the dump directory
earlier.

Obtained from:	WHEEL Systems

(cherry picked from commit 2aa50c8f24afae7dbda69ae0e2acacc3aee678bf)
Implement -m option to savecore(8) that allows to limit number of kernel
dumps stored. Once the limit is reached it restarts from 0.

Reviewed by:	avg
Obtained from:	WHEEL Systems

(cherry picked from commit 633161ebf78b621835b557c32d93841472af8fbd)
With rotating kernel dumps the higest dump number is not necessarily the
last one. To make it easier to find the last one create symlinks with 'last'
suffix that will point to the files of the last coredump, eg.:

	info.last -> info.5
	textdump.tar.last.gz -> textdump.tar.5.gz

Reviewed by:	avg
Obtained from:	WHEEL Systems

(cherry picked from commit 70ddcff59410dc7dea0530da85c24e9f8aa699df)