Add support for sockstat on FreeBSD as an alternative to lsof

This fixes #18584.