5773947 [rkeene@sledge /home/rkeene/devel/cygwin-stuff/cyg-root/usr/include/sys]$ cat -n types.h
  1 /* unified sys/types.h: 
  2    start with sef's sysvi386 version.
  3    merge go32 version -- a few ifdefs.
  4    h8300hms, h8300xray, and sysvnecv70 disagree on the following types:
  5 
  6    typedef int gid_t;
  7    typedef int uid_t;
  8    typedef int dev_t;
  9    typedef int ino_t;
 10    typedef int mode_t;
 11    typedef int caddr_t;
 12 
 13    however, these aren't "reasonable" values, the sysvi386 ones make far 
 14    more sense, and should work sufficiently well (in particular, h8300 
 15    doesn't have a stat, and the necv70 doesn't matter.) -- eichin
 16  */
 17 
 18 #ifndef _SYS_TYPES_H
 19 #define _SYS_TYPES_H
 20 
 21 #if defined (_WIN32) || defined (__CYGWIN__)
 22 #define __MS_types__
 23 #endif
 24 
 25 #ifdef __i386__
 26 #if defined (GO32) || defined (__MSDOS__)
 27 #define __MS_types__
 28 #endif
 29 #endif
 30 
 31 # include <stddef.h>
 32 # include <machine/types.h>
 33 
 34 /* To ensure the stat struct's layout doesn't change when sizeof(int), etc.
 35    changes, we assume sizeof short and long never change and have all types
 36    used to define struct stat use them and not int where possible.
 37    Where not possible, _ST_INTxx are used.  It would be preferable to not have
 38    such assumptions, but until the extra fluff is necessary, it's avoided.
 39    No 64 bit targets use stat yet.  What to do about them is postponed
 40    until necessary.  */
 41 #ifdef __GNUC__
 42 #define _ST_INT32 __attribute__ ((__mode__ (__SI__)))
 43 #else
 44 #define _ST_INT32
 45 #endif
 46 
 47 # ifndef    _POSIX_SOURCE
 48 
 49 #  define   physadr     physadr_t
 50 #  define   quad        quad_t
 51 
 52 #ifndef _WINSOCK_H
 53 typedef unsigned char   u_char;
 54 typedef unsigned short  u_short;
 55 typedef unsigned int    u_int;
 56 typedef unsigned long   u_long;
 57 #endif
 58 
 59 typedef unsigned short  ushort;     /* System V compatibility */
 60 typedef unsigned int    uint;       /* System V compatibility */
 61 # endif /*!_POSIX_SOURCE */
 62 
 63 #ifndef __clock_t_defined
 64 typedef _CLOCK_T_ clock_t;
 65 #define __clock_t_defined
 66 #endif
 67 
 68 #ifndef __time_t_defined
 69 typedef _TIME_T_ time_t;
 70 #define __time_t_defined
 71 
 72 /* Time Value Specification Structures, P1003.1b-1993, p. 261 */
 73 
 74 struct timespec {
 75   time_t  tv_sec;   /* Seconds */
 76   long    tv_nsec;  /* Nanoseconds */
 77 };
 78 
 79 struct itimerspec {
 80   struct timespec  it_interval;  /* Timer period */
 81   struct timespec  it_value;     /* Timer expiration */
 82 };
 83 #endif
 84 
 85 typedef long    daddr_t;
 86 typedef char *  caddr_t;
 87 
 88 #ifdef __MS_types__
 89 typedef unsigned long   ino_t;
 90 #else
 91 #ifdef __sparc__
 92 typedef unsigned long   ino_t;
 93 #else
 94 typedef unsigned short  ino_t;
 95 #endif
 96 #endif
 97 
 98 #ifdef __MS_types__
 99 typedef unsigned long vm_offset_t;
100 typedef unsigned long vm_size_t;
101 
102 #define __BIT_TYPES_DEFINED__
103 
104 typedef char int8_t;
105 typedef unsigned char u_int8_t;
106 typedef short int16_t;
107 typedef unsigned short u_int16_t;
108 typedef int int32_t;
109 typedef unsigned int u_int32_t;
110 typedef long long int64_t;
111 typedef unsigned long long u_int64_t;
112 typedef int32_t register_t;
113 #endif /* __MS_types__ */
114 
115 /*
116  * All these should be machine specific - right now they are all broken.
117  * However, for all of Cygnus' embedded targets, we want them to all be
118  * the same.  Otherwise things like sizeof (struct stat) might depend on
119  * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
120  */
121 
122 #if defined(__rtems__)
123 /* device numbers are 32-bit major and and 32-bit minor */
124 typedef unsigned long long dev_t;
125 #else
126 typedef short   dev_t;
127 #endif
128 
129 typedef long    off_t;
130 
131 typedef unsigned short  uid_t;
132 typedef unsigned short  gid_t;
133 typedef int pid_t;
134 typedef long key_t;
135 typedef long ssize_t;
136 
137 #ifdef __MS_types__
138 typedef char *  addr_t;
139 typedef int mode_t;
140 #else
141 #if defined (__sparc__) && !defined (__sparc_v9__)
142 #ifdef __svr4__
143 typedef unsigned long mode_t;
144 #else
145 typedef unsigned short mode_t;
146 #endif
147 #else
148 typedef unsigned int mode_t _ST_INT32;
149 #endif
150 #endif /* ! __MS_types__ */
151 
152 typedef unsigned short nlink_t;
153 
154 /* We don't define fd_set and friends if we are compiling POSIX
155    source, or if we have included the Windows Sockets.h header (which
156    defines Windows versions of them).  Note that a program which
157    includes the Windows sockets.h header must know what it is doing;
158    it must not call the cygwin32 select function.  */
159 # if ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H)
160 
161 #  define   NBBY    8       /* number of bits in a byte */
162 /*
163  * Select uses bit masks of file descriptors in longs.
164  * These macros manipulate such bit fields (the filesystem macros use chars).
165  * FD_SETSIZE may be defined by the user, but the default here
166  * should be >= NOFILE (param.h).
167  */
168 #  ifndef   FD_SETSIZE
169 #   define  FD_SETSIZE  64
170 #  endif
171 
172 typedef long    fd_mask;
173 #  define   NFDBITS (sizeof (fd_mask) * NBBY)   /* bits per mask */
174 #  ifndef   howmany
175 #   define  howmany(x,y)    (((x)+((y)-1))/(y))
176 #  endif
177 
178 /* We use a macro for fd_set so that including Sockets.h afterwards
179    can work.  */
180 typedef struct _types_fd_set {
181     fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
182 } _types_fd_set;
183 
184 #define fd_set _types_fd_set
185 
186 #  define   FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
187 #  define   FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
188 #  define   FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
189 #  define   FD_ZERO(p)  (__extension__ (void)({ \
190      size_t __i; \
191      char *__tmp = (char *)p; \
192      for (__i = 0; __i < sizeof (*(p)); ++__i) \
193        *__tmp++ = 0; \
194 }))
195 
196 # endif /* ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) */
197 
198 #undef __MS_types__
199 #undef _ST_INT32
200 
201 /* The following are actually standard POSIX 1003.1b-1993 threads, mutexes,
202    condition variables, and keys.  But since RTEMS is currently the only
203    newlib user of these, the ifdef is just on RTEMS. */
204 
205 #if defined(__rtems__)
206 
207 #ifndef __clockid_t_defined
208 typedef _CLOCKID_T_ clockid_t;
209 #define __clockid_t_defined
210 #endif
211 
212 #ifndef __timer_t_defined
213 typedef _TIMER_T_ timer_t;
214 #define __timer_t_defined
215 #endif
216 
217 #include <sys/features.h>
218 
219 #if defined(_POSIX_THREADS)
220 
221 #include <sys/sched.h>
222 
223 /*
224  *  2.5 Primitive System Data Types,  P1003.1c/D10, p. 19.
225  */
226 
227 typedef __uint32_t pthread_t;            /* identify a thread */
228 
229 /* P1003.1c/D10, p. 118-119 */
230 #define PTHREAD_SCOPE_PROCESS 0
231 #define PTHREAD_SCOPE_SYSTEM  1
232 
233 /* P1003.1c/D10, p. 111 */
234 #define PTHREAD_INHERIT_SCHED  1      /* scheduling policy and associated */
235                                       /*   attributes are inherited from */
236                                       /*   the calling thread. */
237 #define PTHREAD_EXPLICIT_SCHED 2      /* set from provided attribute object */
238 
239 /* P1003.1c/D10, p. 141 */
240 #define PTHREAD_CREATE_DETACHED 0
241 #define PTHREAD_CREATE_JOINABLE  1
242 
243 typedef struct {
244   int is_initialized;
245   void *stackaddr;
246   int stacksize;
247   int contentionscope;
248   int inheritsched;
249   int schedpolicy;
250   struct sched_param schedparam;
251 
252   /* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute.  */
253 #if defined(_POSIX_THREAD_CPUTIME)
254   int  cputime_clock_allowed;  /* see time.h */
255 #endif
256   int  detachstate;
257 
258 } pthread_attr_t;
259 
260 #if defined(_POSIX_THREAD_PROCESS_SHARED)
261 /* NOTE: P1003.1c/D10, p. 81 defines following values for process_shared.  */
262 
263 #define PTHREAD_PROCESS_PRIVATE 0 /* visible within only the creating process */
264 #define PTHREAD_PROCESS_SHARED  1 /* visible too all processes with access to */
265                                   /*   the memory where the resource is */
266                                   /*   located */
267 #endif
268 
269 #if defined(_POSIX_THREAD_PRIO_PROTECT)
270 /* Mutexes */
271 
272 /* Values for blocking protocol. */
273 
274 #define PTHREAD_PRIO_NONE    0
275 #define PTHREAD_PRIO_INHERIT 1
276 #define PTHREAD_PRIO_PROTECT 2
277 #endif
278 
279 typedef __uint32_t pthread_mutex_t;      /* identify a mutex */
280 
281 typedef struct {
282   int   is_initialized;
283 #if defined(_POSIX_THREAD_PROCESS_SHARED)
284   int   process_shared;  /* allow mutex to be shared amongst processes */
285 #endif
286 #if defined(_POSIX_THREAD_PRIO_PROTECT)
287   int   prio_ceiling;
288   int   protocol;
289 #endif
290   int   recursive;
291 } pthread_mutexattr_t;
292 
293 /* Condition Variables */
294 
295 typedef __uint32_t pthread_cond_t;       /* identify a condition variable */
296 
297 typedef struct {
298   int   is_initialized;
299 #if defined(_POSIX_THREAD_PROCESS_SHARED)
300   int   process_shared;       /* allow this to be shared amongst processes */
301 #endif
302 } pthread_condattr_t;         /* a condition attribute object */
303 
304 /* Keys */
305 
306 typedef __uint32_t pthread_key_t;        /* thread-specific data keys */
307 
308 typedef struct {
309   int   is_initialized;  /* is this structure initialized? */
310   int   init_executed;   /* has the initialization routine been run? */
311 } pthread_once_t;       /* dynamic package initialization */
312 
313 #endif /* defined(_POSIX_THREADS) */
314 
315 #endif  /* defined(__rtems__) */
316 
317 #endif  /* _SYS_TYPES_H */
5773948 [rkeene@sledge /home/rkeene/devel/cygwin-stuff/cyg-root/usr/include/sys]$

Click here to go back to the directory listing.
Click here to download this file.
last modified: 2001-01-31 15:09:06