modernc.org/cc@v1.0.1/v2/headers/linux_arm/usr/include/unistd.h (about) 1 /* Copyright (C) 1991-2016 Free Software Foundation, Inc. 2 This file is part of the GNU C Library. 3 4 The GNU C Library is free software; you can redistribute it and/or 5 modify it under the terms of the GNU Lesser General Public 6 License as published by the Free Software Foundation; either 7 version 2.1 of the License, or (at your option) any later version. 8 9 The GNU C Library is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 Lesser General Public License for more details. 13 14 You should have received a copy of the GNU Lesser General Public 15 License along with the GNU C Library; if not, see 16 <http://www.gnu.org/licenses/>. */ 17 18 /* 19 * POSIX Standard: 2.10 Symbolic Constants <unistd.h> 20 */ 21 22 #ifndef _UNISTD_H 23 #define _UNISTD_H 1 24 25 #include <features.h> 26 27 __BEGIN_DECLS 28 /* These may be used to determine what facilities are present at compile time. 29 Their values can be obtained at run time from `sysconf'. */ 30 #ifdef __USE_XOPEN2K8 31 /* POSIX Standard approved as ISO/IEC 9945-1 as of September 2008. */ 32 #define _POSIX_VERSION 200809L 33 #elif defined __USE_XOPEN2K 34 /* POSIX Standard approved as ISO/IEC 9945-1 as of December 2001. */ 35 #define _POSIX_VERSION 200112L 36 #elif defined __USE_POSIX199506 37 /* POSIX Standard approved as ISO/IEC 9945-1 as of June 1995. */ 38 #define _POSIX_VERSION 199506L 39 #elif defined __USE_POSIX199309 40 /* POSIX Standard approved as ISO/IEC 9945-1 as of September 1993. */ 41 #define _POSIX_VERSION 199309L 42 #else 43 /* POSIX Standard approved as ISO/IEC 9945-1 as of September 1990. */ 44 #define _POSIX_VERSION 199009L 45 #endif 46 /* These are not #ifdef __USE_POSIX2 because they are 47 in the theoretically application-owned namespace. */ 48 #ifdef __USE_XOPEN2K8 49 #define __POSIX2_THIS_VERSION 200809L 50 /* The utilities on GNU systems also correspond to this version. */ 51 #elif defined __USE_XOPEN2K 52 /* The utilities on GNU systems also correspond to this version. */ 53 #define __POSIX2_THIS_VERSION 200112L 54 #elif defined __USE_POSIX199506 55 /* The utilities on GNU systems also correspond to this version. */ 56 #define __POSIX2_THIS_VERSION 199506L 57 #else 58 /* The utilities on GNU systems also correspond to this version. */ 59 #define __POSIX2_THIS_VERSION 199209L 60 #endif 61 /* The utilities on GNU systems also correspond to this version. */ 62 #define _POSIX2_VERSION __POSIX2_THIS_VERSION 63 /* This symbol was required until the 2001 edition of POSIX. */ 64 #define _POSIX2_C_VERSION __POSIX2_THIS_VERSION 65 /* If defined, the implementation supports the 66 C Language Bindings Option. */ 67 #define _POSIX2_C_BIND __POSIX2_THIS_VERSION 68 /* If defined, the implementation supports the 69 C Language Development Utilities Option. */ 70 #define _POSIX2_C_DEV __POSIX2_THIS_VERSION 71 /* If defined, the implementation supports the 72 Software Development Utilities Option. */ 73 #define _POSIX2_SW_DEV __POSIX2_THIS_VERSION 74 /* If defined, the implementation supports the 75 creation of locales with the localedef utility. */ 76 #define _POSIX2_LOCALEDEF __POSIX2_THIS_VERSION 77 /* X/Open version number to which the library conforms. It is selectable. */ 78 #ifdef __USE_XOPEN2K8 79 #define _XOPEN_VERSION 700 80 #elif defined __USE_XOPEN2K 81 #define _XOPEN_VERSION 600 82 #elif defined __USE_UNIX98 83 #define _XOPEN_VERSION 500 84 #else 85 #define _XOPEN_VERSION 4 86 #endif 87 /* Commands and utilities from XPG4 are available. */ 88 #define _XOPEN_XCU_VERSION 4 89 /* We are compatible with the old published standards as well. */ 90 #define _XOPEN_XPG2 1 91 #define _XOPEN_XPG3 1 92 #define _XOPEN_XPG4 1 93 /* The X/Open Unix extensions are available. */ 94 #define _XOPEN_UNIX 1 95 /* Encryption is present. */ 96 #define _XOPEN_CRYPT 1 97 /* The enhanced internationalization capabilities according to XPG4.2 98 are present. */ 99 #define _XOPEN_ENH_I18N 1 100 /* The legacy interfaces are also available. */ 101 #define _XOPEN_LEGACY 1 102 /* Get values of POSIX options: 103 104 If these symbols are defined, the corresponding features are 105 always available. If not, they may be available sometimes. 106 The current values can be obtained with `sysconf'. 107 108 _POSIX_JOB_CONTROL Job control is supported. 109 _POSIX_SAVED_IDS Processes have a saved set-user-ID 110 and a saved set-group-ID. 111 _POSIX_REALTIME_SIGNALS Real-time, queued signals are supported. 112 _POSIX_PRIORITY_SCHEDULING Priority scheduling is supported. 113 _POSIX_TIMERS POSIX.4 clocks and timers are supported. 114 _POSIX_ASYNCHRONOUS_IO Asynchronous I/O is supported. 115 _POSIX_PRIORITIZED_IO Prioritized asynchronous I/O is supported. 116 _POSIX_SYNCHRONIZED_IO Synchronizing file data is supported. 117 _POSIX_FSYNC The fsync function is present. 118 _POSIX_MAPPED_FILES Mapping of files to memory is supported. 119 _POSIX_MEMLOCK Locking of all memory is supported. 120 _POSIX_MEMLOCK_RANGE Locking of ranges of memory is supported. 121 _POSIX_MEMORY_PROTECTION Setting of memory protections is supported. 122 _POSIX_MESSAGE_PASSING POSIX.4 message queues are supported. 123 _POSIX_SEMAPHORES POSIX.4 counting semaphores are supported. 124 _POSIX_SHARED_MEMORY_OBJECTS POSIX.4 shared memory objects are supported. 125 _POSIX_THREADS POSIX.1c pthreads are supported. 126 _POSIX_THREAD_ATTR_STACKADDR Thread stack address attribute option supported. 127 _POSIX_THREAD_ATTR_STACKSIZE Thread stack size attribute option supported. 128 _POSIX_THREAD_SAFE_FUNCTIONS Thread-safe functions are supported. 129 _POSIX_THREAD_PRIORITY_SCHEDULING 130 POSIX.1c thread execution scheduling supported. 131 _POSIX_THREAD_PRIO_INHERIT Thread priority inheritance option supported. 132 _POSIX_THREAD_PRIO_PROTECT Thread priority protection option supported. 133 _POSIX_THREAD_PROCESS_SHARED Process-shared synchronization supported. 134 _POSIX_PII Protocol-independent interfaces are supported. 135 _POSIX_PII_XTI XTI protocol-indep. interfaces are supported. 136 _POSIX_PII_SOCKET Socket protocol-indep. interfaces are supported. 137 _POSIX_PII_INTERNET Internet family of protocols supported. 138 _POSIX_PII_INTERNET_STREAM Connection-mode Internet protocol supported. 139 _POSIX_PII_INTERNET_DGRAM Connectionless Internet protocol supported. 140 _POSIX_PII_OSI ISO/OSI family of protocols supported. 141 _POSIX_PII_OSI_COTS Connection-mode ISO/OSI service supported. 142 _POSIX_PII_OSI_CLTS Connectionless ISO/OSI service supported. 143 _POSIX_POLL Implementation supports `poll' function. 144 _POSIX_SELECT Implementation supports `select' and `pselect'. 145 146 _XOPEN_REALTIME X/Open realtime support is available. 147 _XOPEN_REALTIME_THREADS X/Open realtime thread support is available. 148 _XOPEN_SHM Shared memory interface according to XPG4.2. 149 150 _XBS5_ILP32_OFF32 Implementation provides environment with 32-bit 151 int, long, pointer, and off_t types. 152 _XBS5_ILP32_OFFBIG Implementation provides environment with 32-bit 153 int, long, and pointer and off_t with at least 154 64 bits. 155 _XBS5_LP64_OFF64 Implementation provides environment with 32-bit 156 int, and 64-bit long, pointer, and off_t types. 157 _XBS5_LPBIG_OFFBIG Implementation provides environment with at 158 least 32 bits int and long, pointer, and off_t 159 with at least 64 bits. 160 161 If any of these symbols is defined as -1, the corresponding option is not 162 true for any file. If any is defined as other than -1, the corresponding 163 option is true for all files. If a symbol is not defined at all, the value 164 for a specific file can be obtained from `pathconf' and `fpathconf'. 165 166 _POSIX_CHOWN_RESTRICTED Only the super user can use `chown' to change 167 the owner of a file. `chown' can only be used 168 to change the group ID of a file to a group of 169 which the calling process is a member. 170 _POSIX_NO_TRUNC Pathname components longer than 171 NAME_MAX generate an error. 172 _POSIX_VDISABLE If defined, if the value of an element of the 173 `c_cc' member of `struct termios' is 174 _POSIX_VDISABLE, no character will have the 175 effect associated with that element. 176 _POSIX_SYNC_IO Synchronous I/O may be performed. 177 _POSIX_ASYNC_IO Asynchronous I/O may be performed. 178 _POSIX_PRIO_IO Prioritized Asynchronous I/O may be performed. 179 180 Support for the Large File Support interface is not generally available. 181 If it is available the following constants are defined to one. 182 _LFS64_LARGEFILE Low-level I/O supports large files. 183 _LFS64_STDIO Standard I/O supports large files. 184 */ 185 #include <bits/posix_opt.h> 186 /* Get the environment definitions from Unix98. */ 187 #if defined __USE_UNIX98 || defined __USE_XOPEN2K 188 #include <bits/environments.h> 189 #endif 190 /* Standard file descriptors. */ 191 #define STDIN_FILENO 0 /* Standard input. */ 192 #define STDOUT_FILENO 1 /* Standard output. */ 193 #define STDERR_FILENO 2 /* Standard error output. */ 194 /* All functions that are not declared anywhere else. */ 195 #include <bits/types.h> 196 #ifndef __ssize_t_defined 197 typedef __ssize_t ssize_t; 198 #define __ssize_t_defined 199 #endif 200 201 #define __need_size_t 202 #define __need_NULL 203 #include <stddef.h> 204 205 #if defined __USE_XOPEN || defined __USE_XOPEN2K 206 /* The Single Unix specification says that some more types are 207 available here. */ 208 #ifndef __gid_t_defined 209 typedef __gid_t gid_t; 210 #define __gid_t_defined 211 #endif 212 213 #ifndef __uid_t_defined 214 typedef __uid_t uid_t; 215 #define __uid_t_defined 216 #endif 217 218 #ifndef __off_t_defined 219 #ifndef __USE_FILE_OFFSET64 220 typedef __off_t off_t; 221 #else 222 typedef __off64_t off_t; 223 #endif 224 #define __off_t_defined 225 #endif 226 #if defined __USE_LARGEFILE64 && !defined __off64_t_defined 227 typedef __off64_t off64_t; 228 #define __off64_t_defined 229 #endif 230 231 #ifndef __useconds_t_defined 232 typedef __useconds_t useconds_t; 233 #define __useconds_t_defined 234 #endif 235 236 #ifndef __pid_t_defined 237 typedef __pid_t pid_t; 238 #define __pid_t_defined 239 #endif 240 #endif /* X/Open */ 241 242 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K 243 #ifndef __intptr_t_defined 244 typedef __intptr_t intptr_t; 245 #define __intptr_t_defined 246 #endif 247 #endif 248 249 #if defined __USE_MISC || defined __USE_XOPEN 250 #ifndef __socklen_t_defined 251 typedef __socklen_t socklen_t; 252 #define __socklen_t_defined 253 #endif 254 #endif 255 256 /* Values for the second argument to access. 257 These may be OR'd together. */ 258 #define R_OK 4 /* Test for read permission. */ 259 #define W_OK 2 /* Test for write permission. */ 260 #define X_OK 1 /* Test for execute permission. */ 261 #define F_OK 0 /* Test for existence. */ 262 263 /* Test for access to NAME using the real UID and real GID. */ 264 extern int access(const char *__name, int __type) 265 __THROW __nonnull((1)); 266 267 #ifdef __USE_GNU 268 /* Test for access to NAME using the effective UID and GID 269 (as normal file operations use). */ 270 extern int euidaccess(const char *__name, int __type) 271 __THROW __nonnull((1)); 272 273 /* An alias for `euidaccess', used by some other systems. */ 274 extern int eaccess(const char *__name, int __type) 275 __THROW __nonnull((1)); 276 #endif 277 278 #ifdef __USE_ATFILE 279 /* Test for access to FILE relative to the directory FD is open on. 280 If AT_EACCESS is set in FLAG, then use effective IDs like `eaccess', 281 otherwise use real IDs like `access'. */ 282 extern int faccessat(int __fd, const char *__file, int __type, int __flag) 283 __THROW __nonnull((2)) __wur; 284 #endif /* Use GNU. */ 285 286 /* Values for the WHENCE argument to lseek. */ 287 #ifndef _STDIO_H /* <stdio.h> has the same definitions. */ 288 #define SEEK_SET 0 /* Seek from beginning of file. */ 289 #define SEEK_CUR 1 /* Seek from current position. */ 290 #define SEEK_END 2 /* Seek from end of file. */ 291 #ifdef __USE_GNU 292 #define SEEK_DATA 3 /* Seek to next data. */ 293 #define SEEK_HOLE 4 /* Seek to next hole. */ 294 #endif 295 #endif 296 297 #if defined __USE_MISC && !defined L_SET 298 /* Old BSD names for the same constants; just for compatibility. */ 299 #define L_SET SEEK_SET 300 #define L_INCR SEEK_CUR 301 #define L_XTND SEEK_END 302 #endif 303 304 /* Move FD's file position to OFFSET bytes from the 305 beginning of the file (if WHENCE is SEEK_SET), 306 the current position (if WHENCE is SEEK_CUR), 307 or the end of the file (if WHENCE is SEEK_END). 308 Return the new file position. */ 309 #ifndef __USE_FILE_OFFSET64 310 extern __off_t lseek(int __fd, __off_t __offset, int __whence) __THROW; 311 #else 312 #ifdef __REDIRECT_NTH 313 extern __off64_t __REDIRECT_NTH(lseek, (int __fd, __off64_t __offset, int __whence), lseek64); 314 #else 315 #define lseek lseek64 316 #endif 317 #endif 318 #ifdef __USE_LARGEFILE64 319 extern __off64_t lseek64(int __fd, __off64_t __offset, int __whence) __THROW; 320 #endif 321 322 /* Close the file descriptor FD. 323 324 This function is a cancellation point and therefore not marked with 325 __THROW. */ 326 extern int close(int __fd); 327 328 /* Read NBYTES into BUF from FD. Return the 329 number read, -1 for errors or 0 for EOF. 330 331 This function is a cancellation point and therefore not marked with 332 __THROW. */ 333 extern ssize_t read(int __fd, void *__buf, size_t __nbytes) __wur; 334 335 /* Write N bytes of BUF to FD. Return the number written, or -1. 336 337 This function is a cancellation point and therefore not marked with 338 __THROW. */ 339 extern ssize_t write(int __fd, const void *__buf, size_t __n) __wur; 340 341 #if defined __USE_UNIX98 || defined __USE_XOPEN2K8 342 #ifndef __USE_FILE_OFFSET64 343 /* Read NBYTES into BUF from FD at the given position OFFSET without 344 changing the file pointer. Return the number read, -1 for errors 345 or 0 for EOF. 346 347 This function is a cancellation point and therefore not marked with 348 __THROW. */ 349 extern ssize_t pread(int __fd, void *__buf, size_t __nbytes, __off_t __offset) __wur; 350 351 /* Write N bytes of BUF to FD at the given position OFFSET without 352 changing the file pointer. Return the number written, or -1. 353 354 This function is a cancellation point and therefore not marked with 355 __THROW. */ 356 extern ssize_t pwrite(int __fd, const void *__buf, size_t __n, __off_t __offset) __wur; 357 #else 358 #ifdef __REDIRECT 359 extern ssize_t __REDIRECT(pread, (int __fd, void *__buf, size_t __nbytes, __off64_t __offset), pread64) __wur; 360 extern ssize_t __REDIRECT(pwrite, (int __fd, const void *__buf, size_t __nbytes, __off64_t __offset), pwrite64) __wur; 361 #else 362 #define pread pread64 363 #define pwrite pwrite64 364 #endif 365 #endif 366 367 #ifdef __USE_LARGEFILE64 368 /* Read NBYTES into BUF from FD at the given position OFFSET without 369 changing the file pointer. Return the number read, -1 for errors 370 or 0 for EOF. */ 371 extern ssize_t pread64(int __fd, void *__buf, size_t __nbytes, __off64_t __offset) __wur; 372 /* Write N bytes of BUF to FD at the given position OFFSET without 373 changing the file pointer. Return the number written, or -1. */ 374 extern ssize_t pwrite64(int __fd, const void *__buf, size_t __n, __off64_t __offset) __wur; 375 #endif 376 #endif 377 378 /* Create a one-way communication channel (pipe). 379 If successful, two file descriptors are stored in PIPEDES; 380 bytes written on PIPEDES[1] can be read from PIPEDES[0]. 381 Returns 0 if successful, -1 if not. */ 382 extern int pipe(int __pipedes[2]) 383 __THROW __wur; 384 385 #ifdef __USE_GNU 386 /* Same as pipe but apply flags passed in FLAGS to the new file 387 descriptors. */ 388 extern int pipe2(int __pipedes[2], int __flags) 389 __THROW __wur; 390 #endif 391 392 /* Schedule an alarm. In SECONDS seconds, the process will get a SIGALRM. 393 If SECONDS is zero, any currently scheduled alarm will be cancelled. 394 The function returns the number of seconds remaining until the last 395 alarm scheduled would have signaled, or zero if there wasn't one. 396 There is no return value to indicate an error, but you can set `errno' 397 to 0 and check its value after calling `alarm', and this might tell you. 398 The signal may come late due to processor scheduling. */ 399 extern unsigned int alarm(unsigned int __seconds) __THROW; 400 401 /* Make the process sleep for SECONDS seconds, or until a signal arrives 402 and is not ignored. The function returns the number of seconds less 403 than SECONDS which it actually slept (thus zero if it slept the full time). 404 If a signal handler does a `longjmp' or modifies the handling of the 405 SIGALRM signal while inside `sleep' call, the handling of the SIGALRM 406 signal afterwards is undefined. There is no return value to indicate 407 error, but if `sleep' returns SECONDS, it probably didn't work. 408 409 This function is a cancellation point and therefore not marked with 410 __THROW. */ 411 extern unsigned int sleep(unsigned int __seconds); 412 413 #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ 414 || defined __USE_MISC 415 /* Set an alarm to go off (generating a SIGALRM signal) in VALUE 416 microseconds. If INTERVAL is nonzero, when the alarm goes off, the 417 timer is reset to go off every INTERVAL microseconds thereafter. 418 Returns the number of microseconds remaining before the alarm. */ 419 extern __useconds_t ualarm(__useconds_t __value, __useconds_t __interval) __THROW; 420 421 /* Sleep USECONDS microseconds, or until a signal arrives that is not blocked 422 or ignored. 423 424 This function is a cancellation point and therefore not marked with 425 __THROW. */ 426 extern int usleep(__useconds_t __useconds); 427 #endif 428 429 /* Suspend the process until a signal arrives. 430 This always returns -1 and sets `errno' to EINTR. 431 432 This function is a cancellation point and therefore not marked with 433 __THROW. */ 434 extern int pause(void); 435 436 /* Change the owner and group of FILE. */ 437 extern int chown(const char *__file, __uid_t __owner, __gid_t __group) 438 __THROW __nonnull((1)) __wur; 439 440 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 441 /* Change the owner and group of the file that FD is open on. */ 442 extern int fchown(int __fd, __uid_t __owner, __gid_t __group) 443 __THROW __wur; 444 445 /* Change owner and group of FILE, if it is a symbolic 446 link the ownership of the symbolic link is changed. */ 447 extern int lchown(const char *__file, __uid_t __owner, __gid_t __group) 448 __THROW __nonnull((1)) __wur; 449 450 #endif /* Use X/Open Unix. */ 451 452 #ifdef __USE_ATFILE 453 /* Change the owner and group of FILE relative to the directory FD is open 454 on. */ 455 extern int fchownat(int __fd, const char *__file, __uid_t __owner, __gid_t __group, int __flag) 456 __THROW __nonnull((2)) __wur; 457 #endif /* Use GNU. */ 458 459 /* Change the process's working directory to PATH. */ 460 extern int chdir(const char *__path) 461 __THROW __nonnull((1)) __wur; 462 463 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 464 /* Change the process's working directory to the one FD is open on. */ 465 extern int fchdir(int __fd) 466 __THROW __wur; 467 #endif 468 469 /* Get the pathname of the current working directory, 470 and put it in SIZE bytes of BUF. Returns NULL if the 471 directory couldn't be determined or SIZE was too small. 472 If successful, returns BUF. In GNU, if BUF is NULL, 473 an array is allocated with `malloc'; the array is SIZE 474 bytes long, unless SIZE == 0, in which case it is as 475 big as necessary. */ 476 extern char *getcwd(char *__buf, size_t __size) 477 __THROW __wur; 478 479 #ifdef __USE_GNU 480 /* Return a malloc'd string containing the current directory name. 481 If the environment variable `PWD' is set, and its value is correct, 482 that value is used. */ 483 extern char *get_current_dir_name(void) __THROW; 484 #endif 485 486 #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ 487 || defined __USE_MISC 488 /* Put the absolute pathname of the current working directory in BUF. 489 If successful, return BUF. If not, put an error message in 490 BUF and return NULL. BUF should be at least PATH_MAX bytes long. */ 491 extern char *getwd(char *__buf) 492 __THROW __nonnull((1)) 493 __attribute_deprecated__ __wur; 494 #endif 495 496 /* Duplicate FD, returning a new file descriptor on the same file. */ 497 extern int dup(int __fd) 498 __THROW __wur; 499 500 /* Duplicate FD to FD2, closing FD2 and making it open on the same file. */ 501 extern int dup2(int __fd, int __fd2) __THROW; 502 503 #ifdef __USE_GNU 504 /* Duplicate FD to FD2, closing FD2 and making it open on the same 505 file while setting flags according to FLAGS. */ 506 extern int dup3(int __fd, int __fd2, int __flags) __THROW; 507 #endif 508 509 /* NULL-terminated array of "NAME=VALUE" environment variables. */ 510 extern char **__environ; 511 #ifdef __USE_GNU 512 extern char **environ; 513 #endif 514 515 /* Replace the current process, executing PATH with arguments ARGV and 516 environment ENVP. ARGV and ENVP are terminated by NULL pointers. */ 517 extern int execve(const char *__path, char *const __argv[], char *const __envp[]) 518 __THROW __nonnull((1, 2)); 519 520 #ifdef __USE_XOPEN2K8 521 /* Execute the file FD refers to, overlaying the running program image. 522 ARGV and ENVP are passed to the new program, as for `execve'. */ 523 extern int fexecve(int __fd, char *const __argv[], char *const __envp[]) 524 __THROW __nonnull((2)); 525 #endif 526 527 /* Execute PATH with arguments ARGV and environment from `environ'. */ 528 extern int execv(const char *__path, char *const __argv[]) 529 __THROW __nonnull((1, 2)); 530 531 /* Execute PATH with all arguments after PATH until a NULL pointer, 532 and the argument after that for environment. */ 533 extern int execle(const char *__path, const char *__arg, ...) 534 __THROW __nonnull((1, 2)); 535 536 /* Execute PATH with all arguments after PATH until 537 a NULL pointer and environment from `environ'. */ 538 extern int execl(const char *__path, const char *__arg, ...) 539 __THROW __nonnull((1, 2)); 540 541 /* Execute FILE, searching in the `PATH' environment variable if it contains 542 no slashes, with arguments ARGV and environment from `environ'. */ 543 extern int execvp(const char *__file, char *const __argv[]) 544 __THROW __nonnull((1, 2)); 545 546 /* Execute FILE, searching in the `PATH' environment variable if 547 it contains no slashes, with all arguments after FILE until a 548 NULL pointer and environment from `environ'. */ 549 extern int execlp(const char *__file, const char *__arg, ...) 550 __THROW __nonnull((1, 2)); 551 552 #ifdef __USE_GNU 553 /* Execute FILE, searching in the `PATH' environment variable if it contains 554 no slashes, with arguments ARGV and environment from `environ'. */ 555 extern int execvpe(const char *__file, char *const __argv[], char *const __envp[]) 556 __THROW __nonnull((1, 2)); 557 #endif 558 559 #if defined __USE_MISC || defined __USE_XOPEN 560 /* Add INC to priority of the current process. */ 561 extern int nice(int __inc) 562 __THROW __wur; 563 #endif 564 565 /* Terminate program execution with the low-order 8 bits of STATUS. */ 566 extern void _exit(int __status) __attribute__ ((__noreturn__)); 567 568 /* Get the `_PC_*' symbols for the NAME argument to `pathconf' and `fpathconf'; 569 the `_SC_*' symbols for the NAME argument to `sysconf'; 570 and the `_CS_*' symbols for the NAME argument to `confstr'. */ 571 #include <bits/confname.h> 572 573 /* Get file-specific configuration information about PATH. */ 574 extern long int pathconf(const char *__path, int __name) 575 __THROW __nonnull((1)); 576 577 /* Get file-specific configuration about descriptor FD. */ 578 extern long int fpathconf(int __fd, int __name) __THROW; 579 580 /* Get the value of the system variable NAME. */ 581 extern long int sysconf(int __name) __THROW; 582 583 #ifdef __USE_POSIX2 584 /* Get the value of the string-valued system variable NAME. */ 585 extern size_t confstr(int __name, char *__buf, size_t __len) __THROW; 586 #endif 587 588 /* Get the process ID of the calling process. */ 589 extern __pid_t getpid(void) __THROW; 590 591 /* Get the process ID of the calling process's parent. */ 592 extern __pid_t getppid(void) __THROW; 593 594 /* Get the process group ID of the calling process. */ 595 extern __pid_t getpgrp(void) __THROW; 596 597 /* Get the process group ID of process PID. */ 598 extern __pid_t __getpgid(__pid_t __pid) __THROW; 599 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 600 extern __pid_t getpgid(__pid_t __pid) __THROW; 601 #endif 602 603 /* Set the process group ID of the process matching PID to PGID. 604 If PID is zero, the current process's process group ID is set. 605 If PGID is zero, the process ID of the process is used. */ 606 extern int setpgid(__pid_t __pid, __pid_t __pgid) __THROW; 607 608 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 609 /* Both System V and BSD have `setpgrp' functions, but with different 610 calling conventions. The BSD function is the same as POSIX.1 `setpgid' 611 (above). The System V function takes no arguments and puts the calling 612 process in its on group like `setpgid (0, 0)'. 613 614 New programs should always use `setpgid' instead. 615 616 GNU provides the POSIX.1 function. */ 617 618 /* Set the process group ID of the calling process to its own PID. 619 This is exactly the same as `setpgid (0, 0)'. */ 620 extern int setpgrp(void) __THROW; 621 622 #endif /* Use misc or X/Open. */ 623 624 /* Create a new session with the calling process as its leader. 625 The process group IDs of the session and the calling process 626 are set to the process ID of the calling process, which is returned. */ 627 extern __pid_t setsid(void) __THROW; 628 629 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 630 /* Return the session ID of the given process. */ 631 extern __pid_t getsid(__pid_t __pid) __THROW; 632 #endif 633 634 /* Get the real user ID of the calling process. */ 635 extern __uid_t getuid(void) __THROW; 636 637 /* Get the effective user ID of the calling process. */ 638 extern __uid_t geteuid(void) __THROW; 639 640 /* Get the real group ID of the calling process. */ 641 extern __gid_t getgid(void) __THROW; 642 643 /* Get the effective group ID of the calling process. */ 644 extern __gid_t getegid(void) __THROW; 645 646 /* If SIZE is zero, return the number of supplementary groups 647 the calling process is in. Otherwise, fill in the group IDs 648 of its supplementary groups in LIST and return the number written. */ 649 extern int getgroups(int __size, __gid_t __list[]) 650 __THROW __wur; 651 652 #ifdef __USE_GNU 653 /* Return nonzero iff the calling process is in group GID. */ 654 extern int group_member(__gid_t __gid) __THROW; 655 #endif 656 657 /* Set the user ID of the calling process to UID. 658 If the calling process is the super-user, set the real 659 and effective user IDs, and the saved set-user-ID to UID; 660 if not, the effective user ID is set to UID. */ 661 extern int setuid(__uid_t __uid) 662 __THROW __wur; 663 664 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 665 /* Set the real user ID of the calling process to RUID, 666 and the effective user ID of the calling process to EUID. */ 667 extern int setreuid(__uid_t __ruid, __uid_t __euid) 668 __THROW __wur; 669 #endif 670 671 #ifdef __USE_XOPEN2K 672 /* Set the effective user ID of the calling process to UID. */ 673 extern int seteuid(__uid_t __uid) 674 __THROW __wur; 675 #endif /* Use POSIX.1-2001. */ 676 677 /* Set the group ID of the calling process to GID. 678 If the calling process is the super-user, set the real 679 and effective group IDs, and the saved set-group-ID to GID; 680 if not, the effective group ID is set to GID. */ 681 extern int setgid(__gid_t __gid) 682 __THROW __wur; 683 684 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 685 /* Set the real group ID of the calling process to RGID, 686 and the effective group ID of the calling process to EGID. */ 687 extern int setregid(__gid_t __rgid, __gid_t __egid) 688 __THROW __wur; 689 #endif 690 691 #ifdef __USE_XOPEN2K 692 /* Set the effective group ID of the calling process to GID. */ 693 extern int setegid(__gid_t __gid) 694 __THROW __wur; 695 #endif /* Use POSIX.1-2001. */ 696 697 #ifdef __USE_GNU 698 /* Fetch the real user ID, effective user ID, and saved-set user ID, 699 of the calling process. */ 700 extern int getresuid(__uid_t * __ruid, __uid_t * __euid, __uid_t * __suid) __THROW; 701 702 /* Fetch the real group ID, effective group ID, and saved-set group ID, 703 of the calling process. */ 704 extern int getresgid(__gid_t * __rgid, __gid_t * __egid, __gid_t * __sgid) __THROW; 705 706 /* Set the real user ID, effective user ID, and saved-set user ID, 707 of the calling process to RUID, EUID, and SUID, respectively. */ 708 extern int setresuid(__uid_t __ruid, __uid_t __euid, __uid_t __suid) 709 __THROW __wur; 710 711 /* Set the real group ID, effective group ID, and saved-set group ID, 712 of the calling process to RGID, EGID, and SGID, respectively. */ 713 extern int setresgid(__gid_t __rgid, __gid_t __egid, __gid_t __sgid) 714 __THROW __wur; 715 #endif 716 717 /* Clone the calling process, creating an exact copy. 718 Return -1 for errors, 0 to the new process, 719 and the process ID of the new process to the old process. */ 720 extern __pid_t fork(void) __THROWNL; 721 722 #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8) \ 723 || defined __USE_MISC 724 /* Clone the calling process, but without copying the whole address space. 725 The calling process is suspended until the new process exits or is 726 replaced by a call to `execve'. Return -1 for errors, 0 to the new process, 727 and the process ID of the new process to the old process. */ 728 extern __pid_t vfork(void) __THROW; 729 #endif /* Use misc or XPG < 7. */ 730 731 /* Return the pathname of the terminal FD is open on, or NULL on errors. 732 The returned storage is good only until the next call to this function. */ 733 extern char *ttyname(int __fd) __THROW; 734 735 /* Store at most BUFLEN characters of the pathname of the terminal FD is 736 open on in BUF. Return 0 on success, otherwise an error number. */ 737 extern int ttyname_r(int __fd, char *__buf, size_t __buflen) 738 __THROW __nonnull((2)) __wur; 739 740 /* Return 1 if FD is a valid descriptor associated 741 with a terminal, zero if not. */ 742 extern int isatty(int __fd) __THROW; 743 744 #ifdef __USE_MISC 745 /* Return the index into the active-logins file (utmp) for 746 the controlling terminal. */ 747 extern int ttyslot(void) __THROW; 748 #endif 749 750 /* Make a link to FROM named TO. */ 751 extern int link(const char *__from, const char *__to) 752 __THROW __nonnull((1, 2)) __wur; 753 754 #ifdef __USE_ATFILE 755 /* Like link but relative paths in TO and FROM are interpreted relative 756 to FROMFD and TOFD respectively. */ 757 extern int linkat(int __fromfd, const char *__from, int __tofd, const char *__to, int __flags) 758 __THROW __nonnull((2, 4)) __wur; 759 #endif 760 761 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K 762 /* Make a symbolic link to FROM named TO. */ 763 extern int symlink(const char *__from, const char *__to) 764 __THROW __nonnull((1, 2)) __wur; 765 766 /* Read the contents of the symbolic link PATH into no more than 767 LEN bytes of BUF. The contents are not null-terminated. 768 Returns the number of characters read, or -1 for errors. */ 769 extern ssize_t readlink(const char *__restrict __path, char *__restrict __buf, size_t __len) 770 __THROW __nonnull((1, 2)) __wur; 771 #endif /* Use POSIX.1-2001. */ 772 773 #ifdef __USE_ATFILE 774 /* Like symlink but a relative path in TO is interpreted relative to TOFD. */ 775 extern int symlinkat(const char *__from, int __tofd, const char *__to) 776 __THROW __nonnull((1, 3)) __wur; 777 778 /* Like readlink but a relative PATH is interpreted relative to FD. */ 779 extern ssize_t readlinkat(int __fd, const char *__restrict __path, char *__restrict __buf, size_t __len) 780 __THROW __nonnull((2, 3)) __wur; 781 #endif 782 783 /* Remove the link NAME. */ 784 extern int unlink(const char *__name) 785 __THROW __nonnull((1)); 786 787 #ifdef __USE_ATFILE 788 /* Remove the link NAME relative to FD. */ 789 extern int unlinkat(int __fd, const char *__name, int __flag) 790 __THROW __nonnull((2)); 791 #endif 792 793 /* Remove the directory PATH. */ 794 extern int rmdir(const char *__path) 795 __THROW __nonnull((1)); 796 797 /* Return the foreground process group ID of FD. */ 798 extern __pid_t tcgetpgrp(int __fd) __THROW; 799 800 /* Set the foreground process group ID of FD set PGRP_ID. */ 801 extern int tcsetpgrp(int __fd, __pid_t __pgrp_id) __THROW; 802 803 /* Return the login name of the user. 804 805 This function is a possible cancellation point and therefore not 806 marked with __THROW. */ 807 extern char *getlogin(void); 808 #if defined __USE_REENTRANT || defined __USE_POSIX199506 809 /* Return at most NAME_LEN characters of the login name of the user in NAME. 810 If it cannot be determined or some other error occurred, return the error 811 code. Otherwise return 0. 812 813 This function is a possible cancellation point and therefore not 814 marked with __THROW. */ 815 extern int getlogin_r(char *__name, size_t __name_len) __nonnull((1)); 816 #endif 817 818 #ifdef __USE_MISC 819 /* Set the login name returned by `getlogin'. */ 820 extern int setlogin(const char *__name) 821 __THROW __nonnull((1)); 822 #endif 823 824 #ifdef __USE_POSIX2 825 /* Get definitions and prototypes for functions to process the 826 arguments in ARGV (ARGC of them, minus the program name) for 827 options given in OPTS. */ 828 #define __need_getopt 829 #include <getopt.h> 830 #endif 831 832 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K 833 /* Put the name of the current host in no more than LEN bytes of NAME. 834 The result is null-terminated if LEN is large enough for the full 835 name and the terminator. */ 836 extern int gethostname(char *__name, size_t __len) 837 __THROW __nonnull((1)); 838 #endif 839 840 #if defined __USE_MISC 841 /* Set the name of the current host to NAME, which is LEN bytes long. 842 This call is restricted to the super-user. */ 843 extern int sethostname(const char *__name, size_t __len) 844 __THROW __nonnull((1)) __wur; 845 846 /* Set the current machine's Internet number to ID. 847 This call is restricted to the super-user. */ 848 extern int sethostid(long int __id) 849 __THROW __wur; 850 851 /* Get and set the NIS (aka YP) domain name, if any. 852 Called just like `gethostname' and `sethostname'. 853 The NIS domain name is usually the empty string when not using NIS. */ 854 extern int getdomainname(char *__name, size_t __len) 855 __THROW __nonnull((1)) __wur; 856 extern int setdomainname(const char *__name, size_t __len) 857 __THROW __nonnull((1)) __wur; 858 859 /* Revoke access permissions to all processes currently communicating 860 with the control terminal, and then send a SIGHUP signal to the process 861 group of the control terminal. */ 862 extern int vhangup(void) __THROW; 863 864 /* Revoke the access of all descriptors currently open on FILE. */ 865 extern int revoke(const char *__file) 866 __THROW __nonnull((1)) __wur; 867 868 /* Enable statistical profiling, writing samples of the PC into at most 869 SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling 870 is enabled, the system examines the user PC and increments 871 SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536]. If SCALE is zero, 872 disable profiling. Returns zero on success, -1 on error. */ 873 extern int profil(unsigned short int *__sample_buffer, size_t __size, size_t __offset, unsigned int __scale) 874 __THROW __nonnull((1)); 875 876 /* Turn accounting on if NAME is an existing file. The system will then write 877 a record for each process as it terminates, to this file. If NAME is NULL, 878 turn accounting off. This call is restricted to the super-user. */ 879 extern int acct(const char *__name) __THROW; 880 881 /* Successive calls return the shells listed in `/etc/shells'. */ 882 extern char *getusershell(void) __THROW; 883 extern void endusershell(void) __THROW; /* Discard cached info. */ 884 extern void setusershell(void) __THROW; /* Rewind and re-read the file. */ 885 886 /* Put the program in the background, and dissociate from the controlling 887 terminal. If NOCHDIR is zero, do `chdir ("/")'. If NOCLOSE is zero, 888 redirects stdin, stdout, and stderr to /dev/null. */ 889 extern int daemon(int __nochdir, int __noclose) 890 __THROW __wur; 891 #endif /* Use misc. */ 892 893 #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K) 894 /* Make PATH be the root directory (the starting point for absolute paths). 895 This call is restricted to the super-user. */ 896 extern int chroot(const char *__path) 897 __THROW __nonnull((1)) __wur; 898 899 /* Prompt with PROMPT and read a string from the terminal without echoing. 900 Uses /dev/tty if possible; otherwise stderr and stdin. */ 901 extern char *getpass(const char *__prompt) __nonnull((1)); 902 #endif /* Use misc || X/Open. */ 903 904 /* Make all changes done to FD actually appear on disk. 905 906 This function is a cancellation point and therefore not marked with 907 __THROW. */ 908 extern int fsync(int __fd); 909 910 #ifdef __USE_GNU 911 /* Make all changes done to all files on the file system associated 912 with FD actually appear on disk. */ 913 extern int syncfs(int __fd) __THROW; 914 #endif 915 916 #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED 917 918 /* Return identifier for the current host. */ 919 extern long int gethostid(void); 920 921 /* Make all changes done to all files actually appear on disk. */ 922 extern void sync(void) __THROW; 923 924 #if defined __USE_MISC || !defined __USE_XOPEN2K 925 /* Return the number of bytes in a page. This is the system's page size, 926 which is not necessarily the same as the hardware page size. */ 927 extern int getpagesize(void) 928 __THROW __attribute__ ((__const__)); 929 930 /* Return the maximum number of file descriptors 931 the current process could possibly have. */ 932 extern int getdtablesize(void) __THROW; 933 #endif 934 935 #endif /* Use misc || X/Open Unix. */ 936 937 #if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8 938 939 /* Truncate FILE to LENGTH bytes. */ 940 #ifndef __USE_FILE_OFFSET64 941 extern int truncate(const char *__file, __off_t __length) 942 __THROW __nonnull((1)) __wur; 943 #else 944 #ifdef __REDIRECT_NTH 945 extern int __REDIRECT_NTH(truncate, (const char *__file, __off64_t __length), truncate64) __nonnull((1)) __wur; 946 #else 947 #define truncate truncate64 948 #endif 949 #endif 950 #ifdef __USE_LARGEFILE64 951 extern int truncate64(const char *__file, __off64_t __length) 952 __THROW __nonnull((1)) __wur; 953 #endif 954 955 #endif /* Use X/Open Unix || POSIX 2008. */ 956 957 #if defined __USE_POSIX199309 \ 958 || defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K 959 960 /* Truncate the file FD is open on to LENGTH bytes. */ 961 #ifndef __USE_FILE_OFFSET64 962 extern int ftruncate(int __fd, __off_t __length) 963 __THROW __wur; 964 #else 965 #ifdef __REDIRECT_NTH 966 extern int __REDIRECT_NTH(ftruncate, (int __fd, __off64_t __length), ftruncate64) __wur; 967 #else 968 #define ftruncate ftruncate64 969 #endif 970 #endif 971 #ifdef __USE_LARGEFILE64 972 extern int ftruncate64(int __fd, __off64_t __length) 973 __THROW __wur; 974 #endif 975 976 #endif /* Use POSIX.1b || X/Open Unix || XPG6. */ 977 978 #if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \ 979 || defined __USE_MISC 980 981 /* Set the end of accessible data space (aka "the break") to ADDR. 982 Returns zero on success and -1 for errors (with errno set). */ 983 extern int brk(void *__addr) 984 __THROW __wur; 985 986 /* Increase or decrease the end of accessible data space by DELTA bytes. 987 If successful, returns the address the previous end of data space 988 (i.e. the beginning of the new space, if DELTA > 0); 989 returns (void *) -1 for errors (with errno set). */ 990 extern void *sbrk(intptr_t __delta) __THROW; 991 #endif 992 993 #ifdef __USE_MISC 994 /* Invoke `system call' number SYSNO, passing it the remaining arguments. 995 This is completely system-dependent, and not often useful. 996 997 In Unix, `syscall' sets `errno' for all errors and most calls return -1 998 for errors; in many systems you cannot pass arguments or get return 999 values for all system calls (`pipe', `fork', and `getppid' typically 1000 among them). 1001 1002 In Mach, all system calls take normal arguments and always return an 1003 error code (zero for success). */ 1004 extern long int syscall(long int __sysno, ...) __THROW; 1005 1006 #endif /* Use misc. */ 1007 1008 #if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) && !defined F_LOCK 1009 /* NOTE: These declarations also appear in <fcntl.h>; be sure to keep both 1010 files consistent. Some systems have them there and some here, and some 1011 software depends on the macros being defined without including both. */ 1012 1013 /* `lockf' is a simpler interface to the locking facilities of `fcntl'. 1014 LEN is always relative to the current file position. 1015 The CMD argument is one of the following. 1016 1017 This function is a cancellation point and therefore not marked with 1018 __THROW. */ 1019 1020 #define F_ULOCK 0 /* Unlock a previously locked region. */ 1021 #define F_LOCK 1 /* Lock a region for exclusive use. */ 1022 #define F_TLOCK 2 /* Test and lock a region for exclusive use. */ 1023 #define F_TEST 3 /* Test a region for other processes locks. */ 1024 1025 #ifndef __USE_FILE_OFFSET64 1026 extern int lockf(int __fd, int __cmd, __off_t __len) __wur; 1027 #else 1028 #ifdef __REDIRECT 1029 extern int __REDIRECT(lockf, (int __fd, int __cmd, __off64_t __len), lockf64) __wur; 1030 #else 1031 #define lockf lockf64 1032 #endif 1033 #endif 1034 #ifdef __USE_LARGEFILE64 1035 extern int lockf64(int __fd, int __cmd, __off64_t __len) __wur; 1036 #endif 1037 #endif /* Use misc and F_LOCK not already defined. */ 1038 1039 #ifdef __USE_GNU 1040 1041 /* Evaluate EXPRESSION, and repeat as long as it returns -1 with `errno' 1042 set to EINTR. */ 1043 1044 #define TEMP_FAILURE_RETRY(expression) \ 1045 (__extension__ \ 1046 ({ long int __result; \ 1047 do __result = (long int) (expression); \ 1048 while (__result == -1L && errno == EINTR); \ 1049 __result; })) 1050 #endif 1051 1052 #if defined __USE_POSIX199309 || defined __USE_UNIX98 1053 /* Synchronize at least the data part of a file with the underlying 1054 media. */ 1055 extern int fdatasync(int __fildes); 1056 #endif /* Use POSIX199309 */ 1057 1058 /* XPG4.2 specifies that prototypes for the encryption functions must 1059 be defined here. */ 1060 #ifdef __USE_XOPEN 1061 /* Encrypt at most 8 characters from KEY using salt to perturb DES. */ 1062 extern char *crypt(const char *__key, const char *__salt) 1063 __THROW __nonnull((1, 2)); 1064 1065 /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt 1066 block in place. */ 1067 extern void encrypt(char *__glibc_block, int __edflag) 1068 __THROW __nonnull((1)); 1069 1070 /* Swab pairs bytes in the first N bytes of the area pointed to by 1071 FROM and copy the result to TO. The value of TO must not be in the 1072 range [FROM - N + 1, FROM - 1]. If N is odd the first byte in FROM 1073 is without partner. */ 1074 extern void swab(const void *__restrict __from, void *__restrict __to, ssize_t __n) 1075 __THROW __nonnull((1, 2)); 1076 #endif 1077 1078 /* Prior to Issue 6, the Single Unix Specification required these 1079 prototypes to appear in this header. They are also found in 1080 <stdio.h>. */ 1081 #if defined __USE_XOPEN && !defined __USE_XOPEN2K 1082 /* Return the name of the controlling terminal. */ 1083 extern char *ctermid(char *__s) __THROW; 1084 1085 /* Return the name of the current user. */ 1086 extern char *cuserid(char *__s); 1087 #endif 1088 1089 /* Unix98 requires this function to be declared here. In other 1090 standards it is in <pthread.h>. */ 1091 #if defined __USE_UNIX98 && !defined __USE_XOPEN2K 1092 extern int pthread_atfork(void (*__prepare) (void), void (*__parent) (void), void (*__child) (void)) __THROW; 1093 #endif 1094 1095 /* Define some macros helping to catch buffer overflows. */ 1096 #if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function 1097 #include <bits/unistd.h> 1098 #endif 1099 1100 __END_DECLS 1101 #endif /* unistd.h */