2 ** Copyright 1998 - 1999 Double Precision, Inc. See COPYING for
3 ** distribution information.
10 #include <sys/types.h>
15 #include <sys/fcntl.h>
25 int ll_lockfd(int fd
, int ltype
, LL_OFFSET_TYPE start
, LL_OFFSET_TYPE len
)
29 if (ltype
& ll_whence_curpos
)
30 p
=lseek(fd
, start
, SEEK_CUR
);
31 else if (ltype
&& ll_whence_end
)
32 p
=lseek(fd
, start
, SEEK_END
);
33 else p
=lseek(fd
, start
, SEEK_SET
);
35 if (p
< 0) return (-1);
37 if (lockf(fd
, ltype
& ll_unlock
? F_ULOCK
:
38 ltype
& ll_wait
? F_LOCK
:F_TLOCK
, len
))
40 lseek(fd
, p
, SEEK_SET
);
43 lseek(fd
, SEEK_SET
, p
);