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