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

Subversion Repositories or1k

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

Go to most recent revision | 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
#ifdef __i386__
22
#if defined (GO32) || defined (__MSDOS__) || defined (_WIN32)
23
#define __MS_types__
24
#endif
25
#endif
26
 
27
# include <stddef.h>
28
# include <machine/types.h>
29
 
30
/* To ensure the stat struct's layout doesn't change when sizeof(int), etc.
31
   changes, we assume sizeof short and long never change and have all types
32
   used to define struct stat use them and not int where possible.
33
   Where not possible, _ST_INTxx are used.  It would be preferable to not have
34
   such assumptions, but until the extra fluff is necessary, it's avoided.
35
   No 64 bit targets use stat yet.  What to do about them is postponed
36
   until necessary.  */
37
#ifdef __GNUC__
38
#define _ST_INT32 __attribute__ ((__mode__ (__SI__)))
39
#else
40
#define _ST_INT32
41
#endif
42
 
43
# ifndef        _POSIX_SOURCE
44
 
45
#  define       physadr         physadr_t
46
#  define       quad            quad_t
47
 
48
#ifndef _GNU_H_WINDOWS32_SOCKETS
49
typedef unsigned char   u_char;
50
typedef unsigned short  u_short;
51
typedef unsigned int    u_int;
52
typedef unsigned long   u_long;
53
#endif
54
 
55
typedef unsigned short  ushort;         /* System V compatibility */
56
typedef unsigned int    uint;           /* System V compatibility */
57
# endif /*!_POSIX_SOURCE */
58
 
59
#ifndef __time_t_defined
60
typedef _TIME_T_ time_t;
61
#define __time_t_defined
62
#endif
63
 
64
typedef long    daddr_t;
65
typedef char *  caddr_t;
66
 
67
#ifdef __MS_types__
68
typedef unsigned long   ino_t;
69
#else
70
#ifdef __sparc__
71
typedef unsigned long   ino_t;
72
#else
73
typedef unsigned short  ino_t;
74
#endif
75
#endif
76
 
77
#ifdef __MS_types__
78
typedef unsigned long vm_offset_t;
79
typedef unsigned long vm_size_t;
80
 
81
#define __BIT_TYPES_DEFINED__
82
 
83
typedef char int8_t;
84
typedef unsigned char u_int8_t;
85
typedef short int16_t;
86
typedef unsigned short u_int16_t;
87
typedef int int32_t;
88
typedef unsigned int u_int32_t;
89
typedef long long int64_t;
90
typedef unsigned long long u_int64_t;
91
typedef int32_t register_t;
92
#endif /* __MS_types__ */
93
 
94
/*
95
 * All these should be machine specific - right now they are all broken.
96
 * However, for all of Cygnus' embedded targets, we want them to all be
97
 * the same.  Otherwise things like sizeof (struct stat) might depend on
98
 * how the file was compiled (e.g. -mint16 vs -mint32, etc.).
99
 */
100
 
101
typedef short   dev_t;
102
 
103
typedef long    off_t;
104
 
105
typedef unsigned short  uid_t;
106
typedef unsigned short  gid_t;
107
typedef int pid_t;
108
typedef long key_t;
109
typedef long ssize_t;
110
 
111
#ifdef __MS_types__
112
typedef char *  addr_t;
113
typedef int mode_t;
114
#else
115
#if defined (__sparc__) && !defined (__sparc_v9__)
116
#ifdef __svr4__
117
typedef unsigned long mode_t;
118
#else
119
typedef unsigned short mode_t;
120
#endif
121
#else
122
typedef unsigned int mode_t _ST_INT32;
123
#endif
124
#endif /* ! __MS_types__ */
125
 
126
typedef unsigned short nlink_t;
127
 
128
/* We don't define fd_set and friends if we are compiling POSIX
129
   source, or if we have included the Windows Sockets.h header (which
130
   defines Windows versions of them).  Note that a program which
131
   includes the Windows sockets.h header must know what it is doing;
132
   it must not call the cygwin32 select function.  */
133
# if ! defined (_POSIX_SOURCE) && ! defined (_GNU_H_WINDOWS32_SOCKETS)
134
 
135
#  define       NBBY    8               /* number of bits in a byte */
136
/*
137
 * Select uses bit masks of file descriptors in longs.
138
 * These macros manipulate such bit fields (the filesystem macros use chars).
139
 * FD_SETSIZE may be defined by the user, but the default here
140
 * should be >= NOFILE (param.h).
141
 */
142
#  ifndef       FD_SETSIZE
143
#       define  FD_SETSIZE      64
144
#  endif
145
 
146
typedef long    fd_mask;
147
#  define       NFDBITS (sizeof (fd_mask) * NBBY)       /* bits per mask */
148
#  ifndef       howmany
149
#       define  howmany(x,y)    (((x)+((y)-1))/(y))
150
#  endif
151
 
152
/* We use a macro for fd_set so that including Sockets.h afterwards
153
   can work.  */
154
typedef struct _types_fd_set {
155
        fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)];
156
} _types_fd_set;
157
 
158
#define fd_set _types_fd_set
159
 
160
#  define       FD_SET(n, p)    ((p)->fds_bits[(n)/NFDBITS] |= (1L << ((n) % NFDBITS)))
161
#  define       FD_CLR(n, p)    ((p)->fds_bits[(n)/NFDBITS] &= ~(1L << ((n) % NFDBITS)))
162
#  define       FD_ISSET(n, p)  ((p)->fds_bits[(n)/NFDBITS] & (1L << ((n) % NFDBITS)))
163
#  define       FD_ZERO(p)      bzero((caddr_t)(p), sizeof (*(p)))
164
 
165
# endif /* ! defined (_POSIX_SOURCE) && ! defined (GNU_H_WINDOWS32_SOCKETS) */
166
 
167
#undef __MS_types__
168
#undef _ST_INT32
169
 
170
#endif  /* _SYS_TYPES_H */

powered by: WebSVN 2.1.0

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