The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
file.h File Reference

flock: advisory locks on whole files. More...

Go to the source code of this file.

Macros

#define LOCK_SH   1
#define LOCK_EX   2
#define LOCK_NB   4
#define LOCK_UN   8

Functions

int flock (int fd, int operation)
 take, change or release the lock of the file open as fd.

Detailed Description

flock: advisory locks on whole files.

a lock belongs to the open file (dup and fork share it) and goes when the file is unlocked or its last descriptor closes. the locks only stop other flock calls, not reads or writes.

Macro Definition Documentation

◆ LOCK_SH

#define LOCK_SH   1

◆ LOCK_EX

#define LOCK_EX   2

◆ LOCK_NB

#define LOCK_NB   4

◆ LOCK_UN

#define LOCK_UN   8

Function Documentation

◆ flock()

int flock ( int fd,
int operation )

take, change or release the lock of the file open as fd.

Returns
0, or -1 (errno: EWOULDBLOCK, EINTR, EBADF, EINVAL, ENOLCK).