netatalk  4.4.0
Free and Open Source Apple Filing Protocol (AFP) Server
Loading...
Searching...
No Matches
locking.c File Reference

Netatalk utility functions: locking. More...

#include <fcntl.h>
#include <unistd.h>
#include <atalk/util.h>

Functions

int lock_reg (int fd, int cmd, int type, off_t offset, int whence, off_t len)
 lock a file with fctnl

Detailed Description

Netatalk utility functions: locking.

Function Documentation

◆ lock_reg()

int lock_reg ( int fd,
int cmd,
int type,
off_t offset,
int whence,
off_t len )

lock a file with fctnl

This function is called via the macros: read_lock, write_lock, un_lock

Parameters
[in]fdFile descriptor
[in]cmdcmd to fcntl, only F_SETLK is usable here
[in]typeF_RDLCK, F_WRLCK, F_UNLCK
[in]offsetbyte offset relative to l_whence
[in]whenceSEEK_SET, SEEK_CUR, SEEK_END
[in]lenno. of bytes (0 means to EOF)
Returns
0 on success, -1 on failure with fcntl return value and errno
See also
read_lock, write_lock, unlock