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

Subversion Repositories or1k

[/] [or1k/] [trunk/] [newlib/] [newlib/] [libc/] [include/] [sys/] [types.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 39 lampret
/* 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 56 joel
#if defined (_WIN32) || defined (__CYGWIN__)
22
#define __MS_types__
23
#endif
24
 
25 39 lampret
#ifdef __i386__
26 56 joel
#if defined (GO32) || defined (__MSDOS__)
27 39 lampret
#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 56 joel
#ifndef _WINSOCK_H
53 39 lampret
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 __time_t_defined
64
typedef _TIME_T_ time_t;
65
#define __time_t_defined
66
#endif
67
 
68
typedef long    daddr_t;
69
typedef char *  caddr_t;
70
 
71
#ifdef __MS_types__
72
typedef unsigned long   ino_t;
73
#else
74
#ifdef __sparc__
75
typedef unsigned long   ino_t;
76
#else
77
typedef unsigned short  ino_t;
78
#endif
79
#endif
80
 
81
#ifdef __MS_types__
82
typedef unsigned long vm_offset_t;
83
typedef unsigned long vm_size_t;
84
 
85
#define __BIT_TYPES_DEFINED__
86
 
87
typedef char int8_t;
88
typedef unsigned char u_int8_t;
89
typedef short int16_t;
90
typedef unsigned short u_int16_t;
91
typedef int int32_t;
92
typedef unsigned int u_int32_t;
93
typedef long long int64_t;
94
typedef unsigned long long u_int64_t;
95
typedef int32_t register_t;
96
#endif /* __MS_types__ */
97
 
98
/*
99
 * All these should be machine specific - right now they are all broken.
100
 * However, for all of Cygnus' embedded targets, we want them to all be
101
 * the same.  Otherwise things like sizeof (struct stat) might depend on
102
 * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
103
 */
104
 
105
typedef short   dev_t;
106
 
107
typedef long    off_t;
108
 
109
typedef unsigned short  uid_t;
110
typedef unsigned short  gid_t;
111
typedef int pid_t;
112
typedef long key_t;
113
typedef long ssize_t;
114
 
115
#ifdef __MS_types__
116
typedef char *  addr_t;
117
typedef int mode_t;
118
#else
119
#if defined (__sparc__) && !defined (__sparc_v9__)
120
#ifdef __svr4__
121
typedef unsigned long mode_t;
122
#else
123
typedef unsigned short mode_t;
124
#endif
125
#else
126
typedef unsigned int mode_t _ST_INT32;
127
#endif
128
#endif /* ! __MS_types__ */
129
 
130
typedef unsigned short nlink_t;
131
 
132
/* We don't define fd_set and friends if we are compiling POSIX
133
   source, or if we have included the Windows Sockets.h header (which
134
   defines Windows versions of them).  Note that a program which
135
   includes the Windows sockets.h header must know what it is doing;
136
   it must not call the cygwin32 select function.  */
137 56 joel
# if ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H)
138 39 lampret
 
139
#  define       NBBY    8               /* number of bits in a byte */
140
/*
141
 * Select uses bit masks of file descriptors in longs.
142
 * These macros manipulate such bit fields (the filesystem macros use chars).
143
 * FD_SETSIZE may be defined by the user, but the default here
144
 * should be >= NOFILE (param.h).
145
 */
146
#  ifndef       FD_SETSIZE
147
#       define  FD_SETSIZE      64
148
#  endif
149
 
150
typedef long    fd_mask;
151
#  define       NFDBITS (sizeof (fd_mask) * NBBY)       /* bits per mask */
152
#  ifndef       howmany
153
#       define  howmany(x,y)    (((x)+((y)-1))/(y))
154
#  endif
155
 
156
/* We use a macro for fd_set so that including Sockets.h afterwards
157
   can work.  */
158
typedef struct _types_fd_set {
159
        fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
160
} _types_fd_set;
161
 
162
#define fd_set _types_fd_set
163
 
164
#  define       FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
165
#  define       FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
166
#  define       FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
167 59 joel
#  define       FD_ZERO(p)      (void) memset((caddr_t)(p), 0, sizeof (*(p)))
168 39 lampret
 
169 56 joel
# endif /* ! defined (_POSIX_SOURCE) && ! defined (_WINSOCK_H) */
170 39 lampret
 
171
#undef __MS_types__
172
#undef _ST_INT32
173
 
174
#endif  /* _SYS_TYPES_H */

powered by: WebSVN 2.1.0

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