xref: /netbsd-src/external/gpl3/gcc/dist/libphobos/libdruntime/core/sys/linux/fcntl.d (revision 0a3071956a3a9fdebdbf7f338cf2d439b45fc728)
1 module core.sys.linux.fcntl;
2 
3 public import core.sys.posix.fcntl;
4 
5 version (linux):
6 extern(C):
7 nothrow:
8 @system:
9 
10 // From linux/falloc.h
11 /// fallocate(2) params
12 enum {
13     /// Allocates and initializes to zero the disk space
14     /// within the specified range, but the file size
15     /// will not be modified.
16     FALLOC_FL_KEEP_SIZE = 0x01,
17     /// Deallocates space (i.e. creates a hole)
18     FALLOC_FL_PUNCH_HOLE = 0x02,
19     /// Newly allocated blocks will be marked as initialized.
20     FALLOC_FL_NO_HIDE_STALE = 0x04,
21     /// Removes a byte range from a file, without leaving a hole
22     FALLOC_FL_COLLAPSE_RANGE = 0x08,
23     /// Zeroes space in the specified byte range
24     FALLOC_FL_ZERO_RANGE = 0x10,
25     /// Increases the file space by inserting a hole
26     /// without overwriting any existing data
27     FALLOC_FL_INSERT_RANGE = 0x20,
28     /// Used to unshare shared blocks within
29     /// the file size without overwriting any existing data
30     FALLOC_FL_UNSHARE_RANGE = 0x40
31 }
32 
33 // From asm-generic/fcntl.h
34 /**
35 
36 Open File Description locks
37 
38 Usually record locks held by a process are released on *any* close and are
39 not inherited across a fork().
40 
41 These cmd values will set locks that conflict with process-associated
42 record  locks, but are "owned" by the open file description, not the
43 process. This means that they are inherited across fork() like BSD (flock)
44 locks, and they are only released automatically when the last reference to
45 the the open file against which they were acquired is put.
46 
47 */
48 enum
49 {
50     /// Queries the system if the lock could be placed
51     F_OFD_GETLK  = 36,
52     /// Acquires or releases an open file description lock
53     F_OFD_SETLK  = 37,
54     /// Same as F_OFD_SETLK, but waits if a conflicting lock is held on the file
55     F_OFD_SETLKW = 38
56 }
57 
58 // Linux-specific fallocate
59 // (http://man7.org/linux/man-pages/man2/fallocate.2.html)
60 int fallocate(int fd, int mode, off_t offset, off_t len);
61