1 | /* The <unistd.h> header contains a few miscellaneous manifest constants. */
|
---|
2 |
|
---|
3 | #ifndef _UNISTD_H
|
---|
4 | #define _UNISTD_H
|
---|
5 |
|
---|
6 | #ifndef _TYPES_H
|
---|
7 | #include <sys/types.h>
|
---|
8 | #endif
|
---|
9 |
|
---|
10 | /* Values used by access(). POSIX Table 2-8. */
|
---|
11 | #define F_OK 0 /* test if file exists */
|
---|
12 | #define X_OK 1 /* test if file is executable */
|
---|
13 | #define W_OK 2 /* test if file is writable */
|
---|
14 | #define R_OK 4 /* test if file is readable */
|
---|
15 |
|
---|
16 | /* Values used for whence in lseek(fd, offset, whence). POSIX Table 2-9. */
|
---|
17 | #define SEEK_SET 0 /* offset is absolute */
|
---|
18 | #define SEEK_CUR 1 /* offset is relative to current position */
|
---|
19 | #define SEEK_END 2 /* offset is relative to end of file */
|
---|
20 |
|
---|
21 | /* This value is required by POSIX Table 2-10. */
|
---|
22 | #define _POSIX_VERSION 199009L /* which standard is being conformed to */
|
---|
23 |
|
---|
24 | /* These three definitions are required by POSIX Sec. 8.2.1.2. */
|
---|
25 | #define STDIN_FILENO 0 /* file descriptor for stdin */
|
---|
26 | #define STDOUT_FILENO 1 /* file descriptor for stdout */
|
---|
27 | #define STDERR_FILENO 2 /* file descriptor for stderr */
|
---|
28 |
|
---|
29 | #ifdef _MINIX
|
---|
30 | /* How to exit the system or stop a server process. */
|
---|
31 | #define RBT_HALT 0
|
---|
32 | #define RBT_REBOOT 1
|
---|
33 | #define RBT_PANIC 2 /* a server panics */
|
---|
34 | #define RBT_MONITOR 3 /* let the monitor do this */
|
---|
35 | #define RBT_RESET 4 /* hard reset the system */
|
---|
36 | #endif
|
---|
37 |
|
---|
38 | /* What system info to retrieve with sysgetinfo(). */
|
---|
39 | #define SI_KINFO 0 /* get kernel info via PM */
|
---|
40 | #define SI_PROC_ADDR 1 /* address of process table */
|
---|
41 | #define SI_PROC_TAB 2 /* copy of entire process table */
|
---|
42 | #define SI_DMAP_TAB 3 /* get device <-> driver mappings */
|
---|
43 |
|
---|
44 | /* NULL must be defined in <unistd.h> according to POSIX Sec. 2.7.1. */
|
---|
45 | #define NULL ((void *)0)
|
---|
46 |
|
---|
47 | /* The following relate to configurable system variables. POSIX Table 4-2. */
|
---|
48 | #define _SC_ARG_MAX 1
|
---|
49 | #define _SC_CHILD_MAX 2
|
---|
50 | #define _SC_CLOCKS_PER_SEC 3
|
---|
51 | #define _SC_CLK_TCK 3
|
---|
52 | #define _SC_NGROUPS_MAX 4
|
---|
53 | #define _SC_OPEN_MAX 5
|
---|
54 | #define _SC_JOB_CONTROL 6
|
---|
55 | #define _SC_SAVED_IDS 7
|
---|
56 | #define _SC_VERSION 8
|
---|
57 | #define _SC_STREAM_MAX 9
|
---|
58 | #define _SC_TZNAME_MAX 10
|
---|
59 |
|
---|
60 | /* The following relate to configurable pathname variables. POSIX Table 5-2. */
|
---|
61 | #define _PC_LINK_MAX 1 /* link count */
|
---|
62 | #define _PC_MAX_CANON 2 /* size of the canonical input queue */
|
---|
63 | #define _PC_MAX_INPUT 3 /* type-ahead buffer size */
|
---|
64 | #define _PC_NAME_MAX 4 /* file name size */
|
---|
65 | #define _PC_PATH_MAX 5 /* pathname size */
|
---|
66 | #define _PC_PIPE_BUF 6 /* pipe size */
|
---|
67 | #define _PC_NO_TRUNC 7 /* treatment of long name components */
|
---|
68 | #define _PC_VDISABLE 8 /* tty disable */
|
---|
69 | #define _PC_CHOWN_RESTRICTED 9 /* chown restricted or not */
|
---|
70 |
|
---|
71 | /* POSIX defines several options that may be implemented or not, at the
|
---|
72 | * implementer's whim. This implementer has made the following choices:
|
---|
73 | *
|
---|
74 | * _POSIX_JOB_CONTROL not defined: no job control
|
---|
75 | * _POSIX_SAVED_IDS not defined: no saved uid/gid
|
---|
76 | * _POSIX_NO_TRUNC defined as -1: long path names are truncated
|
---|
77 | * _POSIX_CHOWN_RESTRICTED defined: you can't give away files
|
---|
78 | * _POSIX_VDISABLE defined: tty functions can be disabled
|
---|
79 | */
|
---|
80 | #define _POSIX_NO_TRUNC (-1)
|
---|
81 | #define _POSIX_CHOWN_RESTRICTED 1
|
---|
82 |
|
---|
83 | /* Function Prototypes. */
|
---|
84 | _PROTOTYPE( void _exit, (int _status) );
|
---|
85 | _PROTOTYPE( int access, (const char *_path, int _amode) );
|
---|
86 | _PROTOTYPE( unsigned int alarm, (unsigned int _seconds) );
|
---|
87 | _PROTOTYPE( int chdir, (const char *_path) );
|
---|
88 | _PROTOTYPE( int fchdir, (int fd) );
|
---|
89 | _PROTOTYPE( int chown, (const char *_path, _mnx_Uid_t _owner, _mnx_Gid_t _group) );
|
---|
90 | _PROTOTYPE( int close, (int _fd) );
|
---|
91 | _PROTOTYPE( char *ctermid, (char *_s) );
|
---|
92 | _PROTOTYPE( char *cuserid, (char *_s) );
|
---|
93 | _PROTOTYPE( int dup, (int _fd) );
|
---|
94 | _PROTOTYPE( int dup2, (int _fd, int _fd2) );
|
---|
95 | _PROTOTYPE( int execl, (const char *_path, const char *_arg, ...) );
|
---|
96 | _PROTOTYPE( int execle, (const char *_path, const char *_arg, ...) );
|
---|
97 | _PROTOTYPE( int execlp, (const char *_file, const char *arg, ...) );
|
---|
98 | _PROTOTYPE( int execv, (const char *_path, char *const _argv[]) );
|
---|
99 | _PROTOTYPE( int execve, (const char *_path, char *const _argv[],
|
---|
100 | char *const _envp[]) );
|
---|
101 | _PROTOTYPE( int execvp, (const char *_file, char *const _argv[]) );
|
---|
102 | _PROTOTYPE( pid_t fork, (void) );
|
---|
103 | _PROTOTYPE( long fpathconf, (int _fd, int _name) );
|
---|
104 | _PROTOTYPE( char *getcwd, (char *_buf, size_t _size) );
|
---|
105 | _PROTOTYPE( gid_t getegid, (void) );
|
---|
106 | _PROTOTYPE( uid_t geteuid, (void) );
|
---|
107 | _PROTOTYPE( gid_t getgid, (void) );
|
---|
108 | _PROTOTYPE( int getgroups, (int _gidsetsize, gid_t _grouplist[]) );
|
---|
109 | _PROTOTYPE( char *getlogin, (void) );
|
---|
110 | _PROTOTYPE( pid_t getpgrp, (void) );
|
---|
111 | _PROTOTYPE( pid_t getpid, (void) );
|
---|
112 | _PROTOTYPE( pid_t getppid, (void) );
|
---|
113 | _PROTOTYPE( uid_t getuid, (void) );
|
---|
114 | _PROTOTYPE( int isatty, (int _fd) );
|
---|
115 | _PROTOTYPE( int link, (const char *_existing, const char *_new) );
|
---|
116 | _PROTOTYPE( off_t lseek, (int _fd, off_t _offset, int _whence) );
|
---|
117 | _PROTOTYPE( long pathconf, (const char *_path, int _name) );
|
---|
118 | _PROTOTYPE( int pause, (void) );
|
---|
119 | _PROTOTYPE( int pipe, (int _fildes[2]) );
|
---|
120 | _PROTOTYPE( ssize_t read, (int _fd, void *_buf, size_t _n) );
|
---|
121 | _PROTOTYPE( int rmdir, (const char *_path) );
|
---|
122 | _PROTOTYPE( int setgid, (_mnx_Gid_t _gid) );
|
---|
123 | _PROTOTYPE( int setpgid, (pid_t _pid, pid_t _pgid) );
|
---|
124 | _PROTOTYPE( pid_t setsid, (void) );
|
---|
125 | _PROTOTYPE( int setuid, (_mnx_Uid_t _uid) );
|
---|
126 | _PROTOTYPE( unsigned int sleep, (unsigned int _seconds) );
|
---|
127 | _PROTOTYPE( long sysconf, (int _name) );
|
---|
128 | _PROTOTYPE( pid_t tcgetpgrp, (int _fd) );
|
---|
129 | _PROTOTYPE( int tcsetpgrp, (int _fd, pid_t _pgrp_id) );
|
---|
130 | _PROTOTYPE( char *ttyname, (int _fd) );
|
---|
131 | _PROTOTYPE( int unlink, (const char *_path) );
|
---|
132 | _PROTOTYPE( ssize_t write, (int _fd, const void *_buf, size_t _n) );
|
---|
133 |
|
---|
134 | /* Open Group Base Specifications Issue 6 (not complete) */
|
---|
135 | _PROTOTYPE( int symlink, (const char *path1, const char *path2) );
|
---|
136 | _PROTOTYPE( int getopt, (int _argc, char **_argv, char *_opts) );
|
---|
137 | extern char *optarg;
|
---|
138 | extern int optind, opterr, optopt;
|
---|
139 | _PROTOTYPE( int usleep, (useconds_t _useconds) );
|
---|
140 |
|
---|
141 | #ifdef _MINIX
|
---|
142 | #ifndef _TYPE_H
|
---|
143 | #include <minix/type.h>
|
---|
144 | #endif
|
---|
145 | _PROTOTYPE( int brk, (char *_addr) );
|
---|
146 | _PROTOTYPE( int chroot, (const char *_name) );
|
---|
147 | _PROTOTYPE( int mknod, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr) );
|
---|
148 | _PROTOTYPE( int mknod4, (const char *_name, _mnx_Mode_t _mode, Dev_t _addr,
|
---|
149 | long _size) );
|
---|
150 | _PROTOTYPE( char *mktemp, (char *_template) );
|
---|
151 | _PROTOTYPE( int mount, (char *_spec, char *_name, int _flag) );
|
---|
152 | _PROTOTYPE( long ptrace, (int _req, pid_t _pid, long _addr, long _data) );
|
---|
153 | _PROTOTYPE( char *sbrk, (int _incr) );
|
---|
154 | _PROTOTYPE( int sync, (void) );
|
---|
155 | _PROTOTYPE( int fsync, (int fd) );
|
---|
156 | _PROTOTYPE( int umount, (const char *_name) );
|
---|
157 | _PROTOTYPE( int reboot, (int _how, ...) );
|
---|
158 | _PROTOTYPE( int gethostname, (char *_hostname, size_t _len) );
|
---|
159 | _PROTOTYPE( int getdomainname, (char *_domain, size_t _len) );
|
---|
160 | _PROTOTYPE( int ttyslot, (void) );
|
---|
161 | _PROTOTYPE( int fttyslot, (int _fd) );
|
---|
162 | _PROTOTYPE( char *crypt, (const char *_key, const char *_salt) );
|
---|
163 | _PROTOTYPE( int getsysinfo, (int who, int what, void *where) );
|
---|
164 | _PROTOTYPE( int getprocnr, (void) );
|
---|
165 | _PROTOTYPE( int findproc, (char *proc_name, int *proc_nr) );
|
---|
166 | _PROTOTYPE( int allocmem, (phys_bytes size, phys_bytes *base) );
|
---|
167 | _PROTOTYPE( int freemem, (phys_bytes size, phys_bytes base) );
|
---|
168 | #define DEV_MAP 1
|
---|
169 | #define DEV_UNMAP 2
|
---|
170 | #define mapdriver(driver, device, style) devctl(DEV_MAP, driver, device, style)
|
---|
171 | #define unmapdriver(device) devctl(DEV_UNMAP, 0, device, 0)
|
---|
172 | _PROTOTYPE( int devctl, (int ctl_req, int driver, int device, int style));
|
---|
173 |
|
---|
174 | /* For compatibility with other Unix systems */
|
---|
175 | _PROTOTYPE( int getpagesize, (void) );
|
---|
176 | _PROTOTYPE( int setgroups, (int ngroups, const gid_t *gidset) );
|
---|
177 |
|
---|
178 | #endif
|
---|
179 |
|
---|
180 | _PROTOTYPE( int readlink, (const char *, char *, int));
|
---|
181 | _PROTOTYPE( int getopt, (int, char **, char *));
|
---|
182 | extern int optind, opterr, optopt;
|
---|
183 |
|
---|
184 | #endif /* _UNISTD_H */
|
---|