rustit/mirror_runit/runit-2.1.2/src/lock_ex.c
2024-03-24 23:51:57 +00:00

13 lines
252 B
C

/* Public domain. */
#include <sys/types.h>
#include <sys/file.h>
#include <fcntl.h>
#include "hasflock.h"
#include "lock.h"
#ifdef HASFLOCK
int lock_ex(int fd) { return flock(fd,LOCK_EX); }
#else
int lock_ex(int fd) { return lockf(fd,1,0); }
#endif