Q:

setlock analog for FreeBSD

Is there something similar to setlock available or built into FreeBSD?

A:

lockf - execute a command while holding a file lock. lockf should be already in the system.

