Running io-sock with Diagnostic Features
The io-sock network stack, networking drivers, and modules are also
provided in diagnostic versions. They have the same name as the standard version with a
-diag
suffix: io-sock-diag,
devs-em-diag.so, and so on.
Use the diagnostic versions of the binaries when you are developing a new io-sock driver or module. They include extra checks and some useful macros and functions are only enabled in the diagnostic versions (e.g., KASSERT, mtx_assert). Because they use significantly more system resources than the standard versions, you shouldn't use them during performance testing or in production systems.
Specifying the diagnostic stack and drivers
When you use the diagnostic versions of io-sock or networking drivers, you also must use diagnostic versions of the driver or stack because the added checks require extra information that is passed between stack and driver.
When you specify a driver with the io-sock-diag command, the appropriate diagnostic driver is loaded automatically. For example, the following command loads devs-em-diag.so:
io-sock-diag -m pci -d em
The diagnostic driver is also automatically loaded when you load a driver using mount and specify the driver using its short name. For example, if io-sock-diag is running, the following command loads devs-em-diag.so (assuming the driver for PCI bus devices was started earlier):
mount -T io-sock em
But if you run io-sock-diag and specify the full name of the driver, make sure you specify the diagnostic driver. For example:
mount -T io-sock /lib/dll/devs-em-diag.so
Writing diagnostic network drivers
For diagnostic versions of io-sock network drivers, the following defines are set automatically by the devs.mk file (which is included by the network driver recursive makefile):
CCFLAGS+= -DINVARIANTS -DINVARIANT_SUPPORT -DKTR
Running io-sock-diag in the foreground
Specify -o foreground with io-sock-diag to stop io-sock from becoming a daemon. This option is valid only with io-sock-diag. As with standard io-sock, all logs are sent to slogger2. You can use -o foreground in combination with the DL_DEBUG environment variable to debug library loading issues.