The following is taken from some production code:
#ifdef LOCK_LOCKF
#ifdef HAVE_SYS_FILE_H
#include <sys/lockf.h>
#endif
#ifdef HAVE_SYS_FILE_H
#include <sys/file.h>
#endif
#define LOCK(file) fseek(file, 0L, 0), lockf(file, 1, 0L)
#define UNLOCK(file) fseek(file, 0L, 0), lockf(file, 0, 0L)
#endif /* LOCK_LOCKF */
#ifdef LOCK_LOCKING
#ifdef HAVE_SYS_LOCKING_H
#include <sys/locking.h>
#endif
#define LOCK(file) fseek(file, 0L, 0), chk_lock(file, 1)
#define UNLOCK(file) fseek(file, 0L, 0), chk_lock(file, 0)
#endif /* LOCK_LOCKING */
#ifdef LOCK_NONE
#define LOCK(file)
#define UNLOCK(file)
#endif /* LOCK_NONE */
Are the names LOCK_LOCKF, LOCK_LOCKING, and LOCK_NONE arbritrary? Ie, could they have been names LOCKF, LOCKING, and NONE instead?