kernel/vm: change pde table info from single buffer to explicit per-process.
[minix.git] / include / minix / types.h
blob8740ae0d0944c4a7660e901baba491726af8fdf4
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
4 * with _t.
5 */
7 #ifndef _TYPES_H
8 #define _TYPES_H
10 #ifndef _ANSI_H
11 #include <ansi.h>
12 #endif
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 */
23 #else
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 */
27 #endif
29 typedef struct {
30 u32_t lo;
31 u32_t hi;
32 } u64_t;
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.
60 #ifndef _SIZE_T
61 #define _SIZE_T
62 typedef unsigned int size_t;
63 #endif
65 #ifndef _SSIZE_T
66 #define _SSIZE_T
67 typedef int ssize_t;
68 #endif
70 #ifndef _TIME_T
71 #define _TIME_T
72 typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
73 #endif
75 #ifndef _CLOCK_T
76 #define _CLOCK_T
77 typedef long clock_t; /* unit for system accounting */
78 #endif
80 #ifndef _SIGSET_T
81 #define _SIGSET_T
82 typedef unsigned long sigset_t;
83 #endif
85 #ifndef _KEY_T
86 #define _KEY_T
87 typedef long key_t;
88 #endif
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;
114 /* Devices. */
115 #define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
116 #define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
118 #ifndef minor
119 #define minor(dev) (((dev) >> MINOR) & 0xff)
120 #endif
122 #ifndef major
123 #define major(dev) (((dev) >> MAJOR) & 0xff)
124 #endif
126 #ifndef makedev
127 #define makedev(major, minor) \
128 ((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
129 #endif
131 #endif /* _MINIX || __minix */
133 #endif /* _TYPES_H */