1 /* The <sys/types.h> header contains important data type definitions.
2 * It is considered good programming practice to use these definitions,
3 * instead of the underlying base type. By convention, all type names end
14 typedef unsigned char u8_t
; /* 8 bit type */
15 typedef unsigned short u16_t
; /* 16 bit type */
16 typedef signed char i8_t
; /* 8 bit signed type */
17 typedef short i16_t
; /* 16 bit signed type */
19 #if __SIZEOF_LONG__ > 4
20 /* compiling with gcc on some (e.g. x86-64) platforms */
21 typedef unsigned int u32_t
; /* 32 bit type */
22 typedef int i32_t
; /* 32 bit signed type */
24 /* default for ACK or gcc on 32 bit platforms */
25 typedef unsigned long u32_t
; /* 32 bit type */
26 typedef long i32_t
; /* 32 bit signed type */
34 /* some Minix specific types that do not conflict with posix */
35 typedef u32_t zone_t
; /* zone number */
36 typedef u32_t block_t
; /* block number */
37 typedef u32_t bit_t
; /* bit number in a bit map */
38 typedef u16_t zone1_t
; /* zone number for V1 file systems */
39 typedef u16_t bitchunk_t
; /* collection of bits in a bitmap */
41 /* ANSI C makes writing down the promotion of unsigned types very messy. When
42 * sizeof(short) == sizeof(int), there is no promotion, so the type stays
43 * unsigned. When the compiler is not ANSI, there is usually no loss of
44 * unsignedness, and there are usually no prototypes so the promoted type
45 * doesn't matter. The use of types like Ino_t is an attempt to use ints
46 * (which are not promoted) while providing information to the reader.
49 typedef unsigned long Ino_t
;
51 #if defined(_MINIX) || defined(__minix)
53 /* The type size_t holds all results of the sizeof operator. At first glance,
54 * it seems obvious that it should be an unsigned int, but this is not always
55 * the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
56 * integers. When one asks for the size of a 70K struct or array, the result
57 * requires 17 bits to express, so size_t must be a long type. The type
58 * ssize_t is the signed version of size_t.
62 typedef unsigned int size_t;
72 typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
77 typedef long clock_t; /* unit for system accounting */
82 typedef unsigned long sigset_t
;
90 /* Open Group Base Specifications Issue 6 (not complete) */
91 typedef long useconds_t
; /* Time in microseconds */
93 typedef short dev_t
; /* holds (major|minor) device pair */
95 /* Types used in disk, inode, etc. data structures. */
96 typedef char gid_t
; /* group id */
97 typedef unsigned long ino_t
; /* i-node number (V3 filesystem) */
98 typedef unsigned short mode_t
; /* file type and permissions bits */
99 typedef short nlink_t
; /* number of links to a file */
100 typedef long off_t
; /* offset within a file */
101 typedef int pid_t
; /* process id (must be signed) */
102 typedef short uid_t
; /* user id */
104 /* Signal handler type, e.g. SIG_IGN */
105 typedef void _PROTOTYPE( (*sighandler_t
), (int) );
107 /* Compatibility with other systems */
108 typedef unsigned char u_char
;
109 typedef unsigned short u_short
;
110 typedef unsigned int u_int
;
111 typedef unsigned long u_long
;
112 typedef char *caddr_t
;
115 #define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
116 #define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
119 #define minor(dev) (((dev) >> MINOR) & 0xff)
123 #define major(dev) (((dev) >> MAJOR) & 0xff)
127 #define makedev(major, minor) \
128 ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
131 #endif /* _MINIX || __minix */
133 #endif /* _TYPES_H */