comparison tango/tango/stdc/posix/fcntl.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
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
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(char*, mode_t);
66 int fcntl(int, int, ...);
67 int open(char*, int, ...);
68 */
69 version( linux )
70 {
71 const F_DUPFD = 0;
72 const F_GETFD = 1;
73 const F_SETFD = 2;
74 const F_GETFL = 3;
75 const F_SETFL = 4;
76 static if( __USE_FILE_OFFSET64 )
77 {
78 const F_GETLK = 12;
79 const F_SETLK = 13;
80 const F_SETLKW = 14;
81 }
82 else
83 {
84 const F_GETLK = 5;
85 const F_SETLK = 6;
86 const F_SETLKW = 7;
87 }
88 const F_GETOWN = 9;
89 const F_SETOWN = 8;
90
91 const FD_CLOEXEC = 1;
92
93 const F_RDLCK = 0;
94 const F_UNLCK = 2;
95 const F_WRLCK = 1;
96
97 const O_CREAT = 0100;
98 const O_EXCL = 0200;
99 const O_NOCTTY = 0400;
100 const O_TRUNC = 01000;
101
102 const O_APPEND = 02000;
103 const O_NONBLOCK = 04000;
104 const O_SYNC = 010000;
105 const O_DSYNC = O_SYNC;
106 const O_RSYNC = O_SYNC;
107
108 const O_ACCMODE = 0003;
109 const O_RDONLY = 00;
110 const O_WRONLY = 01;
111 const O_RDWR = 02;
112
113 struct flock
114 {
115 short l_type;
116 short l_whence;
117 off_t l_start;
118 off_t l_len;
119 pid_t l_pid;
120 }
121 }
122 else version( darwin )
123 {
124 const F_DUPFD = 0;
125 const F_GETFD = 1;
126 const F_SETFD = 2;
127 const F_GETFL = 3;
128 const F_SETFL = 4;
129 const F_GETOWN = 5;
130 const F_SETOWN = 6;
131 const F_GETLK = 7;
132 const F_SETLK = 8;
133 const F_SETLKW = 9;
134
135 const FD_CLOEXEC = 1;
136
137 const F_RDLCK = 1;
138 const F_UNLCK = 2;
139 const F_WRLCK = 3;
140
141 const O_CREAT = 0x0200;
142 const O_EXCL = 0x0800;
143 const O_NOCTTY = 0;
144 const O_TRUNC = 0x0400;
145
146 const O_RDONLY = 0x0000;
147 const O_WRONLY = 0x0001;
148 const O_RDWR = 0x0002;
149 const O_ACCMODE = 0x0003;
150
151 const O_NONBLOCK = 0x0004;
152 const O_APPEND = 0x0008;
153 const O_SYNC = 0x0080;
154 //const O_DSYNC
155 //const O_RSYNC
156
157 struct flock
158 {
159 off_t l_start;
160 off_t l_len;
161 pid_t l_pid;
162 short l_type;
163 short l_whence;
164 }
165 }
166
167 int creat(char*, mode_t);
168 int fcntl(int, int, ...);
169 int open(char*, int, ...);
170
171 //
172 // Advisory Information (ADV)
173 //
174 /*
175 POSIX_FADV_NORMAL
176 POSIX_FADV_SEQUENTIAL
177 POSIX_FADV_RANDOM
178 POSIX_FADV_WILLNEED
179 POSIX_FADV_DONTNEED
180 POSIX_FADV_NOREUSE
181
182 int posix_fadvise(int, off_t, off_t, int);
183 int posix_fallocate(int, off_t, off_t);
184 */