summary refs log tree commit diff
path: root/src/lock_exnb.c
blob: 9ec2b9c42aa473d463a75b1f779de97fac3e1e69 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
/* Public domain. */

#include <sys/types.h>
#include <sys/file.h>
#include <fcntl.h>
#include "hasflock.h"
#include "lock.h"

#ifdef HASFLOCK
int lock_exnb(int fd) { return flock(fd,LOCK_EX | LOCK_NB); }
#else
int lock_exnb(int fd) { return lockf(fd,2,0); }
#endif