2012-03-02 Kees Cook <keescook@chromium.org>
[glibc.git] / include / unistd.h
blob2e6101b0d0aafeae7ad1e8ee46705d418bb88354
1 #ifndef _UNISTD_H
2 # include <posix/unistd.h>
4 # ifndef _ISOMAC
5 __BEGIN_DECLS
7 libc_hidden_proto (_exit, __noreturn__)
8 libc_hidden_proto (alarm)
9 libc_hidden_proto (confstr)
10 libc_hidden_proto (execl)
11 libc_hidden_proto (execle)
12 libc_hidden_proto (execlp)
13 libc_hidden_proto (execvp)
14 libc_hidden_proto (getpid)
15 libc_hidden_proto (getsid)
16 libc_hidden_proto (getdomainname)
17 libc_hidden_proto (getlogin_r)
18 libc_hidden_proto (seteuid)
19 libc_hidden_proto (setegid)
20 libc_hidden_proto (tcgetpgrp)
21 libc_hidden_proto (readlinkat)
23 /* Now define the internal interfaces. */
24 extern int __access (const char *__name, int __type);
25 extern int __euidaccess (const char *__name, int __type);
26 extern __off64_t __lseek64 (int __fd, __off64_t __offset, int __whence);
27 extern __off_t __lseek (int __fd, __off_t __offset, int __whence);
28 libc_hidden_proto (__lseek)
29 extern __off_t __libc_lseek (int __fd, __off_t __offset, int __whence);
30 extern __off64_t __libc_lseek64 (int __fd, __off64_t __offset, int __whence);
31 extern ssize_t __pread (int __fd, void *__buf, size_t __nbytes,
32 __off_t __offset);
33 extern ssize_t __libc_pread (int __fd, void *__buf, size_t __nbytes,
34 __off_t __offset);
35 extern ssize_t __pread64 (int __fd, void *__buf, size_t __nbytes,
36 __off64_t __offset);
37 extern ssize_t __libc_pread64 (int __fd, void *__buf, size_t __nbytes,
38 __off64_t __offset);
39 extern ssize_t __pwrite (int __fd, const void *__buf, size_t __n,
40 __off_t __offset);
41 extern ssize_t __libc_pwrite (int __fd, const void *__buf, size_t __n,
42 __off_t __offset);
43 extern ssize_t __pwrite64 (int __fd, const void *__buf, size_t __n,
44 __off64_t __offset);
45 libc_hidden_proto (__pwrite64)
46 extern ssize_t __libc_pwrite64 (int __fd, const void *__buf, size_t __n,
47 __off64_t __offset);
48 extern ssize_t __libc_read (int __fd, void *__buf, size_t __n);
49 libc_hidden_proto (__libc_read)
50 extern ssize_t __libc_write (int __fd, const void *__buf, size_t __n);
51 libc_hidden_proto (__libc_write)
52 extern int __pipe (int __pipedes[2]);
53 libc_hidden_proto (__pipe)
54 extern int __pipe2 (int __pipedes[2], int __flags);
55 extern unsigned int __sleep (unsigned int __seconds);
56 extern int __chown (const char *__file,
57 __uid_t __owner, __gid_t __group);
58 libc_hidden_proto (__chown)
59 extern int __fchown (int __fd,
60 __uid_t __owner, __gid_t __group);
61 extern int __lchown (const char *__file, __uid_t __owner,
62 __gid_t __group);
63 extern int __chdir (const char *__path);
64 extern int __fchdir (int __fd);
65 extern char *__getcwd (char *__buf, size_t __size);
66 extern int __rmdir (const char *__path);
67 extern int __execvpe (const char *file, char *const argv[],
68 char *const envp[]);
70 /* Get the canonical absolute name of the named directory, and put it in SIZE
71 bytes of BUF. Returns NULL if the directory couldn't be determined or
72 SIZE was too small. If successful, returns BUF. In GNU, if BUF is
73 NULL, an array is allocated with `malloc'; the array is SIZE bytes long,
74 unless SIZE <= 0, in which case it is as big as necessary. */
76 char *__canonicalize_directory_name_internal (const char *__thisdir,
77 char *__buf,
78 size_t __size) attribute_hidden;
80 extern int __dup (int __fd);
81 extern int __dup2 (int __fd, int __fd2);
82 libc_hidden_proto (__dup2)
83 libc_hidden_proto (dup3)
84 extern int __execve (const char *__path, char *const __argv[],
85 char *const __envp[]);
86 extern long int __pathconf (const char *__path, int __name);
87 extern long int __fpathconf (int __fd, int __name);
88 extern long int __sysconf (int __name);
89 libc_hidden_proto (__sysconf)
90 extern __pid_t __getpid (void);
91 libc_hidden_proto (__getpid)
92 extern __pid_t __getppid (void);
93 extern __pid_t __setsid (void);
94 extern __uid_t __getuid (void);
95 extern __uid_t __geteuid (void);
96 extern __gid_t __getgid (void);
97 extern __gid_t __getegid (void);
98 extern int __getgroups (int __size, __gid_t __list[]);
99 libc_hidden_proto (__getpgid)
100 extern int __group_member (__gid_t __gid);
101 extern int __setuid (__uid_t __uid);
102 extern int __setreuid (__uid_t __ruid, __uid_t __euid);
103 extern int __setgid (__gid_t __gid);
104 extern int __setpgid (__pid_t __pid, __pid_t __pgid);
105 libc_hidden_proto (__setpgid)
106 extern int __setregid (__gid_t __rgid, __gid_t __egid);
107 extern int __getresuid (__uid_t *__ruid, __uid_t *__euid, __uid_t *__suid);
108 extern int __getresgid (__gid_t *__rgid, __gid_t *__egid, __gid_t *__sgid);
109 extern int __setresuid (__uid_t __ruid, __uid_t __euid, __uid_t __suid);
110 extern int __setresgid (__gid_t __rgid, __gid_t __egid, __gid_t __sgid);
111 libc_hidden_proto (__getresuid)
112 libc_hidden_proto (__getresgid)
113 libc_hidden_proto (__setresuid)
114 libc_hidden_proto (__setresgid)
115 extern __pid_t __vfork (void);
116 libc_hidden_proto (__vfork)
117 extern int __ttyname_r (int __fd, char *__buf, size_t __buflen);
118 extern int __isatty (int __fd);
119 extern int __link (const char *__from, const char *__to);
120 extern int __symlink (const char *__from, const char *__to);
121 extern ssize_t __readlink (const char *__path, char *__buf, size_t __len);
122 extern int __unlink (const char *__name);
123 extern int __gethostname (char *__name, size_t __len);
124 extern int __profil (unsigned short int *__sample_buffer, size_t __size,
125 size_t __offset, unsigned int __scale);
126 extern int __getdtablesize (void);
127 extern int __brk (void *__addr);
128 extern int __close (int __fd);
129 libc_hidden_proto (__close)
130 extern int __libc_close (int __fd);
131 extern ssize_t __read (int __fd, void *__buf, size_t __nbytes);
132 libc_hidden_proto (__read)
133 extern ssize_t __write (int __fd, const void *__buf, size_t __n);
134 libc_hidden_proto (__write)
135 extern __pid_t __fork (void);
136 libc_hidden_proto (__fork)
137 extern int __getpagesize (void) __attribute__ ((__const__));
138 libc_hidden_proto (__getpagesize)
139 extern int __ftruncate (int __fd, __off_t __length);
140 extern int __ftruncate64 (int __fd, __off64_t __length);
141 extern int __truncate (const char *path, __off_t __length);
142 extern void *__sbrk (intptr_t __delta);
143 libc_hidden_proto (__sbrk)
146 /* This variable is set nonzero at startup if the process's effective
147 IDs differ from its real IDs, or it is otherwise indicated that
148 extra security should be used. When this is set the dynamic linker
149 and some functions contained in the C library ignore various
150 environment variables that normally affect them. */
151 extern int __libc_enable_secure attribute_relro;
152 extern int __libc_enable_secure_decided;
153 #ifdef IS_IN_rtld
154 /* XXX The #ifdef should go. */
155 extern int __libc_enable_secure_internal attribute_relro attribute_hidden;
156 #endif
159 /* Various internal function. */
160 extern void __libc_check_standard_fds (void);
163 /* Special exit function which only terminates the current thread. */
164 extern void __exit_thread (int val) __attribute__ ((noreturn));
166 /* Internal name for fork function. */
167 extern __pid_t __libc_fork (void);
169 /* Suspend the process until a signal arrives.
170 This always returns -1 and sets `errno' to EINTR. */
171 extern int __libc_pause (void);
172 /* Not cancelable variant. */
173 extern int __pause_nocancel (void) attribute_hidden;
175 extern int __have_sock_cloexec;
176 /* At lot of other functionality became available at the same time as
177 SOCK_CLOEXEC. Avoid defining separate variables for all of them
178 unless it is really necessary. */
179 #define __have_pipe2 __have_sock_cloexec
180 #define __have_dup3 __have_sock_cloexec
182 extern int __getlogin_r_loginuid (char *name, size_t namesize)
183 attribute_hidden;
185 __END_DECLS
186 # endif
188 #endif