OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [newlib-1.17.0/] [newlib/] [libc/] [include/] [sys/] [types.h] - Blame information for rev 158

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 148 jeremybenn
/* 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
 
20
#include <_ansi.h>
21
 
22
#ifndef __INTTYPES_DEFINED__
23
#define __INTTYPES_DEFINED__
24
 
25
#include <machine/_types.h>
26
 
27
#if defined(__rtems__)
28
/*
29
 *  The following section is RTEMS specific and is needed to more
30
 *  closely match the types defined in the BSD sys/types.h.
31
 *  This is needed to let the RTEMS/BSD TCP/IP stack compile.
32
 */
33
 
34
/* deprecated */
35
#if ___int8_t_defined
36
typedef __uint8_t       u_int8_t;
37
#endif
38
#if ___int16_t_defined
39
typedef __uint16_t      u_int16_t;
40
#endif 
41
#if ___int32_t_defined
42
typedef __uint32_t      u_int32_t;
43
#endif
44
 
45
#if ___int64_t_defined
46
typedef __uint64_t      u_int64_t;
47
 
48
/* deprecated */
49
typedef __uint64_t      u_quad_t;
50
typedef __int64_t       quad_t;
51
typedef quad_t *        qaddr_t;
52
#endif
53
 
54
#endif
55
 
56
#endif /* ! __INTTYPES_DEFINED */
57
 
58
#ifndef __need_inttypes
59
 
60
#define _SYS_TYPES_H
61
#include <sys/_types.h>
62
 
63
#ifdef __i386__
64
#if defined (GO32) || defined (__MSDOS__)
65
#define __MS_types__
66
#endif
67
#endif
68
 
69
# include <stddef.h>
70
# include <machine/types.h>
71
 
72
/* To ensure the stat struct's layout doesn't change when sizeof(int), etc.
73
   changes, we assume sizeof short and long never change and have all types
74
   used to define struct stat use them and not int where possible.
75
   Where not possible, _ST_INTxx are used.  It would be preferable to not have
76
   such assumptions, but until the extra fluff is necessary, it's avoided.
77
   No 64 bit targets use stat yet.  What to do about them is postponed
78
   until necessary.  */
79
#ifdef __GNUC__
80
#define _ST_INT32 __attribute__ ((__mode__ (__SI__)))
81
#else
82
#define _ST_INT32
83
#endif
84
 
85
# ifndef        _POSIX_SOURCE
86
 
87
#  define       physadr         physadr_t
88
#  define       quad            quad_t
89
 
90
#ifndef _BSDTYPES_DEFINED
91
/* also defined in mingw/gmon.h and in w32api/winsock[2].h */
92
typedef unsigned char   u_char;
93
typedef unsigned short  u_short;
94
typedef unsigned int    u_int;
95
typedef unsigned long   u_long;
96
#define _BSDTYPES_DEFINED
97
#endif
98
 
99
typedef unsigned short  ushort;         /* System V compatibility */
100
typedef unsigned int    uint;           /* System V compatibility */
101
# endif /*!_POSIX_SOURCE */
102
 
103
#ifndef __clock_t_defined
104
typedef _CLOCK_T_ clock_t;
105
#define __clock_t_defined
106
#endif
107
 
108
#ifndef __time_t_defined
109
typedef _TIME_T_ time_t;
110
#define __time_t_defined
111
 
112
/* Time Value Specification Structures, P1003.1b-1993, p. 261 */
113
 
114
struct timespec {
115
  time_t  tv_sec;   /* Seconds */
116
  long    tv_nsec;  /* Nanoseconds */
117
};
118
 
119
struct itimerspec {
120
  struct timespec  it_interval;  /* Timer period */
121
  struct timespec  it_value;     /* Timer expiration */
122
};
123
#endif
124
 
125
typedef long    daddr_t;
126
typedef char *  caddr_t;
127
 
128
#ifndef __CYGWIN__
129
#if defined(__MS_types__) || defined(__rtems__) || \
130
    defined(__sparc__) || defined(__SPU__)
131
typedef unsigned long   ino_t;
132
#else
133
typedef unsigned short  ino_t;
134
#endif
135
#endif /*__CYGWIN__*/
136
 
137
#ifdef __MS_types__
138
typedef unsigned long vm_offset_t;
139
typedef unsigned long vm_size_t;
140
 
141
#define __BIT_TYPES_DEFINED__
142
 
143
typedef signed char int8_t;
144
typedef unsigned char u_int8_t;
145
typedef short int16_t;
146
typedef unsigned short u_int16_t;
147
typedef int int32_t;
148
typedef unsigned int u_int32_t;
149
typedef long long int64_t;
150
typedef unsigned long long u_int64_t;
151
typedef int32_t register_t;
152
#endif /* __MS_types__ */
153
 
154
/*
155
 * All these should be machine specific - right now they are all broken.
156
 * However, for all of Cygnus' embedded targets, we want them to all be
157
 * the same.  Otherwise things like sizeof (struct stat) might depend on
158
 * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
159
 */
160
 
161
#ifndef __CYGWIN__      /* which defines these types in it's own types.h. */
162
typedef _off_t  off_t;
163
typedef __dev_t dev_t;
164
typedef __uid_t uid_t;
165
typedef __gid_t gid_t;
166
#endif
167
 
168
typedef int pid_t;
169
#ifndef __CYGWIN__
170
typedef long key_t;
171
#endif
172
typedef _ssize_t ssize_t;
173
 
174
#ifndef __CYGWIN__
175
#ifdef __MS_types__
176
typedef char *  addr_t;
177
typedef int mode_t;
178
#else
179
#if defined (__sparc__) && !defined (__sparc_v9__)
180
#ifdef __svr4__
181
typedef unsigned long mode_t;
182
#else
183
typedef unsigned short mode_t;
184
#endif
185
#else
186
typedef unsigned int mode_t _ST_INT32;
187
#endif
188
#endif /* ! __MS_types__ */
189
#endif /*__CYGWIN__*/
190
 
191
typedef unsigned short nlink_t;
192
 
193
/* We don't define fd_set and friends if we are compiling POSIX
194
   source, or if we have included (or may include as indicated
195
   by __USE_W32_SOCKETS) the W32api winsock[2].h header which
196
   defines Windows versions of them.   Note that a program which
197
   includes the W32api winsock[2].h header must know what it is doing;
198
   it must not call the cygwin32 select function.
199
*/
200
# if !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) 
201
#  define _SYS_TYPES_FD_SET
202
#  define       NBBY    8               /* number of bits in a byte */
203
/*
204
 * Select uses bit masks of file descriptors in longs.
205
 * These macros manipulate such bit fields (the filesystem macros use chars).
206
 * FD_SETSIZE may be defined by the user, but the default here
207
 * should be >= NOFILE (param.h).
208
 */
209
#  ifndef       FD_SETSIZE
210
#       define  FD_SETSIZE      64
211
#  endif
212
 
213
typedef long    fd_mask;
214
#  define       NFDBITS (sizeof (fd_mask) * NBBY)       /* bits per mask */
215
#  ifndef       howmany
216
#       define  howmany(x,y)    (((x)+((y)-1))/(y))
217
#  endif
218
 
219
/* We use a macro for fd_set so that including Sockets.h afterwards
220
   can work.  */
221
typedef struct _types_fd_set {
222
        fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
223
} _types_fd_set;
224
 
225
#define fd_set _types_fd_set
226
 
227
#  define       FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
228
#  define       FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
229
#  define       FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
230
#  define       FD_ZERO(p)      (__extension__ (void)({ \
231
     size_t __i; \
232
     char *__tmp = (char *)p; \
233
     for (__i = 0; __i < sizeof (*(p)); ++__i) \
234
       *__tmp++ = 0; \
235
}))
236
 
237
# endif /* !(defined (_POSIX_SOURCE) || defined (_WINSOCK_H) || defined (__USE_W32_SOCKETS)) */
238
 
239
#undef __MS_types__
240
#undef _ST_INT32
241
 
242
 
243
#ifndef __clockid_t_defined
244
typedef _CLOCKID_T_ clockid_t;
245
#define __clockid_t_defined
246
#endif
247
 
248
#ifndef __timer_t_defined
249
typedef _TIMER_T_ timer_t;
250
#define __timer_t_defined
251
#endif
252
 
253
typedef unsigned long useconds_t;
254
typedef long suseconds_t;
255
 
256
#include <sys/features.h>
257
 
258
 
259
/* Cygwin will probably never have full posix compliance due to little things
260
 * like an inability to set the stackaddress. Cygwin is also using void *
261
 * pointers rather than structs to ensure maximum binary compatability with
262
 * previous releases.
263
 * This means that we don't use the types defined here, but rather in
264
 * <cygwin/types.h>
265
 */
266
#if defined(_POSIX_THREADS) && !defined(__CYGWIN__)
267
 
268
#include <sys/sched.h>
269
 
270
/*
271
 *  2.5 Primitive System Data Types,  P1003.1c/D10, p. 19.
272
 */
273
 
274
typedef __uint32_t pthread_t;            /* identify a thread */
275
 
276
/* P1003.1c/D10, p. 118-119 */
277
#define PTHREAD_SCOPE_PROCESS 0
278
#define PTHREAD_SCOPE_SYSTEM  1
279
 
280
/* P1003.1c/D10, p. 111 */
281
#define PTHREAD_INHERIT_SCHED  1      /* scheduling policy and associated */
282
                                      /*   attributes are inherited from */
283
                                      /*   the calling thread. */
284
#define PTHREAD_EXPLICIT_SCHED 2      /* set from provided attribute object */
285
 
286
/* P1003.1c/D10, p. 141 */
287
#define PTHREAD_CREATE_DETACHED 0
288
#define PTHREAD_CREATE_JOINABLE  1
289
 
290
typedef struct {
291
  int is_initialized;
292
  void *stackaddr;
293
  int stacksize;
294
  int contentionscope;
295
  int inheritsched;
296
  int schedpolicy;
297
  struct sched_param schedparam;
298
 
299
  /* P1003.4b/D8, p. 54 adds cputime_clock_allowed attribute.  */
300
#if defined(_POSIX_THREAD_CPUTIME)
301
  int  cputime_clock_allowed;  /* see time.h */
302
#endif
303
  int  detachstate;
304
 
305
} pthread_attr_t;
306
 
307
#if defined(_POSIX_THREAD_PROCESS_SHARED)
308
/* NOTE: P1003.1c/D10, p. 81 defines following values for process_shared.  */
309
 
310
#define PTHREAD_PROCESS_PRIVATE 0 /* visible within only the creating process */
311
#define PTHREAD_PROCESS_SHARED  1 /* visible too all processes with access to */
312
                                  /*   the memory where the resource is */
313
                                  /*   located */
314
#endif
315
 
316
#if defined(_POSIX_THREAD_PRIO_PROTECT)
317
/* Mutexes */
318
 
319
/* Values for blocking protocol. */
320
 
321
#define PTHREAD_PRIO_NONE    0
322
#define PTHREAD_PRIO_INHERIT 1
323
#define PTHREAD_PRIO_PROTECT 2
324
#endif
325
 
326
#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
327
 
328
/* Values for mutex type */
329
 
330
#define PTHREAD_MUTEX_NORMAL     0
331
#define PTHREAD_MUTEX_RECURSIVE  1
332
#define PTHREAD_MUTEX_ERRORCHECK 2
333
#define PTHREAD_MUTEX_DEFAULT    3
334
 
335
#endif
336
 
337
typedef __uint32_t pthread_mutex_t;      /* identify a mutex */
338
 
339
typedef struct {
340
  int   is_initialized;
341
#if defined(_POSIX_THREAD_PROCESS_SHARED)
342
  int   process_shared;  /* allow mutex to be shared amongst processes */
343
#endif
344
#if defined(_POSIX_THREAD_PRIO_PROTECT)
345
  int   prio_ceiling;
346
  int   protocol;
347
#endif
348
#if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES)
349
  int type;
350
#endif
351
  int   recursive;
352
} pthread_mutexattr_t;
353
 
354
/* Condition Variables */
355
 
356
typedef __uint32_t pthread_cond_t;       /* identify a condition variable */
357
 
358
typedef struct {
359
  int   is_initialized;
360
#if defined(_POSIX_THREAD_PROCESS_SHARED)
361
  int   process_shared;       /* allow this to be shared amongst processes */
362
#endif
363
} pthread_condattr_t;         /* a condition attribute object */
364
 
365
/* Keys */
366
 
367
typedef __uint32_t pthread_key_t;        /* thread-specific data keys */
368
 
369
typedef struct {
370
  int   is_initialized;  /* is this structure initialized? */
371
  int   init_executed;   /* has the initialization routine been run? */
372
} pthread_once_t;       /* dynamic package initialization */
373
#else
374
#if defined (__CYGWIN__)
375
#include <cygwin/types.h>
376
#endif
377
#endif /* defined(_POSIX_THREADS) */
378
 
379
/* POSIX Barrier Types */
380
 
381
#if defined(_POSIX_BARRIERS)
382
typedef __uint32_t pthread_barrier_t;        /* POSIX Barrier Object */
383
typedef struct {
384
  int   is_initialized;  /* is this structure initialized? */
385
#if defined(_POSIX_THREAD_PROCESS_SHARED)
386
  int   process_shared;       /* allow this to be shared amongst processes */
387
#endif
388
} pthread_barrierattr_t;
389
#endif /* defined(_POSIX_BARRIERS) */
390
 
391
/* POSIX Spin Lock Types */
392
 
393
#if defined(_POSIX_SPIN_LOCKS)
394
typedef __uint32_t pthread_spinlock_t;        /* POSIX Spin Lock Object */
395
#endif /* defined(_POSIX_SPIN_LOCKS) */
396
 
397
/* POSIX Reader/Writer Lock Types */
398
 
399
#if !defined (__CYGWIN__)
400
#if defined(_POSIX_READER_WRITER_LOCKS)
401
typedef __uint32_t pthread_rwlock_t;         /* POSIX RWLock Object */
402
typedef struct {
403
  int   is_initialized;       /* is this structure initialized? */
404
#if defined(_POSIX_THREAD_PROCESS_SHARED)
405
  int   process_shared;       /* allow this to be shared amongst processes */
406
#endif
407
} pthread_rwlockattr_t;
408
#endif /* defined(_POSIX_READER_WRITER_LOCKS) */
409
#endif /* __CYGWIN__ */
410
 
411
#endif  /* !__need_inttypes */
412
 
413
#undef __need_inttypes
414
 
415
#endif  /* _SYS_TYPES_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.