2 * $Id: lock.c,v 1.1 2004/11/14 07:26:26 paulus Exp $
4 * Copyright (C) 1997 Lars Fenneberg
6 * See the file COPYRIGHT for the respective terms and conditions.
7 * If the file is missing contact me at lf@elemental.net
8 * and I'll send you a copy.
16 int do_lock_exclusive(int fd)
21 memset((void *)&fl, 0, sizeof(fl));
24 fl.l_whence = fl.l_start = 0;
25 fl.l_len = 0; /* 0 means "to end of file" */
27 res = fcntl(fd, F_SETLK, &fl);
29 if ((res == -1) && (errno == EAGAIN))
39 memset((void *)&fl, 0, sizeof(fl));
42 fl.l_whence = fl.l_start = 0;
43 fl.l_len = 0; /* 0 means "to end of file" */
45 return fcntl(fd, F_SETLK, &fl);