xref: /netbsd-src/external/gpl3/gcc/dist/libphobos/libdruntime/core/sys/linux/sys/file.d (revision 0a3071956a3a9fdebdbf7f338cf2d439b45fc728)
1 /**
2  * D header file for Linux file ops.
3  *
4  * Copyright: Copyright Nemanja Boric 2016.
5  * License:   $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
6  * Authors:   Nemanja Boric
7  */
8 module core.sys.linux.sys.file;
9 
10 version (linux):
11 extern (C):
12 nothrow:
13 @nogc:
14 
15 /* Operations for the `flock' call. */
16 /// Shared lock
17 enum LOCK_SH              = 0x01;
18 /// Exclusive lock
19 enum LOCK_EX              = 0x02;
20 /// Unlock
21 enum LOCK_UN              = 0x08;
22 
23 /// Don't block when locking.
24 /// Can be OR'd into one of the above.
25 enum LOCK_NB              = 0x04;
26 
27 /// Apply or remove an advisory lock on an open file
28 /// Params:
29 ///     fd = file to apply or remove lock from
30 ///     operation = lock operation to perform
31 /// Returns:
32 ///     0 on success, -1 on failure, with .errno
33 ///     set appropriately.
34 int     flock(int fd, int operation) @trusted;
35