comparison druntime/import/stdc/posix/sys/types.d @ 760:6f33b427bfd1

Seems like hg ignores .di files, so I missed a bunch of stuff. complete druntime should be there now :)
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 12 Nov 2008 00:19:18 +0100
parents
children
comparison
equal deleted inserted replaced
759:d3eb054172f9 760:6f33b427bfd1
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 stdc.posix.sys.types;
10
11 private import stdc.posix.config;
12 private import stdc.stdint;
13 public import stdc.stddef; // for size_t
14 public import stdc.time; // for clock_t, time_t
15
16 extern (C):
17
18 //
19 // Required
20 //
21 /*
22 blkcnt_t
23 blksize_t
24 dev_t
25 gid_t
26 ino_t
27 mode_t
28 nlink_t
29 off_t
30 pid_t
31 size_t
32 ssize_t
33 time_t
34 uid_t
35 */
36
37 version( linux )
38 {
39 static if( __USE_FILE_OFFSET64 )
40 {
41 alias long blkcnt_t;
42 alias ulong ino_t;
43 alias long off_t;
44 }
45 else
46 {
47 alias c_long blkcnt_t;
48 alias c_ulong ino_t;
49 alias c_long off_t;
50 }
51 alias c_long blksize_t;
52 alias ulong dev_t;
53 alias uint gid_t;
54 alias uint mode_t;
55 alias c_ulong nlink_t;
56 alias int pid_t;
57 //size_t (defined in stdc.stddef)
58 alias c_long ssize_t;
59 //time_t (defined in stdc.time)
60 alias uint uid_t;
61 }
62 else version( darwin )
63 {
64 alias long blkcnt_t;
65 alias int blksize_t;
66 alias int dev_t;
67 alias uint gid_t;
68 alias uint ino_t;
69 alias ushort mode_t;
70 alias ushort nlink_t;
71 alias long off_t;
72 alias int pid_t;
73 //size_t (defined in stdc.stddef)
74 alias size_t ssize_t;
75 //time_t (defined in stdc.time)
76 alias uint uid_t;
77 }
78 else version( freebsd )
79 {
80 alias long blkcnt_t;
81 alias uint blksize_t;
82 alias uint dev_t;
83 alias uint gid_t;
84 alias uint ino_t;
85 alias ushort mode_t;
86 alias ushort nlink_t;
87 alias long off_t;
88 alias int pid_t;
89 //size_t (defined in stdc.stddef)
90 alias size_t ssize_t;
91 //time_t (defined in stdc.time)
92 alias uint uid_t;
93 alias uint fflags_t;
94 }
95
96 //
97 // XOpen (XSI)
98 //
99 /*
100 clock_t
101 fsblkcnt_t
102 fsfilcnt_t
103 id_t
104 key_t
105 suseconds_t
106 useconds_t
107 */
108
109 version( linux )
110 {
111 static if( __USE_FILE_OFFSET64 )
112 {
113 alias ulong fsblkcnt_t;
114 alias ulong fsfilcnt_t;
115 }
116 else
117 {
118 alias c_ulong fsblkcnt_t;
119 alias c_ulong fsfilcnt_t;
120 }
121 // clock_t (defined in stdc.time)
122 alias uint id_t;
123 alias int key_t;
124 alias c_long suseconds_t;
125 alias uint useconds_t;
126 }
127 else version( darwin )
128 {
129 //clock_t
130 alias uint fsblkcnt_t;
131 alias uint fsfilcnt_t;
132 alias uint id_t;
133 // key_t
134 alias int suseconds_t;
135 alias uint useconds_t;
136 }
137 else version( freebsd )
138 {
139 //clock_t
140 alias ulong fsblkcnt_t;
141 alias ulong fsfilcnt_t;
142 alias long id_t;
143 alias c_long key_t;
144 alias c_long suseconds_t;
145 alias uint useconds_t;
146 }
147
148 //
149 // Thread (THR)
150 //
151 /*
152 pthread_attr_t
153 pthread_cond_t
154 pthread_condattr_t
155 pthread_key_t
156 pthread_mutex_t
157 pthread_mutexattr_t
158 pthread_once_t
159 pthread_rwlock_t
160 pthread_rwlockattr_t
161 pthread_t
162 */
163
164 version( linux )
165 {
166 private struct __sched_param
167 {
168 int __sched_priority;
169 }
170
171 struct pthread_attr_t
172 {
173 int __detachstate;
174 int __schedpolicy;
175 __sched_param __schedparam;
176 int __inheritsched;
177 int __scope;
178 size_t __guardsize;
179 int __stackaddr_set;
180 void* __stackaddr;
181 size_t __stacksize;
182 }
183
184 private alias int __atomic_lock_t;
185
186 private struct _pthread_fastlock
187 {
188 c_long __status;
189 __atomic_lock_t __spinlock;
190 }
191
192 private alias void* _pthread_descr;
193
194 private alias long __pthread_cond_align_t;
195
196 struct pthread_cond_t
197 {
198 _pthread_fastlock __c_lock;
199 _pthread_descr __c_waiting;
200 char[48 -
201 _pthread_fastlock.sizeof -
202 _pthread_descr.sizeof -
203 __pthread_cond_align_t.sizeof]
204 __padding;
205 __pthread_cond_align_t __align;
206 }
207
208 struct pthread_condattr_t
209 {
210 int __dummy;
211 }
212
213 alias uint pthread_key_t;
214
215 struct pthread_mutex_t
216 {
217 int __m_reserved;
218 int __m_count;
219 _pthread_descr __m_owner;
220 int __m_kind;
221 _pthread_fastlock __m_lock;
222 }
223
224 struct pthread_mutexattr_t
225 {
226 int __mutexkind;
227 }
228
229 alias int pthread_once_t;
230
231 struct pthread_rwlock_t
232 {
233 _pthread_fastlock __rw_lock;
234 int __rw_readers;
235 _pthread_descr __rw_writer;
236 _pthread_descr __rw_read_waiting;
237 _pthread_descr __rw_write_waiting;
238 int __rw_kind;
239 int __rw_pshared;
240 }
241
242 struct pthread_rwlockattr_t
243 {
244 int __lockkind;
245 int __pshared;
246 }
247
248 alias c_ulong pthread_t;
249 }
250 else version( darwin )
251 {
252 private
253 {
254 // #if defined(__LP64__)
255 // FIXME: what is LP64, is it important enough to be included?
256 version( LP64 )
257 {
258 const __PTHREAD_SIZE__ = 1168;
259 const __PTHREAD_ATTR_SIZE__ = 56;
260 const __PTHREAD_MUTEXATTR_SIZE__ = 8;
261 const __PTHREAD_MUTEX_SIZE__ = 56;
262 const __PTHREAD_CONDATTR_SIZE__ = 8;
263 const __PTHREAD_COND_SIZE__ = 40;
264 const __PTHREAD_ONCE_SIZE__ = 8;
265 const __PTHREAD_RWLOCK_SIZE__ = 192;
266 const __PTHREAD_RWLOCKATTR_SIZE__ = 16;
267 }
268 else
269 {
270 const __PTHREAD_SIZE__ = 596;
271 const __PTHREAD_ATTR_SIZE__ = 36;
272 const __PTHREAD_MUTEXATTR_SIZE__ = 8;
273 const __PTHREAD_MUTEX_SIZE__ = 40;
274 const __PTHREAD_CONDATTR_SIZE__ = 4;
275 const __PTHREAD_COND_SIZE__ = 24;
276 const __PTHREAD_ONCE_SIZE__ = 4;
277 const __PTHREAD_RWLOCK_SIZE__ = 124;
278 const __PTHREAD_RWLOCKATTR_SIZE__ = 12;
279 }
280 }
281
282 struct pthread_handler_rec
283 {
284 void function(void*) __routine;
285 void* __arg;
286 pthread_handler_rec* __next;
287 }
288
289 struct pthread_attr_t
290 {
291 c_long __sig;
292 byte[__PTHREAD_ATTR_SIZE__] __opaque;
293 }
294
295 struct pthread_cond_t
296 {
297 c_long __sig;
298 byte[__PTHREAD_COND_SIZE__] __opaque;
299 }
300
301 struct pthread_condattr_t
302 {
303 c_long __sig;
304 byte[__PTHREAD_CONDATTR_SIZE__] __opaque;
305 }
306
307 alias c_ulong pthread_key_t;
308
309 struct pthread_mutex_t
310 {
311 c_long __sig;
312 byte[__PTHREAD_MUTEX_SIZE__] __opaque;
313 }
314
315 struct pthread_mutexattr_t
316 {
317 c_long __sig;
318 byte[__PTHREAD_MUTEXATTR_SIZE__] __opaque;
319 }
320
321 struct pthread_once_t
322 {
323 c_long __sig;
324 byte[__PTHREAD_ONCE_SIZE__] __opaque;
325 }
326
327 struct pthread_rwlock_t
328 {
329 c_long __sig;
330 byte[__PTHREAD_RWLOCK_SIZE__] __opaque;
331 }
332
333 struct pthread_rwlockattr_t
334 {
335 c_long __sig;
336 byte[__PTHREAD_RWLOCKATTR_SIZE__] __opaque;
337 }
338
339 private struct _opaque_pthread_t
340 {
341 c_long __sig;
342 pthread_handler_rec* __cleanup_stack;
343 byte[__PTHREAD_SIZE__] __opaque;
344 }
345
346 alias _opaque_pthread_t* pthread_t;
347 }
348 else version( freebsd )
349 {
350 alias int lwpid_t;
351
352 alias void* pthread_attr_t;
353 alias void* pthread_cond_t;
354 alias void* pthread_condattr_t;
355 alias void* pthread_key_t;
356 alias void* pthread_mutex_t;
357 alias void* pthread_mutexattr_t;
358 alias void* pthread_once_t;
359 alias void* pthread_rwlock_t;
360 alias void* pthread_rwlockattr_t;
361 alias void* pthread_t;
362 }
363
364 //
365 // Barrier (BAR)
366 //
367 /*
368 pthread_barrier_t
369 pthread_barrierattr_t
370 */
371
372 version( linux )
373 {
374 struct pthread_barrier_t
375 {
376 _pthread_fastlock __ba_lock;
377 int __ba_required;
378 int __ba_present;
379 _pthread_descr __ba_waiting;
380 }
381
382 struct pthread_barrierattr_t
383 {
384 int __pshared;
385 }
386 }
387 else version( freebsd )
388 {
389 alias void* pthread_barrier_t;
390 alias void* pthread_barrierattr_t;
391 }
392
393 //
394 // Spin (SPN)
395 //
396 /*
397 pthread_spinlock_t
398 */
399
400 version( linux )
401 {
402 alias int pthread_spinlock_t; // volatile
403 }
404 else version( darwin )
405 {
406 struct pthread_spinlock_t;
407 }
408 else version( freebsd )
409 {
410 alias void* pthread_spinlock_t;
411 }
412
413 //
414 // Timer (TMR)
415 //
416 /*
417 clockid_t
418 timer_t
419 */
420
421 //
422 // Trace (TRC)
423 //
424 /*
425 trace_attr_t
426 trace_event_id_t
427 trace_event_set_t
428 trace_id_t
429 */