The lockf(1) manpage documents that EX_UNAVAILABLE is returned if -n is used and the lock file does not exist. This is not the case: $ lockf -n /tmp/doesnotexist echo; echo $? lockf: cannot open /tmp/doesnotexist: No such file or directory 73 EX_CANTCREAT (73) is returned instead.
A commit references this bug: Author: avos Date: Wed Mar 20 07:40:39 UTC 2019 New revision: 345318 URL: https://svnweb.freebsd.org/changeset/base/345318 Log: lockf(1): return EX_UNAVAILABLE if -n is used and the lock file does not exist Apply EX_UNAVAILABLE patch part from PR 170775 to match the documentation. Checked with a command from PR 210770: lockf -n /tmp/doesnotexist echo; echo $? PR: 210770 MFC after: 1 week Changes: head/usr.bin/lockf/lockf.c
A commit references this bug: Author: avos Date: Wed Mar 27 08:56:00 UTC 2019 New revision: 345569 URL: https://svnweb.freebsd.org/changeset/base/345569 Log: MFC r345318: lockf(1): return EX_UNAVAILABLE if -n is used and the lock file does not exist Apply EX_UNAVAILABLE patch part from PR 170775 to match the documentation. Was checked with a command from PR 210770: lockf -n /tmp/doesnotexist echo; echo $? PR: 210770 Changes: _U stable/10/ stable/10/usr.bin/lockf/lockf.c _U stable/11/ stable/11/usr.bin/lockf/lockf.c _U stable/12/ stable/12/usr.bin/lockf/lockf.c