1/* 2 * Copyright 2002-2012 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _SYS_TYPES_H 6#define _SYS_TYPES_H 7 8 9#include <config/types.h> 10 11#include <BeBuild.h> 12 13 14/* BSD compatibility */ 15typedef unsigned long u_long; 16typedef unsigned int u_int; 17typedef unsigned short u_short; 18typedef unsigned char u_char; 19 20 21/* sysV compatibility */ 22typedef unsigned long ulong; 23typedef unsigned short ushort; 24typedef unsigned int uint; 25typedef unsigned char unchar; 26 27 28typedef __haiku_int64 blkcnt_t; 29typedef __haiku_std_int32 blksize_t; 30typedef __haiku_int64 fsblkcnt_t; 31typedef __haiku_int64 fsfilcnt_t; 32typedef __haiku_int64 off_t; 33typedef __haiku_int64 ino_t; 34typedef __haiku_std_int32 cnt_t; 35typedef __haiku_int32 dev_t; 36typedef __haiku_int32 pid_t; 37typedef __haiku_int32 id_t; 38 39typedef __haiku_std_uint32 uid_t; 40typedef __haiku_std_uint32 gid_t; 41typedef __haiku_std_uint32 mode_t; 42typedef __haiku_std_uint32 umode_t; 43typedef __haiku_std_int32 nlink_t; 44 45#ifdef __HAIKU_BEOS_COMPATIBLE_TYPES 46 typedef int daddr_t; /* disk address */ 47#else 48 typedef off_t daddr_t; /* disk address */ 49#endif 50typedef char* caddr_t; 51 52typedef __haiku_addr_t addr_t; 53typedef __haiku_int32 key_t; 54 55typedef __haiku_std_int32 clockid_t; 56typedef struct __timer_t* timer_t; 57 58 59/* pthread types */ 60 61typedef struct _pthread_thread *pthread_t; 62typedef struct _pthread_attr *pthread_attr_t; 63typedef struct _pthread_barrier pthread_barrier_t; 64typedef struct _pthread_barrierattr *pthread_barrierattr_t; 65typedef struct _pthread_mutex pthread_mutex_t; 66typedef struct _pthread_mutexattr *pthread_mutexattr_t; 67typedef struct _pthread_cond pthread_cond_t; 68typedef struct _pthread_condattr *pthread_condattr_t; 69typedef int pthread_key_t; 70typedef struct _pthread_once pthread_once_t; 71typedef struct _pthread_rwlock pthread_rwlock_t; 72typedef struct _pthread_rwlockattr *pthread_rwlockattr_t; 73typedef struct _pthread_spinlock pthread_spinlock_t; 74 75struct _pthread_mutex { 76 __haiku_std_uint32 flags; 77 __haiku_std_int32 lock; 78 __haiku_std_int32 unused; 79 __haiku_std_int32 owner; 80 __haiku_std_int32 owner_count; 81}; 82 83struct _pthread_barrier { 84 __haiku_std_uint32 flags; 85 __haiku_std_int32 lock; 86 __haiku_std_int32 mutex; 87 __haiku_std_int32 waiter_count; 88 __haiku_std_int32 waiter_max; 89}; 90 91struct _pthread_cond { 92 __haiku_std_uint32 flags; 93 __haiku_std_int32 unused; 94 pthread_mutex_t* mutex; 95 __haiku_std_int32 waiter_count; 96 __haiku_std_int32 lock; 97}; 98 99struct _pthread_once { 100 __haiku_std_int32 state; 101}; 102 103struct _pthread_rwlock { 104 __haiku_std_uint32 flags; 105 __haiku_std_int32 owner; 106 union { 107 struct { 108 __haiku_std_int32 mutex; 109 __haiku_std_int32 unused; 110 __haiku_std_int32 reader_count; 111 __haiku_std_int32 writer_count; 112 void* waiters[2]; 113 } local; 114 struct { 115 __haiku_std_int32 sem; 116 } shared; 117 } u; 118}; 119 120struct _pthread_spinlock { 121 __haiku_std_int32 lock; 122}; 123 124 125#include <null.h> 126#include <size_t.h> 127#include <time.h> 128 129#endif 130