home *** CD-ROM | disk | FTP | other *** search
/ RISCWORLD 7 / RISCWORLD_VOL7.iso / Software / Issue2 / SDL.ARC / !unixlib / source / clib / h / unistd < prev    next >
Encoding:
Text File  |  2004-09-07  |  19.8 KB  |  628 lines

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