merge some code originally in the FreeBSD repository
import the change for FreeBSD to use sxlock as NMG, and pspare or not
remove old code