home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue6 / SDL.ZIP / !gcc / include / unixlib / h / unistd < prev    next >
Encoding:
Text File  |  2006-09-17  |  20.9 KB  |  655 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source: /usr/local/cvsroot/gccsdk/unixlib/source/clib/unistd.h,v $
  4.  * $Date: 2005/04/13 19:20:06 $
  5.  * $Revision: 1.18 $
  6.  * $State: Exp $
  7.  * $Author: nick $
  8.  *
  9.  ***************************************************************************/
  10.  
  11. /* POSIX Standard 2.10: Symbolic Constants <unistd.h>.  */
  12.  
  13. #ifndef __UNISTD_H
  14. #define __UNISTD_H
  15.  
  16. #ifndef __UNIXLIB_FEATURES_H
  17. #include <features.h>
  18. #endif
  19.  
  20. #ifndef __UNIXLIB_TYPES_H
  21. #include <unixlib/types.h>
  22. #endif
  23.  
  24. __BEGIN_DECLS
  25.  
  26. /* These may be used to determine what facilities are present at compile time.
  27.    Their values can be obtained at run time from sysconf.  */
  28.  
  29. /* POSIX Standard approved as IEEE Std 1003.1 as of August, 1988.  */
  30. #define    _POSIX_VERSION    199009L
  31.  
  32. #define    _POSIX2_C_VERSION    199912L    /* Invalid until 1003.2 is done.  */
  33.  
  34. /* If defined, the implementation supports the
  35.    C Language Bindings Option.  */
  36. #define    _POSIX2_C_BIND    1
  37.  
  38. /* If defined, the implementation supports the
  39.    C Language Development Utilities Option.  */
  40. #define    _POSIX2_C_DEV    1
  41.  
  42. /* If defined, the implementation supports the
  43.    Software Development Utilities Option.  */
  44. #define    _POSIX2_SW_DEV    1
  45.  
  46. /* Protocol-independent interfaces are supported.  */
  47. #define _POSIX_PII 1
  48.  
  49. /* Socket protocol-independent interfaces are supported.  */
  50. #define _POSIX_PII_SOCKET 1
  51.  
  52. /* Internet family of protocols is supported.  */
  53. #define _POSIX_PII_INTERNET 1
  54.  
  55. /* Connection-mode Internet protocol is supported.  */
  56. #define _POSIX_PII_INTERNET_STREAM 1
  57.  
  58. /* Connectionless Internet protocol is supported.  */
  59. #define _POSIX_PII_INTERNET_DGRAM 1
  60.  
  61. /* Library supports the poll function.  */
  62. #define _POSIX_POLL 1
  63.  
  64. /* Library supports select and pselect.  */
  65. #define _POSIX_SELECT 1
  66.  
  67. #include <bits/posix_opt.h>
  68.  
  69. /* Standard file descriptors.  */
  70. #define    STDIN_FILENO    0    /* Standard input.  */
  71. #define    STDOUT_FILENO    1    /* Standard output.  */
  72. #define    STDERR_FILENO    2    /* Standard error output.  */
  73.  
  74. #ifndef __ssize_t_defined
  75. typedef __ssize_t ssize_t;
  76. #define __ssize_t_defined
  77. #endif
  78.  
  79. #define __need_size_t
  80. #define __need_NULL
  81. #include <stddef.h>
  82.  
  83. /* The Single Unix specification says that some more types are
  84.    available here.  */
  85. #ifndef __gid_t_defined
  86. typedef __gid_t gid_t;
  87. #define __gid_t_defined
  88. #endif
  89.  
  90. #ifndef __uid_t_defined
  91. typedef __uid_t uid_t;
  92. #define __uid_t_defined
  93. #endif
  94.  
  95. #ifndef __off_t_defined
  96. typedef __off_t off_t;
  97. #define __off_t_defined
  98. #endif
  99.  
  100. #ifndef __useconds_t_defined
  101. typedef __useconds_t useconds_t;
  102. #define __useconds_t_defined
  103. #endif
  104.  
  105. #ifndef __pid_t_defined
  106. typedef __pid_t pid_t;
  107. #define __pid_t_defined
  108. #endif
  109.  
  110. #ifndef __intptr_t_defined
  111. typedef __intptr_t intptr_t;
  112. #define __intptr_t_defined
  113. #endif
  114.  
  115. #ifndef __socklen_t_defined
  116. typedef __socklen_t socklen_t;
  117. #define __socklen_t_defined
  118. #endif
  119.  
  120.  
  121. /* Values for the second argument to access.  */
  122.  
  123. /* Test for existence. */
  124. #ifndef F_OK
  125. #define F_OK    0
  126. #endif
  127. /* Test for execute permission.  */
  128. #ifndef X_OK
  129. #define X_OK    1
  130. #endif
  131. /* Test for write permission.  */
  132. #ifndef W_OK
  133. #define W_OK    2
  134. #endif
  135. /* Test for read permission.  */
  136. #ifndef R_OK
  137. #define R_OK    4
  138. #endif
  139.  
  140. /* Test for access to name.  */
  141. extern int access (const char *__name, int __type)
  142.      __THROW __nonnull ((1)) __wur;
  143.  
  144. /* Values for the WHENCE argument to lseek.  */
  145. #ifndef    __STDIO_H        /* <stdio.h> has the same definitions.  */
  146. #define    SEEK_SET    0    /* Seek from beginning of file.  */
  147. #define    SEEK_CUR    1    /* Seek from current position.  */
  148. #define    SEEK_END    2    /* Seek from end of file.  */
  149. #endif
  150.  
  151. /* Move fd's file position to offset bytes from the:
  152.    beginning of the file (if SEEK_SET),
  153.    the current position (if SEEK_CUR),
  154.    or the end of the file (SEEK_END).
  155.    Return the new file position.  */
  156. extern __off_t lseek (int __fd, __off_t __offset, int __whence) __THROW;
  157. extern __off_t lseek64 (int __fd, __off_t __offset, int __whence) __THROW;
  158.  
  159. /* Close the file descriptor fd.  This is a cancellation point.  */
  160. extern int close (int __fd);
  161.  
  162. /* Read nbytes into buf from fd.  This is a cancellation point.  */
  163. extern __ssize_t read (int __fd, void *__buf, size_t __nbytes)
  164.      __nonnull ((2)) __wur;
  165.  
  166. /* Write n bytes of buf to fd.  This is a cancellation point.  */
  167. extern __ssize_t write (int __fd, const void *__buf, size_t __nbytes)
  168.      __nonnull ((2)) __wur;
  169.  
  170. /* Create a one way communication channel (pipe). */
  171. extern int pipe (int __pipedes[2]) __THROW __wur;
  172.  
  173. /* Schedule an alarm.  */
  174. extern unsigned int alarm (unsigned int __seconds) __THROW;
  175.  
  176. /* Make the process sleep for '__seconds' seconds, or until a signal arrives
  177.    and is not ignored.  The function returns the number of seconds less
  178.    than '__seconds' which it actually slept (zero if it slept the full time).
  179.    If a signal handler does a `longjmp' or modifies the handling of the
  180.    SIGALRM signal while inside `sleep' call, the handling of the SIGALRM
  181.    signal afterwards is undefined.  There is no return value to indicate
  182.    error, but if `sleep' returns '__seconds', it probably didn't work.
  183.  
  184.    This is a cancellation point.  */
  185. extern unsigned int sleep (unsigned int __seconds);
  186.  
  187. #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
  188. /* Set an alarm to go off (generating a SIGALRM signal) in VALUE
  189.    microseconds.  If INTERVAL is nonzero, when the alarm goes off, the
  190.    timer is reset to go off every INTERVAL microseconds thereafter.
  191.    Returns the number of microseconds remaining before the alarm.  */
  192. extern __useconds_t ualarm (__useconds_t __useconds,
  193.                 __useconds_t __interval) __THROW;
  194.  
  195. /* Make the process sleep for '__usec' microseconds, or until a signal
  196.    arrives that is not blocked or ignored.  */
  197. extern int usleep (__useconds_t __usec);
  198. #endif
  199.  
  200. /* Suspend the process until a signal arrives.  This is a cancellation
  201.    point.  */
  202. extern int pause (void);
  203.  
  204. /* Change the owner and group of file.  */
  205. extern int chown (const char *__file, __uid_t __owner,
  206.           __gid_t __group) __THROW __nonnull ((1)) __wur;
  207.  
  208. /* Change the owner and group of file.  */
  209. extern int lchown (const char *__file, __uid_t __owner,
  210.           __gid_t __group) __THROW __nonnull ((1)) __wur;
  211.  
  212. /* Change the process's working directory to path.  */
  213. extern int chdir (const char *__path) __THROW __nonnull ((1)) __wur;
  214.  
  215. #if defined __USE_BSD || defined __USE_XOPEN_EXTENDED
  216. /* Change the owner and group of the file associated with 'fd'  */
  217. extern int fchown (int __fd, __uid_t __owner, __gid_t __group) __THROW __wur;
  218.  
  219. /* Change the process's working directory to the path associated with 'fd'  */
  220. extern int fchdir (int __fd) __THROW __wur;
  221.  
  222. /* The BSD version of getcwd. This function calls getcwd but does
  223.    not provide any buffer size checking.  */
  224. extern char *getwd (char *__buf) __THROW __nonnull ((1)) __wur;
  225. #endif
  226.  
  227. /* Get the pathname of the current working directory.  */
  228. extern char *getcwd (char *__buf, size_t __size) __THROW __wur;
  229.  
  230. /* Duplicate FD, returning a new file descriptor on the same file.  */
  231. extern int dup (int __fd) __THROW __wur;
  232.  
  233. /* Duplicate fd to fd2, closing fd2 and making it open on the same file.  */
  234. extern int dup2 (int __fd, int __fd2) __THROW;
  235.  
  236. /* NULL-terminated array of "NAME=VALUE" environment variables.  */
  237. extern char **environ;
  238.  
  239. /* Replace the current process, executing path with args argv and
  240.    environment envp.  */
  241. extern int execve (const char *__path, char * const __argv[],
  242.            char *const __envp[]) __THROW __nonnull ((1));
  243.  
  244. /* Execute PATH with arguments ARGV and environment from `environ'.  */
  245. extern int execv (const char *__path, char *const __argv[])
  246.      __THROW __nonnull ((1));
  247.  
  248. /* Execute PATH with all arguments after PATH until a NULL pointer,
  249.    and the argument after that for environment.  */
  250. extern int execle (const char *__path, const char *__arg, ...)
  251.      __THROW __nonnull ((1));
  252.  
  253. /* Execute PATH with all arguments after PATH until
  254.    a NULL pointer and environment from `environ'.  */
  255. extern int execl (const char *__path, const char *__arg, ...)
  256.      __THROW __nonnull ((1));
  257.  
  258. /* Execute FILE, searching in the `PATH' environment variable if it contains
  259.    no slashes, with arguments ARGV and environment from `environ'.  */
  260. extern int execvp (const char *__file, char *const __argv[])
  261.      __THROW __nonnull ((1));
  262.  
  263. /* Execute FILE, searching in the `PATH' environment variable if
  264.    it contains no slashes, with all arguments after FILE until a
  265.    NULL pointer and environment from `environ'.  */
  266. extern int execlp (const char *__file, const char *__arg, ...)
  267.      __THROW __nonnull ((1));
  268.  
  269. /* Terminate program execution with the low-order 8 bits of status.  */
  270. extern void _exit (int __status) __attribute__ ((__noreturn__));
  271.  
  272. /* Values for the NAME argument to `pathconf' and `fpathconf'.  */
  273. enum
  274.   {
  275.     _PC_LINK_MAX,
  276.     _PC_MAX_CANON,
  277.     _PC_MAX_INPUT,
  278.     _PC_NAME_MAX,
  279.     _PC_PATH_MAX,
  280.     _PC_PIPE_BUF,
  281.     _PC_CHOWN_RESTRICTED,
  282.     _PC_NO_TRUNC,
  283.     _PC_VDISABLE
  284.   };
  285.  
  286. /* Get file-specific configuration information about PATH.  */
  287. extern long int pathconf (const char *__path, int __name)
  288.      __THROW __nonnull ((1));
  289.  
  290. /* Get file-specific configuration about descriptor FD.  */
  291. extern long int fpathconf (int __fd, int __name) __THROW;
  292.  
  293. /* Values for the argument to `sysconf'.  */
  294. enum
  295.   {
  296.     _SC_ARG_MAX,
  297.     _SC_CHILD_MAX,
  298.     _SC_CLK_TCK,
  299.     _SC_NGROUPS_MAX,
  300.     _SC_OPEN_MAX,
  301.     _SC_STREAM_MAX,
  302.     _SC_TZNAME_MAX,
  303.     _SC_JOB_CONTROL,
  304.     _SC_SAVED_IDS,
  305.     _SC_VERSION,
  306.     _SC_PAGESIZE,
  307.  
  308.     /* Values for the argument to `sysconf' corresponding to
  309.        _POSIX2_* symbols.  */
  310.     _SC_BC_BASE_MAX,
  311.     _SC_BC_DIM_MAX,
  312.     _SC_BC_SCALE_MAX,
  313.     _SC_BC_STRING_MAX,
  314.     _SC_COLL_WEIGHTS_MAX,
  315.     _SC_EQUIV_CLASS_MAX,
  316.     _SC_EXPR_NEST_MAX,
  317.     _SC_LINE_MAX,
  318.     _SC_RE_DUP_MAX,
  319.  
  320.     _SC_2_VERSION,
  321.     _SC_2_C_BIND,
  322.     _SC_2_C_DEV,
  323.     _SC_2_FORT_DEV,
  324.     _SC_2_FORT_RUN,
  325.     _SC_2_SW_DEV,
  326.     _SC_2_LOCALEDEF
  327.   };
  328.  
  329. /* Get the value of the system variable NAME.  */
  330. extern long int sysconf (int __name) __THROW __attribute__ ((__const__));
  331.  
  332.  
  333. /* Get the process id of the calling process.  */
  334. extern __pid_t getpid (void) __THROW;
  335.  
  336. /* Get the process id of the calling process's parent.  */
  337. extern __pid_t getppid (void) __THROW;
  338.  
  339. /* Get the process group id of the calling process.  */
  340. extern __pid_t getpgrp (void) __THROW;
  341.  
  342. /* Set the process group id of the process matching pid to pgid.  */
  343. extern int setpgrp (__pid_t __pid, __pid_t __pgid) __THROW;
  344. extern int setpgid (__pid_t __pid, __pid_t __pgid) __THROW;
  345.  
  346. /* Create a new session with the calling process as its leader.  */
  347. extern __pid_t setsid (void) __THROW;
  348.  
  349. /* Get the real user id of the calling process.  */
  350. extern __uid_t getuid (void) __THROW;
  351. /* Get the effective user id of the calling process.  */
  352. extern __uid_t geteuid (void) __THROW;
  353. /* Get the real group id of the calling process.  */
  354. extern __gid_t getgid (void) __THROW;
  355. /* Get the effective group id of the calling process.  */
  356. extern __gid_t getegid (void) __THROW;
  357.  
  358. #if 0
  359. /* Return the number of supplementary groups the calling process is in.  */
  360. extern int getgroups (int __size, __gid_t __list[]) __THROW;
  361. #endif
  362.  
  363. /* Set the user id of the calling process to uid.  */
  364. extern int setuid (__uid_t __uid) __THROW;
  365. /* Set the effective user id of the calling process to uid (from BSD).  */
  366. extern int seteuid (__uid_t __uid) __THROW;
  367. #if 0
  368. /* Combination of setuid and seteuid (from BSD).  */
  369. extern int setreuid (__uid_t __ruid, __uid_t __euid) __THROW;
  370. #endif
  371.  
  372. /* Set the group id of the calling process to uid.  */
  373. extern int setgid (__gid_t __gid) __THROW;
  374. /* Set the effective group id of the calling process to uid (from BSD).  */
  375. extern int setegid (__gid_t __gid) __THROW;
  376. #if 0
  377. /* Combination of setgid and setegid (from BSD).  */
  378. extern int setregid (__gid_t __rgid, __gid_t __egid) __THROW;
  379. #endif
  380.  
  381. /* Clone the calling process, creating an exact copy.  */
  382. extern __pid_t fork (void) __THROW __wur;
  383. /* Clone the calling process, but without copying the whole address
  384.    space (from BSD).  */
  385. extern __pid_t vfork (void) __THROW __wur;
  386.  
  387. /* Return the pathname of the terminal fd is open on.  */
  388. extern char *ttyname (int __fd) __THROW __wur;
  389.  
  390. /* Return 1 if fd is a valid descriptor associated with a terminal.  */
  391. extern int isatty (int __fd) __THROW __wur;
  392.  
  393. /* Return 1 if fd is a valid descriptor associated with a pipe.  */
  394. extern int ispipe (int __fd) __THROW __wur;
  395.  
  396. /* Make a link to from named to.  */
  397. extern int link (const char *__from, const char *__to)
  398.      __THROW __nonnull ((1, 2)) __wur;
  399.  
  400. /* Make a symbolic to from named to.  */
  401. extern int symlink (const char *__from, const char *__to)
  402.      __THROW __nonnull ((1, 2)) __wur;
  403.  
  404. /* Read vaue of a symbolic link.  */
  405. extern int readlink (const char *__restrict __path, char *__restrict __buf,
  406.              size_t __butsiz) __THROW __nonnull ((1, 2)) __wur;
  407.  
  408. /* Remove the line name.  */
  409. extern int unlink (const char *__name) __THROW __nonnull ((1));
  410.  
  411. #ifdef __UNIXLIB_INTERNALS
  412. /* Removes the suffix swap directory if it is empty.
  413.    The filename passed to it is corrupted. */
  414. extern void __unlinksuffix (char *__file);
  415. #endif
  416.  
  417. /* Remove the directory path.  */
  418. extern int rmdir (const char *__path) __THROW __nonnull ((1));
  419.  
  420. #define L_cuserid 16
  421.  
  422. /* Return the login name of the user.  This is a cancellation point.  */
  423. extern char *getlogin (void);
  424.  
  425. /* Set the foreground process group ID of FD set PGRP_ID.  */
  426. extern int tcsetpgrp (int __fd, __pid_t __pgrp_id) __THROW;
  427.  
  428. /* Return the foreground process group ID of FD.  */
  429. extern __pid_t tcgetpgrp (int __fd) __THROW;
  430.  
  431.  
  432. #if 0
  433. /* Set the login name returned by `getlogin'.  */
  434. extern int setlogin (const char *__name) __THROW;
  435.  
  436. /* Invoke system call number 'sysno', passing it the remaining args.  */
  437. extern int syscall (int __sysno, ...) __THROW;
  438. #endif
  439.  
  440. #if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
  441.  
  442. /* Set the end of accessible data space (aka "the break") to ADDR.
  443.    Returns zero on success and -1 for errors (with errno set).  */
  444. extern int brk (void *__addr) __THROW __nonnull ((1)) __wur;
  445.  
  446. /* Increase or decrease the end of accessible data space by DELTA bytes.
  447.    If successful, returns the address the previous end of data space
  448.    (i.e. the beginning of the new space, if DELTA > 0);
  449.    returns (void *) -1 for errors (with errno set).  */
  450. extern void *sbrk (intptr_t __delta) __THROW;
  451. #endif
  452.  
  453. #ifdef __UNIXLIB_INTERNALS
  454. extern void *__internal_sbrk (int __incr);
  455. #endif
  456.  
  457.  
  458. #if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) && !defined F_LOCK
  459. /* NOTE: These declarations also appear in <fcntl.h>; be sure to keep both
  460.    files consistent.  Some systems have them there and some here, and some
  461.    software depends on the macros being defined without including both.  */
  462.  
  463. /* `lockf' is a simpler interface to the locking facilities of `fcntl'.
  464.    LEN is always relative to the current file position.
  465.    The CMD argument is one of the following.
  466.  
  467.    This function is a cancellation point and therefore not marked with
  468.    __THROW.  */
  469.  
  470. # define F_ULOCK 0    /* Unlock a previously locked region.  */
  471. # define F_LOCK  1    /* Lock a region for exclusive use.  */
  472. # define F_TLOCK 2    /* Test and lock a region for exclusive use.  */
  473. # define F_TEST  3    /* Test a region for other processes locks.  */
  474.  
  475. # ifndef __USE_FILE_OFFSET64
  476. extern int lockf (int __fd, int __cmd, __off_t __len);
  477. # else
  478. #  ifdef __REDIRECT
  479. extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len),
  480.                lockf64);
  481. #  else
  482. #   define lockf lockf64
  483. #  endif
  484. # endif
  485. # ifdef __USE_LARGEFILE64
  486. extern int lockf64 (int __fd, int __cmd, __off64_t __len);
  487. # endif
  488. #endif /* Use misc and F_LOCK not already defined.  */
  489.  
  490.  
  491. #if defined __USE_BSD || defined __USE_UNIX98
  492. /* Put the name of the current host in no more than LEN bytes of NAME.
  493.    The result is null-terminated if LEN is large enough for the full
  494.    name and the terminator.  */
  495. extern int gethostname (char *__name, size_t __len) __THROW __nonnull ((1));
  496. #endif
  497.  
  498.  
  499. #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_UNIX98)
  500. /* Set the name of the current host to NAME, which is LEN bytes long.
  501.    This call is restricted to the super-user.  */
  502. extern int sethostname (__const char *__name, size_t __len) __THROW;
  503.  
  504. #if 0
  505. /* Set the current machine's Internet number to ID.
  506.    This call is restricted to the super-user.  */
  507. extern int sethostid (long int __id) __THROW;
  508. #endif
  509.  
  510.  
  511. /* Get and set the NIS (aka YP) domain name, if any.
  512.    Called just like `gethostname' and `sethostname'.
  513.    The NIS domain name is usually the empty string when not using NIS.  */
  514. extern int getdomainname (char *__name, size_t __len) __THROW;
  515. extern int setdomainname (__const char *__name, size_t __len) __THROW;
  516.  
  517.  
  518. #if 0
  519. /* Revoke access permissions to all processes currently communicating
  520.    with the control terminal, and then send a SIGHUP signal to the process
  521.    group of the control terminal.  */
  522. extern int vhangup (void) __THROW;
  523. #endif
  524.  
  525. #if 0
  526. /* Revoke the access of all descriptors currently open on FILE.  */
  527. extern int revoke (__const char *__file) __THROW;
  528. #endif
  529.  
  530.  
  531. #if 0
  532. /* Enable statistical profiling, writing samples of the PC into at most
  533.    SIZE bytes of SAMPLE_BUFFER; every processor clock tick while profiling
  534.    is enabled, the system examines the user PC and increments
  535.    SAMPLE_BUFFER[((PC - OFFSET) / 2) * SCALE / 65536].  If SCALE is zero,
  536.    disable profiling.  Returns zero on success, -1 on error.  */
  537. extern int profil (unsigned short int *__sample_buffer, size_t __size,
  538.            size_t __offset, unsigned int __scale) __THROW;
  539. #endif
  540.  
  541.  
  542. #if 0
  543. /* Turn accounting on if NAME is an existing file.  The system will then write
  544.    a record for each process as it terminates, to this file.  If NAME is NULL,
  545.    turn accounting off.  This call is restricted to the super-user.  */
  546. extern int acct (__const char *__name) __THROW;
  547. #endif
  548.  
  549.  
  550. #if 0
  551. /* Successive calls return the shells listed in `/etc/shells'.  */
  552. extern char *getusershell (void) __THROW;
  553. extern void endusershell (void) __THROW; /* Discard cached info.  */
  554. extern void setusershell (void) __THROW; /* Rewind and re-read the file.  */
  555. #endif
  556.  
  557.  
  558. /* Put the program in the background, and dissociate from the controlling
  559.    terminal.  If NOCHDIR is zero, do `chdir ("/")'.  If NOCLOSE is zero,
  560.    redirects stdin, stdout, and stderr to /dev/null.  */
  561. extern int daemon (int __nochdir, int __noclose) __THROW;
  562. #endif /* Use BSD || X/Open.  */
  563.  
  564.  
  565. /* Make all changes done to all files actually appear on disk.  */
  566. extern void sync (void) __THROW;
  567.  
  568. /* Make all changes done to FD actually appear on disk.
  569.    This function is a cancellation point.  */
  570. extern int fsync (int __fd);
  571.  
  572. /* Truncate FILE to LENGTH bytes.  */
  573. extern int truncate (const char *__file, __off_t __length) __THROW;
  574.  
  575. /* Truncate the file FD is open on to LENGTH bytes.  */
  576. extern int ftruncate (int __fd, __off_t __length) __THROW;
  577.  
  578. /* Return the number of bytes in a page.  This is the system's page size,
  579.    which is not necessarily the same as the hardware page size.  */
  580. extern int getpagesize (void) __THROW __attribute__ ((__const__));
  581.  
  582. /* Return the maximum number of file descriptors
  583.    the current process could possibly have.  */
  584. extern int getdtablesize (void) __THROW;
  585.  
  586. #if 0
  587. /* Return the current machine's Internet number.  */
  588. extern long int gethostid (void) __THROW;
  589.  
  590. /* Set the current machine's Internet number to ID.
  591.    This call is restricted to the super-user.  */
  592. extern int sethostid (long int __id) __THROW;
  593.  
  594.  
  595. /* Make the block special device PATH available to the system for swapping.
  596.    This call is restricted to the super-user.  */
  597. extern int swapon (const char *__path) __THROW;
  598.  
  599. /* Reboot or halt the system.  */
  600. extern int reboot (int __howto) __THROW;
  601.  
  602. #endif
  603.  
  604. #if defined __USE_BSD || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
  605. /* Make PATH be the root directory (the starting point for absolute paths).
  606.    This call is restricted to the super-user.  */
  607. extern int chroot (__const char *__path) __THROW;
  608.  
  609. /* Prompt with PROMPT and read a string from the terminal without echoing.
  610.    Uses /dev/tty if possible; otherwise stderr and stdin.  */
  611. extern char *getpass (__const char *__prompt) __THROW;
  612. #endif /* Use BSD || X/Open.  */
  613.  
  614.  
  615. /* POSIX 2 extensions.  */
  616.  
  617.  
  618. /* Values for the NAME argument to `confstr'.  */
  619. enum
  620.   {
  621.     _CS_PATH            /* The default search path.  */
  622.   };
  623.  
  624. /* Get the value of the string-valued system variable NAME.  */
  625. extern size_t confstr (int __name, char *__buf, size_t __len) __THROW;
  626.  
  627. #ifdef __USE_XOPEN
  628. /* Encrypt at most 8 characters from KEY using salt to perturb DES.  */
  629. extern char *crypt (const char *__key, const char *__salt)
  630.      __THROW __nonnull ((1, 2));
  631.  
  632. /* Encrypt data in BLOCK in place if EDFLAG is zero; otherwise decrypt
  633.    block in place.  */
  634. extern void encrypt (char *__block, int __edflag) __THROW __nonnull ((1));
  635.  
  636. /* Swab pairs bytes in the first N bytes of the area pointed to by
  637.    FROM and copy the result to TO.  The value of TO must not be in the
  638.    range [FROM - N + 1, FROM - 1].  If N is odd the first byte in FROM
  639.    is without partner.  */
  640. extern void swab (const void *__restrict  __from, void *__restrict  __to,
  641.           ssize_t __n) __THROW __nonnull ((1, 2));
  642. #endif
  643.  
  644. #if defined __USE_MISC || defined __USE_XOPEN
  645. /* Alter the priority of the current process by 'increment'.  */
  646. extern int nice (int __increment) __THROW __wur;
  647. #endif
  648.  
  649. #define __need_getopt
  650. #include <getopt.h>
  651.  
  652. __END_DECLS
  653.  
  654. #endif
  655.