Repository navigation
Expand file tree
/
Copy pathtypes.h
More file actions
executable file
·146 lines (121 loc) · 4.9 KB
/
Copy pathtypes.h
File metadata and controls
executable file
·146 lines (121 loc) · 4.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* The <sys/types.h> header contains important data type definitions.
* It is considered good programming practice to use these definitions,
* instead of the underlying base type. By convention, all type names end
* with _t.
*/
#ifndef _TYPES_H
#define _TYPES_H
#ifndef _ANSI_H
#include <ansi.h>
#endif
/* The type size_t holds all results of the sizeof operator. At first glance,
* it seems obvious that it should be an unsigned int, but this is not always
* the case. For example, MINIX-ST (68000) has 32-bit pointers and 16-bit
* integers. When one asks for the size of a 70K struct or array, the result
* requires 17 bits to express, so size_t must be a long type. The type
* ssize_t is the signed version of size_t.
*/
#ifndef _SIZE_T
#define _SIZE_T
typedef unsigned int size_t;
#endif
#ifndef _SSIZE_T
#define _SSIZE_T
typedef int ssize_t;
#endif
#ifndef _TIME_T
#define _TIME_T
typedef long time_t; /* time in sec since 1 Jan 1970 0000 GMT */
#endif
#ifndef _CLOCK_T
#define _CLOCK_T
typedef long clock_t; /* unit for system accounting */
#endif
#ifndef _SIGSET_T
#define _SIGSET_T
typedef unsigned long sigset_t;
#endif
/* Open Group Base Specifications Issue 6 (not complete) */
typedef long useconds_t; /* Time in microseconds */
/* Types used in disk, inode, etc. data structures. */
typedef short dev_t; /* holds (major|minor) device pair */
typedef char gid_t; /* group id */
typedef unsigned long ino_t; /* i-node number (V3 filesystem) */
typedef unsigned short mode_t; /* file type and permissions bits */
typedef short nlink_t; /* number of links to a file */
typedef unsigned long off_t; /* offset within a file */
typedef int pid_t; /* process id (must be signed) */
typedef short uid_t; /* user id */
typedef unsigned long zone_t; /* zone number */
typedef unsigned long block_t; /* block number */
typedef unsigned long bit_t; /* bit number in a bit map */
typedef unsigned short zone1_t; /* zone number for V1 file systems */
typedef unsigned short bitchunk_t; /* collection of bits in a bitmap */
typedef unsigned char u8_t; /* 8 bit type */
typedef unsigned short u16_t; /* 16 bit type */
typedef unsigned long u32_t; /* 32 bit type */
typedef char i8_t; /* 8 bit signed type */
typedef short i16_t; /* 16 bit signed type */
typedef long i32_t; /* 32 bit signed type */
typedef struct { u32_t _[2]; } u64_t;
/* The following types are needed because MINIX uses K&R style function
* definitions (for maximum portability). When a short, such as dev_t, is
* passed to a function with a K&R definition, the compiler automatically
* promotes it to an int. The prototype must contain an int as the parameter,
* not a short, because an int is what an old-style function definition
* expects. Thus using dev_t in a prototype would be incorrect. It would be
* sufficient to just use int instead of dev_t in the prototypes, but Dev_t
* is clearer.
*/
typedef int Dev_t;
typedef int _mnx_Gid_t;
typedef int Nlink_t;
typedef int _mnx_Uid_t;
typedef int U8_t;
typedef unsigned long U32_t;
typedef int I8_t;
typedef int I16_t;
typedef long I32_t;
/* ANSI C makes writing down the promotion of unsigned types very messy. When
* sizeof(short) == sizeof(int), there is no promotion, so the type stays
* unsigned. When the compiler is not ANSI, there is usually no loss of
* unsignedness, and there are usually no prototypes so the promoted type
* doesn't matter. The use of types like Ino_t is an attempt to use ints
* (which are not promoted) while providing information to the reader.
*/
typedef unsigned long Ino_t;
#if _EM_WSIZE == 2
/*typedef unsigned int Ino_t; Ino_t is now 32 bits */
typedef unsigned int Zone1_t;
typedef unsigned int Bitchunk_t;
typedef unsigned int U16_t;
typedef unsigned int _mnx_Mode_t;
#else /* _EM_WSIZE == 4, or _EM_WSIZE undefined */
/*typedef int Ino_t; Ino_t is now 32 bits */
typedef int Zone1_t;
typedef int Bitchunk_t;
typedef int U16_t;
typedef int _mnx_Mode_t;
#endif /* _EM_WSIZE == 2, etc */
/* Signal handler type, e.g. SIG_IGN */
typedef void _PROTOTYPE( (*sighandler_t), (int) );
/* Compatibility with other systems */
typedef unsigned char u_char;
typedef unsigned short u_short;
typedef unsigned int u_int;
typedef unsigned long u_long;
typedef char *caddr_t;
/* Devices. */
#define MAJOR 8 /* major device = (dev>>MAJOR) & 0377 */
#define MINOR 0 /* minor device = (dev>>MINOR) & 0377 */
#ifndef minor
#define minor(dev) (((dev) >> MINOR) & 0xff)
#endif
#ifndef major
#define major(dev) (((dev) >> MAJOR) & 0xff)
#endif
#ifndef makedev
#define makedev(major, minor) \
((dev_t) (((major) << MAJOR) | ((minor) << MINOR)))
#endif
#endif /* _TYPES_H */