]>
Commit | Line | Data |
---|---|---|
64bc6412 EA |
1 | /* unistd.h <[email protected]> */ |
2 | #include <features.h> | |
3 | #include <sys/types.h> | |
4 | ||
5 | #ifndef __UNISTD_H | |
6 | #define __UNISTD_H | |
7 | ||
8 | #include <errno.h> | |
e9efa23a | 9 | #ifdef __mc68000__ |
64bc6412 | 10 | #include <asm/unistd.h> |
e9efa23a | 11 | #endif |
64bc6412 EA |
12 | #define STDIN_FILENO 0 |
13 | #define STDOUT_FILENO 1 | |
14 | #define STDERR_FILENO 2 | |
15 | ||
16 | ||
ca9bd30c EA |
17 | /* NULL-terminated array of "NAME=VALUE" environment variables. */ |
18 | extern char **__environ; | |
19 | extern char **environ; | |
20 | ||
64bc6412 EA |
21 | |
22 | extern int close __P ((int)); | |
23 | extern size_t read __P ((int __fd, char * __buf, size_t __nbytes)); | |
24 | extern size_t write __P ((int __fd, __const char * __buf, size_t __n)); | |
25 | extern off_t lseek __P ((int __fd, off_t __n, int __whence)); | |
26 | extern int pipe __P ((int __pipedes[2])); | |
27 | extern unsigned int alarm __P ((unsigned int __seconds)); | |
28 | extern int sleep __P ((unsigned int __seconds)); | |
29 | extern void usleep __P ((unsigned long __microseconds)); | |
30 | extern int pause __P ((void)); | |
31 | extern char* crypt __P((__const char *__key, __const char *__salt)); | |
32 | extern int isatty __P ((int __fd)); | |
84866232 | 33 | extern char *ttyname __P ((int __fd)); |
64bc6412 EA |
34 | extern int readlink __P ((__const char *__path, char *__buf, size_t __len)); |
35 | extern int link __P ((__const char *__from, __const char *__to)); | |
36 | extern int symlink __P ((__const char *__from, __const char *__to)); | |
37 | extern int readlink __P ((__const char *__path, char *__buf, size_t __len)); | |
38 | extern int unlink __P ((__const char *__name)); | |
39 | extern char *getcwd __P ((char *__buf, size_t __size)); | |
a67c6273 EA |
40 | /* Duplicate FD, returning a new file descriptor on the same file. */ |
41 | extern int dup __P ((int __fd)); | |
42 | /* Duplicate FD to FD2, closing FD2 and making it open on the same file. */ | |
43 | extern int dup2 __P ((int __fd, int __fd2)); | |
64bc6412 EA |
44 | extern int fchdir __P ((int __fd)); |
45 | extern int chdir __P ((__const char *__path)); | |
46 | extern int chown __P ((__const char *__file, | |
47 | uid_t __owner, gid_t __group)); | |
48 | ||
49 | extern int fchown __P ((int __fd, | |
50 | uid_t __owner, gid_t __group)); | |
51 | ||
52 | extern int fsync __P ((int __fd)); | |
53 | ||
54 | extern int sync __P ((void)); | |
55 | ||
56 | extern int rmdir __P ((__const char *__path)); | |
57 | ||
58 | extern int rename __P((__const char* _old, __const char* _new)); | |
59 | ||
60 | extern int access __P ((__const char *__name, int __type)); | |
61 | ||
62 | extern int reboot __P ((int __magic, int __magic_too, int __flag)); | |
63 | ||
64 | extern int mkstemp __P ((char * __template)); | |
65 | extern char * mktemp __P ((char * __template)); | |
66 | ||
67 | extern int _clone __P ((int (*fn)(void *arg), void *child_stack, int flags, void *arg)); | |
68 | ||
56e5d28c EA |
69 | /* Return the current machine's Internet number. */ |
70 | extern long int gethostid __P ((void)); | |
64bc6412 | 71 | |
56e5d28c EA |
72 | /* Put the name of the current host in no more than LEN bytes of NAME. |
73 | The result is null-terminated if LEN is large enough for the full | |
74 | name and the terminator. */ | |
75 | extern int gethostname __P ((char *__name, size_t __len)); | |
76 | ||
77 | /* Set the name of the current host to NAME, which is LEN bytes long. | |
42ee0791 | 78 | This call is restricted to the super-user. */ |
56e5d28c EA |
79 | extern int sethostname __P ((__const char *__name, size_t __len)); |
80 | ||
81 | ||
82 | /* Set the user ID of the calling process to UID. | |
83 | If the calling process is the super-user, set the real | |
84 | and effective user IDs, and the saved set-user-ID to UID; | |
85 | if not, the effective user ID is set to UID. */ | |
86 | extern int setuid __P ((__uid_t __uid)); | |
87 | ||
88 | /* Create a new session with the calling process as its leader. | |
89 | The process group IDs of the session and the calling process | |
90 | are set to the process ID of the calling process, which is returned. */ | |
91 | extern __pid_t setsid __P ((void)); | |
92 | ||
93 | /* Get the real user ID of the calling process. */ | |
94 | extern __uid_t getuid __P ((void)); | |
95 | ||
96 | /* Get the effective user ID of the calling process. */ | |
97 | extern __uid_t geteuid __P ((void)); | |
98 | ||
99 | /* Get the real group ID of the calling process. */ | |
100 | extern __gid_t getgid __P ((void)); | |
101 | ||
102 | /* Get the effective group ID of the calling process. */ | |
103 | extern __gid_t getegid __P ((void)); | |
104 | ||
105 | /* If SIZE is zero, return the number of supplementary groups | |
106 | the calling process is in. Otherwise, fill in the group IDs | |
107 | of its supplementary groups in LIST and return the number written. */ | |
108 | extern int getgroups __P ((int __size, __gid_t __list[])); | |
109 | ||
42ee0791 EA |
110 | |
111 | ||
56e5d28c EA |
112 | /* Return the foreground process group ID of FD. */ |
113 | extern __pid_t tcgetpgrp __P ((int __fd)); | |
114 | /* Set the foreground process group ID of FD set PGRP_ID. */ | |
115 | extern int tcsetpgrp __P ((int __fd, __pid_t __pgrp_id)); | |
42ee0791 | 116 | |
56e5d28c EA |
117 | /* Get the process group ID of the calling process. |
118 | This function is different on old BSD. */ | |
119 | extern __pid_t getpgrp __P ((void)); | |
120 | /* Set the process group ID of the process matching PID to PGID. | |
121 | If PID is zero, the current process's process group ID is set. | |
122 | If PGID is zero, the process ID of the process is used. */ | |
123 | extern int setpgid __P ((__pid_t __pid, __pid_t __pgid)); | |
124 | ||
125 | /* Get the process ID of the calling process. */ | |
126 | extern __pid_t getpid __P ((void)); | |
127 | ||
128 | ||
129 | ||
130 | ||
131 | /* Make PATH be the root directory (the starting point for absolute paths). | |
132 | This call is restricted to the super-user. */ | |
133 | extern int chroot __P ((__const char *__path)); | |
42ee0791 EA |
134 | |
135 | /* Execute PATH with all arguments after PATH until | |
136 | a NULL pointer and environment from `environ'. */ | |
137 | extern int execl __P ((__const char *__path, __const char *__arg, ...)); | |
138 | ||
139 | /* Execute FILE, searching in the `PATH' environment variable if | |
140 | it contains no slashes, with all arguments after FILE until a | |
141 | NULL pointer and environment from `environ'. */ | |
142 | extern int execlp __P ((__const char *__file, __const char *__arg, ...)); | |
143 | ||
144 | /* Execute PATH with arguments ARGV and environment from `environ'. */ | |
145 | extern int execv __P ((__const char *__path, char *__const __argv[])); | |
146 | ||
147 | /* Replace the current process, executing PATH with arguments ARGV and | |
148 | environment ENVP. ARGV and ENVP are terminated by NULL pointers. */ | |
149 | extern int execve __P ((__const char *__path, char *__const __argv[], | |
150 | char *__const __envp[])); | |
151 | /* Execute FILE, searching in the `PATH' environment variable if it contains | |
152 | no slashes, with arguments ARGV and environment from `environ'. */ | |
153 | extern int execvp __P ((__const char *__file, char *__const __argv[])); | |
154 | ||
155 | ||
a67c6273 EA |
156 | /* Execute PATH with arguments ARGV and environment ENVP. */ |
157 | extern int execvep __P ((__const char *path, char *__const __argv[], | |
158 | char *__const __envp[])); | |
42ee0791 | 159 | |
a67c6273 EA |
160 | /* Terminate program execution with the low-order 8 bits of STATUS. */ |
161 | extern void _exit __P ((int __status)) __attribute__ ((__noreturn__)); | |
42ee0791 | 162 | |
a67c6273 EA |
163 | /* Clone the calling process, creating an exact copy. |
164 | * Return -1 for errors, 0 to the new process, | |
165 | * and the process ID of the new process to the old process. */ | |
166 | extern __pid_t __fork __P ((void)); | |
167 | extern __pid_t fork __P ((void)); | |
42ee0791 | 168 | |
a67c6273 EA |
169 | /* Clone the calling process, but without copying the whole address space. |
170 | * The calling process is suspended until the new process exits or is | |
171 | * replaced by a call to `execve'. Return -1 for errors, 0 to the new process, | |
172 | * and the process ID of the new process to the old process. */ | |
173 | extern __pid_t vfork __P ((void)); | |
e9efa23a | 174 | |
56e5d28c EA |
175 | /* Return the number of bytes in a page. This is the system's page size, |
176 | which is not necessarily the same as the hardware page size. */ | |
177 | extern int getpagesize __P ((void)) __attribute__ ((__const__)); | |
178 | ||
179 | #ifdef __USE_POSIX2 | |
180 | /* Get definitions and prototypes for functions to process the | |
181 | arguments in ARGV (ARGC of them, minus the program name) for | |
182 | options given in OPTS. */ | |
183 | # define __need_getopt | |
184 | # include <getopt.h> | |
185 | #endif | |
186 | ||
64bc6412 EA |
187 | |
188 | #ifndef SEEK_SET | |
189 | #define SEEK_SET 0 | |
190 | #define SEEK_CUR 1 | |
191 | #define SEEK_END 2 | |
192 | #endif | |
193 | ||
194 | #ifndef R_OK | |
195 | #define R_OK 4 /* Test for read permission. */ | |
196 | #define W_OK 2 /* Test for write permission. */ | |
197 | #define X_OK 1 /* Test for execute permission. */ | |
198 | #define F_OK 0 /* Test for existence. */ | |
199 | #endif | |
200 | ||
201 | #endif /* __UNISTD_H */ | |
202 | ||
203 |