| 1 |
/** |
|---|
| 2 |
* D header file for POSIX. |
|---|
| 3 |
* |
|---|
| 4 |
* Copyright: Public Domain |
|---|
| 5 |
* License: Public Domain |
|---|
| 6 |
* Authors: Sean Kelly |
|---|
| 7 |
* Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition |
|---|
| 8 |
*/ |
|---|
| 9 |
module tango.stdc.posix.fcntl; |
|---|
| 10 |
|
|---|
| 11 |
private import tango.stdc.posix.config; |
|---|
| 12 |
private import tango.stdc.stdint; |
|---|
| 13 |
public import tango.stdc.stddef; // for size_t |
|---|
| 14 |
public import tango.stdc.posix.sys.types; // for off_t, mode_t |
|---|
| 15 |
public import tango.stdc.posix.sys.stat; // for S_IFMT, etc. |
|---|
| 16 |
public import tango.sys.consts.fcntl; |
|---|
| 17 |
extern (C): |
|---|
| 18 |
|
|---|
| 19 |
// |
|---|
| 20 |
// Required |
|---|
| 21 |
// |
|---|
| 22 |
/* |
|---|
| 23 |
F_DUPFD |
|---|
| 24 |
F_GETFD |
|---|
| 25 |
F_SETFD |
|---|
| 26 |
F_GETFL |
|---|
| 27 |
F_SETFL |
|---|
| 28 |
F_GETLK |
|---|
| 29 |
F_SETLK |
|---|
| 30 |
F_SETLKW |
|---|
| 31 |
F_GETOWN |
|---|
| 32 |
F_SETOWN |
|---|
| 33 |
|
|---|
| 34 |
FD_CLOEXEC |
|---|
| 35 |
|
|---|
| 36 |
F_RDLCK |
|---|
| 37 |
F_UNLCK |
|---|
| 38 |
F_WRLCK |
|---|
| 39 |
|
|---|
| 40 |
O_CREAT |
|---|
| 41 |
O_EXCL |
|---|
| 42 |
O_NOCTTY |
|---|
| 43 |
O_TRUNC |
|---|
| 44 |
|
|---|
| 45 |
O_APPEND |
|---|
| 46 |
O_DSYNC |
|---|
| 47 |
O_NONBLOCK |
|---|
| 48 |
O_RSYNC |
|---|
| 49 |
O_SYNC |
|---|
| 50 |
|
|---|
| 51 |
O_ACCMODE |
|---|
| 52 |
O_RDONLY |
|---|
| 53 |
O_RDWR |
|---|
| 54 |
O_WRONLY |
|---|
| 55 |
|
|---|
| 56 |
struct flock |
|---|
| 57 |
{ |
|---|
| 58 |
short l_type; |
|---|
| 59 |
short l_whence; |
|---|
| 60 |
off_t l_start; |
|---|
| 61 |
off_t l_len; |
|---|
| 62 |
pid_t l_pid; |
|---|
| 63 |
} |
|---|
| 64 |
|
|---|
| 65 |
int creat(in char*, mode_t); |
|---|
| 66 |
int fcntl(int, int, ...); |
|---|
| 67 |
int open(in char*, int, ...); |
|---|
| 68 |
*/ |
|---|
| 69 |
version( linux ) |
|---|
| 70 |
{ |
|---|
| 71 |
|
|---|
| 72 |
struct flock |
|---|
| 73 |
{ |
|---|
| 74 |
short l_type; |
|---|
| 75 |
short l_whence; |
|---|
| 76 |
off_t l_start; |
|---|
| 77 |
off_t l_len; |
|---|
| 78 |
pid_t l_pid; |
|---|
| 79 |
} |
|---|
| 80 |
|
|---|
| 81 |
static if( __USE_LARGEFILE64 ) |
|---|
| 82 |
{ |
|---|
| 83 |
int creat64(in char*, mode_t); |
|---|
| 84 |
alias creat64 creat; |
|---|
| 85 |
|
|---|
| 86 |
int open64(in char*, int, ...); |
|---|
| 87 |
alias open64 open; |
|---|
| 88 |
} |
|---|
| 89 |
else |
|---|
| 90 |
{ |
|---|
| 91 |
int creat(in char*, mode_t); |
|---|
| 92 |
int open(in char*, int, ...); |
|---|
| 93 |
} |
|---|
| 94 |
} |
|---|
| 95 |
else version( darwin ) |
|---|
| 96 |
{ |
|---|
| 97 |
struct flock |
|---|
| 98 |
{ |
|---|
| 99 |
off_t l_start; |
|---|
| 100 |
off_t l_len; |
|---|
| 101 |
pid_t l_pid; |
|---|
| 102 |
short l_type; |
|---|
| 103 |
short l_whence; |
|---|
| 104 |
} |
|---|
| 105 |
|
|---|
| 106 |
int creat(in char*, mode_t); |
|---|
| 107 |
int open(in char*, int, ...); |
|---|
| 108 |
} |
|---|
| 109 |
else version( freebsd ) |
|---|
| 110 |
{ |
|---|
| 111 |
struct flock |
|---|
| 112 |
{ |
|---|
| 113 |
off_t l_start; |
|---|
| 114 |
off_t l_len; |
|---|
| 115 |
pid_t l_pid; |
|---|
| 116 |
short l_type; |
|---|
| 117 |
short l_whence; |
|---|
| 118 |
} |
|---|
| 119 |
|
|---|
| 120 |
int creat(in char*, mode_t); |
|---|
| 121 |
int open(in char*, int, ...); |
|---|
| 122 |
} |
|---|
| 123 |
else version( solaris ) |
|---|
| 124 |
{ |
|---|
| 125 |
struct flock |
|---|
| 126 |
{ |
|---|
| 127 |
short l_type; |
|---|
| 128 |
short l_whence; |
|---|
| 129 |
off_t l_start; |
|---|
| 130 |
off_t l_len; /* len == 0 means until end of file */ |
|---|
| 131 |
int l_sysid; |
|---|
| 132 |
pid_t l_pid; |
|---|
| 133 |
c_long[4] l_pad; /* reserve area */ |
|---|
| 134 |
} |
|---|
| 135 |
|
|---|
| 136 |
int creat(in char*, mode_t); |
|---|
| 137 |
int open(in char*, int, ...); |
|---|
| 138 |
|
|---|
| 139 |
static if( __USE_LARGEFILE64 ) |
|---|
| 140 |
{ |
|---|
| 141 |
alias creat creat64; |
|---|
| 142 |
alias open open64; |
|---|
| 143 |
} |
|---|
| 144 |
} |
|---|
| 145 |
|
|---|
| 146 |
//int creat(in char*, mode_t); |
|---|
| 147 |
int fcntl(int, int, ...); |
|---|
| 148 |
//int open(in char*, int, ...); |
|---|
| 149 |
|
|---|
| 150 |
// |
|---|
| 151 |
// Advisory Information (ADV) |
|---|
| 152 |
// |
|---|
| 153 |
/* |
|---|
| 154 |
POSIX_FADV_NORMAL |
|---|
| 155 |
POSIX_FADV_SEQUENTIAL |
|---|
| 156 |
POSIX_FADV_RANDOM |
|---|
| 157 |
POSIX_FADV_WILLNEED |
|---|
| 158 |
POSIX_FADV_DONTNEED |
|---|
| 159 |
POSIX_FADV_NOREUSE |
|---|
| 160 |
|
|---|
| 161 |
int posix_fadvise(int, off_t, off_t, int); |
|---|
| 162 |
int posix_fallocate(int, off_t, off_t); |
|---|
| 163 |
*/ |
|---|