1 | #ifndef _UNISTD_H |
2 | # include <posix/unistd.h> |
3 | |
4 | # ifndef _ISOMAC |
5 | |
6 | # include <stdbool.h> |
7 | # include <kernel-features.h> |
8 | # include <bits/unistd-decl.h> |
9 | |
10 | libc_hidden_proto (_exit, __noreturn__) |
11 | # ifndef NO_RTLD_HIDDEN |
12 | rtld_hidden_proto (_exit, __noreturn__) |
13 | # endif |
14 | libc_hidden_proto (alarm) |
15 | extern size_t __confstr (int name, char *buf, size_t len); |
16 | libc_hidden_proto (__confstr) |
17 | libc_hidden_proto (confstr) |
18 | libc_hidden_proto (execl) |
19 | libc_hidden_proto (execle) |
20 | libc_hidden_proto (execlp) |
21 | libc_hidden_proto (execvp) |
22 | libc_hidden_proto (getpid) |
23 | libc_hidden_proto (getsid) |
24 | libc_hidden_proto (getdomainname) |
25 | extern __typeof (getlogin_r) __getlogin_r __nonnull ((1)); |
26 | libc_hidden_proto (__getlogin_r) |
27 | libc_hidden_proto (getlogin_r) |
28 | libc_hidden_proto (seteuid) |
29 | libc_hidden_proto (setegid) |
30 | libc_hidden_proto (tcgetpgrp) |
31 | libc_hidden_proto (readlinkat) |
32 | libc_hidden_proto (fsync) |
33 | libc_hidden_proto (fdatasync) |
34 | |
35 | libc_hidden_proto (__read_chk) |
36 | libc_hidden_proto (__getdomainname_chk) |
37 | libc_hidden_proto (__getlogin_r_chk) |
38 | |
39 | /* Now define the internal interfaces. */ |
40 | extern int __access (const char *__name, int __type); |
41 | libc_hidden_proto (__access) |
42 | extern int __euidaccess (const char *__name, int __type); |
43 | extern int __faccessat (int __fd, const char *__file, int __type, int __flag); |
44 | extern int __faccessat_noerrno (int __fd, const char *__file, int __type, |
45 | int __flag); |
46 | extern __off64_t __lseek64 (int __fd, __off64_t __offset, int __whence); |
47 | extern __off_t __lseek (int __fd, __off_t __offset, int __whence); |
48 | libc_hidden_proto (__lseek) |
49 | extern __off_t __libc_lseek (int __fd, __off_t __offset, int __whence); |
50 | extern __off64_t __libc_lseek64 (int __fd, __off64_t __offset, int __whence); |
51 | extern ssize_t __pread (int __fd, void *__buf, size_t __nbytes, |
52 | __off_t __offset); |
53 | libc_hidden_proto (__pread); |
54 | extern ssize_t __libc_pread (int __fd, void *__buf, size_t __nbytes, |
55 | __off_t __offset); |
56 | extern ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes, |
57 | __off64_t __offset); |
58 | libc_hidden_proto (__pread64); |
59 | extern ssize_t __libc_pread64 (int __fd, void *__buf, size_t __nbytes, |
60 | __off64_t __offset); |
61 | extern ssize_t __pwrite (int __fd, const void *__buf, size_t __n, |
62 | __off_t __offset); |
63 | libc_hidden_proto (__pwrite) |
64 | extern ssize_t __libc_pwrite (int __fd, const void *__buf, size_t __n, |
65 | __off_t __offset); |
66 | extern ssize_t __pwrite64 (int __fd, const void *__buf, size_t __n, |
67 | __off64_t __offset); |
68 | libc_hidden_proto (__pwrite64) |
69 | extern ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __n, |
70 | __off64_t __offset); |
71 | extern ssize_t __libc_read (int __fd, void *__buf, size_t __n); |
72 | libc_hidden_proto (__libc_read) |
73 | libc_hidden_proto (read) |
74 | extern ssize_t __libc_write (int __fd, const void *__buf, size_t __n); |
75 | libc_hidden_proto (__libc_write) |
76 | libc_hidden_proto (write) |
77 | extern int __pipe (int __pipedes[2]); |
78 | libc_hidden_proto (__pipe) |
79 | extern int __pipe2 (int __pipedes[2], int __flags) attribute_hidden; |
80 | extern unsigned int __sleep (unsigned int __seconds) attribute_hidden; |
81 | extern int __chown (const char *__file, |
82 | __uid_t __owner, __gid_t __group); |
83 | libc_hidden_proto (__chown) |
84 | extern int __fchown (int __fd, |
85 | __uid_t __owner, __gid_t __group); |
86 | extern int __fchownat (int __fd, const char *__file, uid_t __owner, gid_t __group, int __flag); |
87 | extern int __lchown (const char *__file, __uid_t __owner, |
88 | __gid_t __group); |
89 | extern int __chdir (const char *__path) attribute_hidden; |
90 | extern int __fchdir (int __fd) attribute_hidden; |
91 | extern char *__getcwd (char *__buf, size_t __size); |
92 | libc_hidden_proto (__getcwd) |
93 | extern int __rmdir (const char *__path) attribute_hidden; |
94 | extern int __execvpe (const char *file, char *const argv[], |
95 | char *const envp[]) attribute_hidden; |
96 | extern int __execvpex (const char *file, char *const argv[], |
97 | char *const envp[]) attribute_hidden; |
98 | |
99 | /* Get the canonical absolute name of the named directory, and put it in SIZE |
100 | bytes of BUF. Returns NULL if the directory couldn't be determined or |
101 | SIZE was too small. If successful, returns BUF. In GNU, if BUF is |
102 | NULL, an array is allocated with `malloc'; the array is SIZE bytes long, |
103 | unless SIZE <= 0, in which case it is as big as necessary. */ |
104 | |
105 | char *__canonicalize_directory_name_internal (const char *__thisdir, |
106 | char *__buf, |
107 | size_t __size) attribute_hidden; |
108 | |
109 | extern int __dup (int __fd); |
110 | libc_hidden_proto (__dup) |
111 | extern int __dup2 (int __fd, int __fd2); |
112 | libc_hidden_proto (__dup2) |
113 | extern int __dup3 (int __fd, int __fd2, int flags); |
114 | libc_hidden_proto (__dup3) |
115 | extern int __execve (const char *__path, char *const __argv[], |
116 | char *const __envp[]) attribute_hidden; |
117 | extern int __execveat (int dirfd, const char *__path, char *const __argv[], |
118 | char *const __envp[], int flags) attribute_hidden; |
119 | extern long int __pathconf (const char *__path, int __name); |
120 | extern long int __fpathconf (int __fd, int __name); |
121 | extern long int __sysconf (int __name); |
122 | libc_hidden_proto (__sysconf) |
123 | extern __pid_t __getpid (void); |
124 | libc_hidden_proto (__getpid) |
125 | extern __pid_t __getppid (void); |
126 | extern __pid_t __setsid (void) attribute_hidden; |
127 | extern __uid_t __getuid (void) attribute_hidden; |
128 | extern __uid_t __geteuid (void) attribute_hidden; |
129 | extern __gid_t __getgid (void) attribute_hidden; |
130 | extern __gid_t __getegid (void) attribute_hidden; |
131 | extern int __getgroups (int __size, __gid_t __list[]) attribute_hidden; |
132 | libc_hidden_proto (__getpgid) |
133 | extern int __group_member (__gid_t __gid) attribute_hidden; |
134 | extern int __setuid (__uid_t __uid); |
135 | extern int __setreuid (__uid_t __ruid, __uid_t __euid); |
136 | extern int __setgid (__gid_t __gid); |
137 | extern int __setpgid (__pid_t __pid, __pid_t __pgid); |
138 | libc_hidden_proto (__setpgid) |
139 | extern int __setregid (__gid_t __rgid, __gid_t __egid); |
140 | extern int __getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid); |
141 | extern int __getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid); |
142 | extern int __setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid); |
143 | extern int __setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid); |
144 | libc_hidden_proto (__getresuid) |
145 | libc_hidden_proto (__getresgid) |
146 | libc_hidden_proto (__setresuid) |
147 | libc_hidden_proto (__setresgid) |
148 | extern __pid_t __vfork (void); |
149 | libc_hidden_proto (__vfork) |
150 | extern int __ttyname_r (int __fd, char *__buf, size_t __buflen); |
151 | libc_hidden_proto (__ttyname_r) |
152 | extern __pid_t _Fork (void); |
153 | libc_hidden_proto (_Fork); |
154 | extern int __isatty (int __fd) attribute_hidden; |
155 | extern int __link (const char *__from, const char *__to); |
156 | extern int __symlink (const char *__from, const char *__to); |
157 | extern int __symlinkat (const char *__from, int __fd, const char *__to); |
158 | extern ssize_t __readlink (const char *__path, char *__buf, size_t __len) |
159 | attribute_hidden; |
160 | extern ssize_t __readlinkat (int __fd, const char *__file_name, char *__buf, size_t __len); |
161 | extern int __unlink (const char *__name) attribute_hidden; |
162 | extern int __unlinkat (int __fd, const char *__name, int __flag); |
163 | extern int __gethostname (char *__name, size_t __len) attribute_hidden; |
164 | extern int __revoke (const char *__file); |
165 | extern int __profil (unsigned short int *__sample_buffer, size_t __size, |
166 | size_t __offset, unsigned int __scale) |
167 | attribute_hidden; |
168 | extern int __getdtablesize (void) attribute_hidden; |
169 | extern int __brk (void *__addr) attribute_hidden; |
170 | extern int __close (int __fd); |
171 | libc_hidden_proto (__close) |
172 | extern int __libc_close (int __fd); |
173 | # if __ASSUME_CLOSE_RANGE |
174 | static inline _Bool __closefrom_fallback (int __lowfd, _Bool dirfd_fallback) |
175 | { |
176 | return false; |
177 | } |
178 | # else |
179 | extern _Bool __closefrom_fallback (int __lowfd, _Bool) attribute_hidden; |
180 | # endif |
181 | extern ssize_t __read (int __fd, void *__buf, size_t __nbytes); |
182 | libc_hidden_proto (__read) |
183 | extern ssize_t __write (int __fd, const void *__buf, size_t __n); |
184 | libc_hidden_proto (__write) |
185 | extern __pid_t __fork (void); |
186 | libc_hidden_proto (__fork) |
187 | extern int __getpagesize (void) __attribute__ ((__const__)); |
188 | libc_hidden_proto (__getpagesize) |
189 | extern int __ftruncate (int __fd, __off_t __length) attribute_hidden; |
190 | extern int __ftruncate64 (int __fd, __off64_t __length) attribute_hidden; |
191 | extern int __truncate (const char *path, __off_t __length); |
192 | extern void *__sbrk (intptr_t __delta); |
193 | libc_hidden_proto (__sbrk) |
194 | |
195 | extern int __tcsetpgrp (int fd, __pid_t pgrp); |
196 | libc_hidden_proto (__tcsetpgrp) |
197 | |
198 | /* This variable is set nonzero at startup if the process's effective |
199 | IDs differ from its real IDs, or it is otherwise indicated that |
200 | extra security should be used. When this is set the dynamic linker |
201 | and some functions contained in the C library ignore various |
202 | environment variables that normally affect them. */ |
203 | extern int __libc_enable_secure attribute_relro; |
204 | rtld_hidden_proto (__libc_enable_secure) |
205 | |
206 | |
207 | /* Various internal function. */ |
208 | extern void __libc_check_standard_fds (void) attribute_hidden; |
209 | |
210 | |
211 | /* Internal name for fork function. */ |
212 | extern __pid_t __libc_fork (void); |
213 | |
214 | /* Suspend the process until a signal arrives. |
215 | This always returns -1 and sets `errno' to EINTR. */ |
216 | extern int __libc_pause (void); |
217 | |
218 | extern int __getlogin_r_loginuid (char *name, size_t namesize) |
219 | attribute_hidden; |
220 | |
221 | # if IS_IN (rtld) |
222 | # include <dl-unistd.h> |
223 | # endif |
224 | |
225 | # endif |
226 | #endif |
227 | |