The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
file.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* @file sys/file.h
5
* @brief flock: advisory locks on whole files.
6
*
7
* a lock belongs to the open file (dup and fork share it) and goes when
8
* the file is unlocked or its last descriptor closes. the locks only stop
9
* other flock calls, not reads or writes.
10
*/
11
12
#define LOCK_SH 1
// a shared lock: others may hold shared locks too
13
#define LOCK_EX 2
// an exclusive lock: no one else holds one
14
#define LOCK_NB 4
// with LOCK_SH or LOCK_EX: fail with EWOULDBLOCK, do not wait
15
#define LOCK_UN 8
// release the lock
16
17
/**
18
* take, change or release the lock of the file open as fd.
19
* @return 0, or -1 (errno: EWOULDBLOCK, EINTR, EBADF, EINVAL, ENOLCK).
20
*/
21
int
flock
(
int
fd,
int
operation);
flock
int flock(int fd, int operation)
take, change or release the lock of the file open as fd.
src
libc
include
sys
file.h
Generated by
1.18.0