Back to index

courier  0.68.2
Functions
lockflock.c File Reference
#include <sys/types.h>
#include <errno.h>
#include "liblock.h"

Go to the source code of this file.

Functions

int ll_lockfd (int fd, int ltype, LL_OFFSET_TYPE start, LL_OFFSET_TYPE len)

Function Documentation

int ll_lockfd ( int  fd,
int  ltype,
LL_OFFSET_TYPE  start,
LL_OFFSET_TYPE  len 
)

Definition at line 22 of file lockflock.c.

{
       if (start || len
              || (ltype & ll_whence_curpos)
              || (ltype & ll_whence_end))
       {
              errno=EINVAL;
              return (-1);
       }

       return (flock(fd, ltype & ll_unlock ? LOCK_UN:
              (ltype & ll_writelock ? LOCK_EX:LOCK_SH) |
              (ltype & ll_wait ? 0:LOCK_NB)));
}