2 * D header file for POSIX.
4 * Copyright: Public Domain
5 * License: Public Domain
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
9 module stdc.posix.sys.types;
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
39 static if( __USE_FILE_OFFSET64 )
47 alias c_long blkcnt_t;
51 alias c_long blksize_t;
55 alias c_ulong nlink_t;
57 //size_t (defined in stdc.stddef)
59 //time_t (defined in stdc.time)
62 else version( darwin )
73 //size_t (defined in stdc.stddef)
75 //time_t (defined in stdc.time)
78 else version( freebsd )
89 //size_t (defined in stdc.stddef)
91 //time_t (defined in stdc.time)
111 static if( __USE_FILE_OFFSET64 )
113 alias ulong fsblkcnt_t;
114 alias ulong fsfilcnt_t;
118 alias c_ulong fsblkcnt_t;
119 alias c_ulong fsfilcnt_t;
121 // clock_t (defined in stdc.time)
124 alias c_long suseconds_t;
125 alias uint useconds_t;
127 else version( darwin )
130 alias uint fsblkcnt_t;
131 alias uint fsfilcnt_t;
134 alias int suseconds_t;
135 alias uint useconds_t;
137 else version( freebsd )
140 alias ulong fsblkcnt_t;
141 alias ulong fsfilcnt_t;
144 alias c_long suseconds_t;
145 alias uint useconds_t;
166 private struct __sched_param
168 int __sched_priority;
171 struct pthread_attr_t
175 __sched_param __schedparam;
184 private alias int __atomic_lock_t;
186 private struct _pthread_fastlock
189 __atomic_lock_t __spinlock;
192 private alias void* _pthread_descr;
194 private alias long __pthread_cond_align_t;
196 struct pthread_cond_t
198 _pthread_fastlock __c_lock;
199 _pthread_descr __c_waiting;
201 _pthread_fastlock.sizeof -
202 _pthread_descr.sizeof -
203 __pthread_cond_align_t.sizeof]
205 __pthread_cond_align_t __align;
208 struct pthread_condattr_t
213 alias uint pthread_key_t;
215 struct pthread_mutex_t
219 _pthread_descr __m_owner;
221 _pthread_fastlock __m_lock;
224 struct pthread_mutexattr_t
229 alias int pthread_once_t;
231 struct pthread_rwlock_t
233 _pthread_fastlock __rw_lock;
235 _pthread_descr __rw_writer;
236 _pthread_descr __rw_read_waiting;
237 _pthread_descr __rw_write_waiting;
242 struct pthread_rwlockattr_t
248 alias c_ulong pthread_t;
250 else version( darwin )
254 // #if defined(__LP64__)
255 // FIXME: what is LP64, is it important enough to be included?
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;
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;
282 struct pthread_handler_rec
284 void function(void*) __routine;
286 pthread_handler_rec* __next;
289 struct pthread_attr_t
292 byte[__PTHREAD_ATTR_SIZE__] __opaque;
295 struct pthread_cond_t
298 byte[__PTHREAD_COND_SIZE__] __opaque;
301 struct pthread_condattr_t
304 byte[__PTHREAD_CONDATTR_SIZE__] __opaque;
307 alias c_ulong pthread_key_t;
309 struct pthread_mutex_t
312 byte[__PTHREAD_MUTEX_SIZE__] __opaque;
315 struct pthread_mutexattr_t
318 byte[__PTHREAD_MUTEXATTR_SIZE__] __opaque;
321 struct pthread_once_t
324 byte[__PTHREAD_ONCE_SIZE__] __opaque;
327 struct pthread_rwlock_t
330 byte[__PTHREAD_RWLOCK_SIZE__] __opaque;
333 struct pthread_rwlockattr_t
336 byte[__PTHREAD_RWLOCKATTR_SIZE__] __opaque;
339 private struct _opaque_pthread_t
342 pthread_handler_rec* __cleanup_stack;
343 byte[__PTHREAD_SIZE__] __opaque;
346 alias _opaque_pthread_t* pthread_t;
348 else version( freebsd )
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;
369 pthread_barrierattr_t
374 struct pthread_barrier_t
376 _pthread_fastlock __ba_lock;
379 _pthread_descr __ba_waiting;
382 struct pthread_barrierattr_t
387 else version( freebsd )
389 alias void* pthread_barrier_t;
390 alias void* pthread_barrierattr_t;
402 alias int pthread_spinlock_t; // volatile
404 else version( darwin )
406 struct pthread_spinlock_t;
408 else version( freebsd )
410 alias void* pthread_spinlock_t;