unistd.h 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601
  1. /*-
  2. * SPDX-License-Identifier: BSD-3-Clause
  3. *
  4. * Copyright (c) 1991, 1993, 1994
  5. * The Regents of the University of California. All rights reserved.
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. * 1. Redistributions of source code must retain the above copyright
  11. * notice, this list of conditions and the following disclaimer.
  12. * 2. Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the distribution.
  15. * 3. Neither the name of the University nor the names of its contributors
  16. * may be used to endorse or promote products derived from this software
  17. * without specific prior written permission.
  18. *
  19. * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  20. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  23. * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  24. * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  25. * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  26. * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  27. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  28. * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  29. * SUCH DAMAGE.
  30. */
  31. #ifndef _UNISTD_H_
  32. #define _UNISTD_H_
  33. #include <sys/types.h> /* XXX adds too much pollution. */
  34. #include <sys/unistd.h>
  35. #include <sys/_null.h>
  36. #include <sys/_types.h>
  37. #if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0
  38. #include <ssp/unistd.h>
  39. #endif
  40. #ifndef _GID_T_DECLARED
  41. typedef __gid_t gid_t;
  42. #define _GID_T_DECLARED
  43. #endif
  44. #ifndef _OFF_T_DECLARED
  45. typedef __off_t off_t;
  46. #define _OFF_T_DECLARED
  47. #endif
  48. #ifndef _PID_T_DECLARED
  49. typedef __pid_t pid_t;
  50. #define _PID_T_DECLARED
  51. #endif
  52. #ifndef _SIZE_T_DECLARED
  53. typedef __size_t size_t;
  54. #define _SIZE_T_DECLARED
  55. #endif
  56. #ifndef _SSIZE_T_DECLARED
  57. typedef __ssize_t ssize_t;
  58. #define _SSIZE_T_DECLARED
  59. #endif
  60. #ifndef _UID_T_DECLARED
  61. typedef __uid_t uid_t;
  62. #define _UID_T_DECLARED
  63. #endif
  64. #ifndef _USECONDS_T_DECLARED
  65. typedef __useconds_t useconds_t;
  66. #define _USECONDS_T_DECLARED
  67. #endif
  68. #define STDIN_FILENO 0 /* standard input file descriptor */
  69. #define STDOUT_FILENO 1 /* standard output file descriptor */
  70. #define STDERR_FILENO 2 /* standard error file descriptor */
  71. #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112
  72. #define F_ULOCK 0 /* unlock locked section */
  73. #define F_LOCK 1 /* lock a section for exclusive use */
  74. #define F_TLOCK 2 /* test and lock a section for exclusive use */
  75. #define F_TEST 3 /* test a section for locks by other procs */
  76. #endif
  77. /*
  78. * POSIX options and option groups we unconditionally do or don't
  79. * implement. This list includes those options which are exclusively
  80. * implemented (or not) in user mode. Please keep this list in
  81. * alphabetical order.
  82. *
  83. * Anything which is defined as zero below **must** have an
  84. * implementation for the corresponding sysconf() which is able to
  85. * determine conclusively whether or not the feature is supported.
  86. * Anything which is defined as other than -1 below **must** have
  87. * complete headers, types, and function declarations as specified by
  88. * the POSIX standard; however, if the relevant sysconf() function
  89. * returns -1, the functions may be stubbed out.
  90. */
  91. #define _POSIX_BARRIERS 200112L
  92. #define _POSIX_CPUTIME 200112L
  93. #define _POSIX_READER_WRITER_LOCKS 200112L
  94. #define _POSIX_REGEXP 1
  95. #define _POSIX_SHELL 1
  96. #define _POSIX_SPAWN 200112L
  97. #define _POSIX_SPIN_LOCKS 200112L
  98. #define _POSIX_THREAD_ATTR_STACKADDR 200112L
  99. #define _POSIX_THREAD_ATTR_STACKSIZE 200112L
  100. #define _POSIX_THREAD_CPUTIME 200112L
  101. #define _POSIX_THREAD_PRIO_INHERIT 200112L
  102. #define _POSIX_THREAD_PRIO_PROTECT 200112L
  103. #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
  104. #define _POSIX_THREAD_PROCESS_SHARED 200112L
  105. #define _POSIX_THREAD_SAFE_FUNCTIONS -1
  106. #define _POSIX_THREAD_SPORADIC_SERVER -1
  107. #define _POSIX_THREADS 200112L
  108. #define _POSIX_TRACE -1
  109. #define _POSIX_TRACE_EVENT_FILTER -1
  110. #define _POSIX_TRACE_INHERIT -1
  111. #define _POSIX_TRACE_LOG -1
  112. #define _POSIX2_C_BIND 200112L /* mandatory */
  113. #define _POSIX2_C_DEV -1 /* need c99 utility */
  114. #define _POSIX2_CHAR_TERM 1
  115. #define _POSIX2_FORT_DEV -1 /* need fort77 utility */
  116. #define _POSIX2_FORT_RUN 200112L
  117. #define _POSIX2_LOCALEDEF -1
  118. #define _POSIX2_PBS -1
  119. #define _POSIX2_PBS_ACCOUNTING -1
  120. #define _POSIX2_PBS_CHECKPOINT -1
  121. #define _POSIX2_PBS_LOCATE -1
  122. #define _POSIX2_PBS_MESSAGE -1
  123. #define _POSIX2_PBS_TRACK -1
  124. #define _POSIX2_SW_DEV -1 /* XXX ??? */
  125. #define _POSIX2_UPE 200112L
  126. #define _V6_ILP32_OFF32 -1
  127. #define _V6_ILP32_OFFBIG 0
  128. #define _V6_LP64_OFF64 0
  129. #define _V6_LPBIG_OFFBIG -1
  130. #if __XSI_VISIBLE
  131. #define _XOPEN_CRYPT -1 /* XXX ??? */
  132. #define _XOPEN_ENH_I18N -1 /* mandatory in XSI */
  133. #define _XOPEN_LEGACY -1
  134. #define _XOPEN_REALTIME -1
  135. #define _XOPEN_REALTIME_THREADS -1
  136. #define _XOPEN_UNIX -1
  137. #endif
  138. /* Define the POSIX.2 version we target for compliance. */
  139. #define _POSIX2_VERSION 199212L
  140. /*
  141. * POSIX-style system configuration variable accessors (for the
  142. * sysconf function). The kernel does not directly implement the
  143. * sysconf() interface; rather, a C library stub translates references
  144. * to sysconf() into calls to sysctl() using a giant switch statement.
  145. * Those that are marked `user' are implemented entirely in the C
  146. * library and never query the kernel. pathconf() is implemented
  147. * directly by the kernel so those are not defined here.
  148. */
  149. #define _SC_ARG_MAX 1
  150. #define _SC_CHILD_MAX 2
  151. #define _SC_CLK_TCK 3
  152. #define _SC_NGROUPS_MAX 4
  153. #define _SC_OPEN_MAX 5
  154. #define _SC_JOB_CONTROL 6
  155. #define _SC_SAVED_IDS 7
  156. #define _SC_VERSION 8
  157. #define _SC_BC_BASE_MAX 9 /* user */
  158. #define _SC_BC_DIM_MAX 10 /* user */
  159. #define _SC_BC_SCALE_MAX 11 /* user */
  160. #define _SC_BC_STRING_MAX 12 /* user */
  161. #define _SC_COLL_WEIGHTS_MAX 13 /* user */
  162. #define _SC_EXPR_NEST_MAX 14 /* user */
  163. #define _SC_LINE_MAX 15 /* user */
  164. #define _SC_RE_DUP_MAX 16 /* user */
  165. #define _SC_2_VERSION 17 /* user */
  166. #define _SC_2_C_BIND 18 /* user */
  167. #define _SC_2_C_DEV 19 /* user */
  168. #define _SC_2_CHAR_TERM 20 /* user */
  169. #define _SC_2_FORT_DEV 21 /* user */
  170. #define _SC_2_FORT_RUN 22 /* user */
  171. #define _SC_2_LOCALEDEF 23 /* user */
  172. #define _SC_2_SW_DEV 24 /* user */
  173. #define _SC_2_UPE 25 /* user */
  174. #define _SC_STREAM_MAX 26 /* user */
  175. #define _SC_TZNAME_MAX 27 /* user */
  176. #if __POSIX_VISIBLE >= 199309
  177. #define _SC_ASYNCHRONOUS_IO 28
  178. #define _SC_MAPPED_FILES 29
  179. #define _SC_MEMLOCK 30
  180. #define _SC_MEMLOCK_RANGE 31
  181. #define _SC_MEMORY_PROTECTION 32
  182. #define _SC_MESSAGE_PASSING 33
  183. #define _SC_PRIORITIZED_IO 34
  184. #define _SC_PRIORITY_SCHEDULING 35
  185. #define _SC_REALTIME_SIGNALS 36
  186. #define _SC_SEMAPHORES 37
  187. #define _SC_FSYNC 38
  188. #define _SC_SHARED_MEMORY_OBJECTS 39
  189. #define _SC_SYNCHRONIZED_IO 40
  190. #define _SC_TIMERS 41
  191. #define _SC_AIO_LISTIO_MAX 42
  192. #define _SC_AIO_MAX 43
  193. #define _SC_AIO_PRIO_DELTA_MAX 44
  194. #define _SC_DELAYTIMER_MAX 45
  195. #define _SC_MQ_OPEN_MAX 46
  196. #define _SC_PAGESIZE 47
  197. #define _SC_RTSIG_MAX 48
  198. #define _SC_SEM_NSEMS_MAX 49
  199. #define _SC_SEM_VALUE_MAX 50
  200. #define _SC_SIGQUEUE_MAX 51
  201. #define _SC_TIMER_MAX 52
  202. #endif
  203. #if __POSIX_VISIBLE >= 200112
  204. #define _SC_2_PBS 59 /* user */
  205. #define _SC_2_PBS_ACCOUNTING 60 /* user */
  206. #define _SC_2_PBS_CHECKPOINT 61 /* user */
  207. #define _SC_2_PBS_LOCATE 62 /* user */
  208. #define _SC_2_PBS_MESSAGE 63 /* user */
  209. #define _SC_2_PBS_TRACK 64 /* user */
  210. #define _SC_ADVISORY_INFO 65
  211. #define _SC_BARRIERS 66 /* user */
  212. #define _SC_CLOCK_SELECTION 67
  213. #define _SC_CPUTIME 68
  214. #define _SC_FILE_LOCKING 69
  215. #define _SC_GETGR_R_SIZE_MAX 70 /* user */
  216. #define _SC_GETPW_R_SIZE_MAX 71 /* user */
  217. #define _SC_HOST_NAME_MAX 72
  218. #define _SC_LOGIN_NAME_MAX 73
  219. #define _SC_MONOTONIC_CLOCK 74
  220. #define _SC_MQ_PRIO_MAX 75
  221. #define _SC_READER_WRITER_LOCKS 76 /* user */
  222. #define _SC_REGEXP 77 /* user */
  223. #define _SC_SHELL 78 /* user */
  224. #define _SC_SPAWN 79 /* user */
  225. #define _SC_SPIN_LOCKS 80 /* user */
  226. #define _SC_SPORADIC_SERVER 81
  227. #define _SC_THREAD_ATTR_STACKADDR 82 /* user */
  228. #define _SC_THREAD_ATTR_STACKSIZE 83 /* user */
  229. #define _SC_THREAD_CPUTIME 84 /* user */
  230. #define _SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */
  231. #define _SC_THREAD_KEYS_MAX 86 /* user */
  232. #define _SC_THREAD_PRIO_INHERIT 87 /* user */
  233. #define _SC_THREAD_PRIO_PROTECT 88 /* user */
  234. #define _SC_THREAD_PRIORITY_SCHEDULING 89 /* user */
  235. #define _SC_THREAD_PROCESS_SHARED 90 /* user */
  236. #define _SC_THREAD_SAFE_FUNCTIONS 91 /* user */
  237. #define _SC_THREAD_SPORADIC_SERVER 92 /* user */
  238. #define _SC_THREAD_STACK_MIN 93 /* user */
  239. #define _SC_THREAD_THREADS_MAX 94 /* user */
  240. #define _SC_TIMEOUTS 95 /* user */
  241. #define _SC_THREADS 96 /* user */
  242. #define _SC_TRACE 97 /* user */
  243. #define _SC_TRACE_EVENT_FILTER 98 /* user */
  244. #define _SC_TRACE_INHERIT 99 /* user */
  245. #define _SC_TRACE_LOG 100 /* user */
  246. #define _SC_TTY_NAME_MAX 101 /* user */
  247. #define _SC_TYPED_MEMORY_OBJECTS 102
  248. #define _SC_V6_ILP32_OFF32 103 /* user */
  249. #define _SC_V6_ILP32_OFFBIG 104 /* user */
  250. #define _SC_V6_LP64_OFF64 105 /* user */
  251. #define _SC_V6_LPBIG_OFFBIG 106 /* user */
  252. #define _SC_IPV6 118
  253. #define _SC_RAW_SOCKETS 119
  254. #define _SC_SYMLOOP_MAX 120
  255. #endif
  256. #if __XSI_VISIBLE
  257. #define _SC_ATEXIT_MAX 107 /* user */
  258. #define _SC_IOV_MAX 56
  259. #define _SC_PAGE_SIZE _SC_PAGESIZE
  260. #define _SC_XOPEN_CRYPT 108 /* user */
  261. #define _SC_XOPEN_ENH_I18N 109 /* user */
  262. #define _SC_XOPEN_LEGACY 110 /* user */
  263. #define _SC_XOPEN_REALTIME 111
  264. #define _SC_XOPEN_REALTIME_THREADS 112
  265. #define _SC_XOPEN_SHM 113
  266. #define _SC_XOPEN_STREAMS 114
  267. #define _SC_XOPEN_UNIX 115
  268. #define _SC_XOPEN_VERSION 116
  269. #define _SC_XOPEN_XCU_VERSION 117 /* user */
  270. #endif
  271. #if __BSD_VISIBLE
  272. #define _SC_NPROCESSORS_CONF 57
  273. #define _SC_NPROCESSORS_ONLN 58
  274. #define _SC_CPUSET_SIZE 122
  275. #endif
  276. /* Extensions found in Solaris and Linux. */
  277. #define _SC_PHYS_PAGES 121
  278. /* Keys for the confstr(3) function. */
  279. #if __POSIX_VISIBLE >= 199209
  280. #define _CS_PATH 1 /* default value of PATH */
  281. #endif
  282. #if __POSIX_VISIBLE >= 200112
  283. #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2
  284. #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3
  285. #define _CS_POSIX_V6_ILP32_OFF32_LIBS 4
  286. #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5
  287. #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6
  288. #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7
  289. #define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8
  290. #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9
  291. #define _CS_POSIX_V6_LP64_OFF64_LIBS 10
  292. #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11
  293. #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12
  294. #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13
  295. #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14
  296. #endif
  297. __BEGIN_DECLS
  298. /* 1003.1-1990 */
  299. void _exit(int) __dead2;
  300. int access(const char *, int);
  301. unsigned int alarm(unsigned int);
  302. int chdir(const char *);
  303. int chown(const char *, uid_t, gid_t);
  304. int close(int);
  305. void closefrom(int);
  306. int dup(int);
  307. int dup2(int, int);
  308. int execl(const char *, const char *, ...) __null_sentinel;
  309. int execle(const char *, const char *, ...);
  310. int execlp(const char *, const char *, ...) __null_sentinel;
  311. int execv(const char *, char * const *);
  312. int execve(const char *, char * const *, char * const *);
  313. int execvp(const char *, char * const *);
  314. pid_t fork(void);
  315. long fpathconf(int, int);
  316. char *getcwd(char *, size_t);
  317. gid_t getegid(void);
  318. uid_t geteuid(void);
  319. gid_t getgid(void);
  320. int getgroups(int, gid_t []);
  321. char *getlogin(void);
  322. pid_t getpgrp(void);
  323. pid_t getpid(void);
  324. pid_t getppid(void);
  325. uid_t getuid(void);
  326. int isatty(int);
  327. int link(const char *, const char *);
  328. #ifndef _LSEEK_DECLARED
  329. #define _LSEEK_DECLARED
  330. off_t lseek(int, off_t, int);
  331. #endif
  332. long pathconf(const char *, int);
  333. int pause(void);
  334. int pipe(int *);
  335. ssize_t read(int, void *, size_t);
  336. int rmdir(const char *);
  337. int setgid(gid_t);
  338. int setpgid(pid_t, pid_t);
  339. pid_t setsid(void);
  340. int setuid(uid_t);
  341. unsigned int sleep(unsigned int);
  342. long sysconf(int);
  343. pid_t tcgetpgrp(int);
  344. int tcsetpgrp(int, pid_t);
  345. char *ttyname(int);
  346. int ttyname_r(int, char *, size_t);
  347. int unlink(const char *);
  348. ssize_t write(int, const void *, size_t);
  349. /* 1003.2-1992 */
  350. #if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE
  351. size_t confstr(int, char *, size_t);
  352. #ifndef _GETOPT_DECLARED
  353. #define _GETOPT_DECLARED
  354. int getopt(int, char * const [], const char *);
  355. extern char *optarg; /* getopt(3) external variables */
  356. extern int optind, opterr, optopt;
  357. #endif /* _GETOPT_DECLARED */
  358. #endif
  359. /* ISO/IEC 9945-1: 1996 */
  360. #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE
  361. int fsync(int);
  362. int fdatasync(int);
  363. /*
  364. * ftruncate() was in the POSIX Realtime Extension (it's used for shared
  365. * memory), but truncate() was not.
  366. */
  367. #ifndef _FTRUNCATE_DECLARED
  368. #define _FTRUNCATE_DECLARED
  369. int ftruncate(int, off_t);
  370. #endif
  371. #endif
  372. #if __POSIX_VISIBLE >= 199506
  373. int getlogin_r(char *, size_t);
  374. #endif
  375. /* 1003.1-2001 */
  376. #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE
  377. int fchown(int, uid_t, gid_t);
  378. ssize_t readlink(const char * __restrict, char * __restrict, size_t);
  379. #endif
  380. #if __POSIX_VISIBLE >= 200112
  381. int gethostname(char *, size_t);
  382. int setegid(gid_t);
  383. int seteuid(uid_t);
  384. #endif
  385. /* 1003.1-2008 */
  386. #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE
  387. int getsid(pid_t _pid);
  388. int fchdir(int);
  389. int getpgid(pid_t _pid);
  390. int lchown(const char *, uid_t, gid_t);
  391. ssize_t pread(int, void *, size_t, off_t);
  392. ssize_t pwrite(int, const void *, size_t, off_t);
  393. /* See comment at ftruncate() above. */
  394. #ifndef _TRUNCATE_DECLARED
  395. #define _TRUNCATE_DECLARED
  396. int truncate(const char *, off_t);
  397. #endif
  398. #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */
  399. #if __POSIX_VISIBLE >= 200809
  400. int faccessat(int, const char *, int, int);
  401. int fchownat(int, const char *, uid_t, gid_t, int);
  402. int fexecve(int, char *const [], char *const []);
  403. int linkat(int, const char *, int, const char *, int);
  404. ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t);
  405. int symlinkat(const char *, int, const char *);
  406. int unlinkat(int, const char *, int);
  407. #endif /* __POSIX_VISIBLE >= 200809 */
  408. /*
  409. * symlink() was originally in POSIX.1a, which was withdrawn after
  410. * being overtaken by events (1003.1-2001). It was in XPG4.2, and of
  411. * course has been in BSD since 4.2.
  412. */
  413. #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402
  414. int symlink(const char * __restrict, const char * __restrict);
  415. #endif
  416. /* X/Open System Interfaces */
  417. #if __XSI_VISIBLE
  418. char *crypt(const char *, const char *);
  419. long gethostid(void);
  420. int lockf(int, int, off_t);
  421. int nice(int);
  422. int setregid(gid_t, gid_t);
  423. int setreuid(uid_t, uid_t);
  424. #ifndef _SWAB_DECLARED
  425. #define _SWAB_DECLARED
  426. void swab(const void * __restrict, void * __restrict, ssize_t);
  427. #endif /* _SWAB_DECLARED */
  428. void sync(void);
  429. #endif /* __XSI_VISIBLE */
  430. #if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE
  431. int brk(const void *);
  432. int chroot(const char *);
  433. int getdtablesize(void);
  434. int getpagesize(void) __pure2;
  435. char *getpass(const char *);
  436. void *sbrk(intptr_t);
  437. #endif
  438. #if (__XSI_VISIBLE && __XSI_VISIBLE <= 600) || __BSD_VISIBLE
  439. char *getwd(char *); /* obsoleted by getcwd() */
  440. useconds_t
  441. ualarm(useconds_t, useconds_t);
  442. int usleep(useconds_t);
  443. pid_t vfork(void) __returns_twice;
  444. #endif
  445. #if __BSD_VISIBLE
  446. struct timeval; /* select(2) */
  447. struct crypt_data {
  448. int initialized; /* For compatibility with glibc. */
  449. char __buf[256]; /* Buffer returned by crypt_r(). */
  450. };
  451. int acct(const char *);
  452. int async_daemon(void);
  453. int check_utility_compat(const char *);
  454. int close_range(unsigned int, unsigned int, int);
  455. ssize_t copy_file_range(int, off_t *, int, off_t *, size_t, unsigned int);
  456. const char *
  457. crypt_get_format(void);
  458. char *crypt_r(const char *, const char *, struct crypt_data *);
  459. int crypt_set_format(const char *);
  460. int dup3(int, int, int);
  461. int eaccess(const char *, int);
  462. void endusershell(void);
  463. int exect(const char *, char * const *, char * const *);
  464. int execvP(const char *, const char *, char * const *);
  465. int execvpe(const char *, char * const *, char * const *);
  466. int feature_present(const char *);
  467. char *fflagstostr(u_long);
  468. int getdomainname(char *, int);
  469. int getentropy(void *, size_t);
  470. int getgrouplist(const char *, gid_t, gid_t *, int *);
  471. int getloginclass(char *, size_t);
  472. mode_t getmode(const void *, mode_t);
  473. int getosreldate(void);
  474. int getpeereid(int, uid_t *, gid_t *);
  475. int getresgid(gid_t *, gid_t *, gid_t *);
  476. int getresuid(uid_t *, uid_t *, uid_t *);
  477. char *getusershell(void);
  478. int initgroups(const char *, gid_t);
  479. int iruserok(unsigned long, int, const char *, const char *);
  480. int iruserok_sa(const void *, int, int, const char *, const char *);
  481. int issetugid(void);
  482. void __FreeBSD_libc_enter_restricted_mode(void);
  483. int kcmp(pid_t pid1, pid_t pid2, int type, uintptr_t idx1, uintptr_t idx2);
  484. long lpathconf(const char *, int);
  485. #ifndef _MKDTEMP_DECLARED
  486. char *mkdtemp(char *);
  487. #define _MKDTEMP_DECLARED
  488. #endif
  489. #ifndef _MKNOD_DECLARED
  490. int mknod(const char *, mode_t, dev_t);
  491. #define _MKNOD_DECLARED
  492. #endif
  493. #ifndef _MKSTEMP_DECLARED
  494. int mkstemp(char *);
  495. #define _MKSTEMP_DECLARED
  496. #endif
  497. int mkstemps(char *, int);
  498. #ifndef _MKTEMP_DECLARED
  499. char *mktemp(char *);
  500. #define _MKTEMP_DECLARED
  501. #endif
  502. int nfssvc(int, void *);
  503. int nlm_syscall(int, int, int, char **);
  504. int pipe2(int *, int);
  505. int profil(char *, size_t, vm_offset_t, int);
  506. int rcmd(char **, int, const char *, const char *, const char *, int *);
  507. int rcmd_af(char **, int, const char *,
  508. const char *, const char *, int *, int);
  509. int rcmdsh(char **, int, const char *,
  510. const char *, const char *, const char *);
  511. char *re_comp(const char *);
  512. int re_exec(const char *);
  513. int reboot(int);
  514. int revoke(const char *);
  515. pid_t rfork(int) __returns_twice;
  516. pid_t rfork_thread(int, void *, int (*)(void *), void *);
  517. int rresvport(int *);
  518. int rresvport_af(int *, int);
  519. int ruserok(const char *, int, const char *, const char *);
  520. #ifndef _SELECT_DECLARED
  521. #define _SELECT_DECLARED
  522. int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  523. #endif
  524. int setdomainname(const char *, int);
  525. int setgroups(int, const gid_t *);
  526. void sethostid(long);
  527. int sethostname(const char *, int);
  528. int setlogin(const char *);
  529. int setloginclass(const char *);
  530. void *setmode(const char *);
  531. int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */
  532. void setproctitle(const char *_fmt, ...) __printf0like(1, 2);
  533. void setproctitle_fast(const char *_fmt, ...) __printf0like(1, 2);
  534. int setresgid(gid_t, gid_t, gid_t);
  535. int setresuid(uid_t, uid_t, uid_t);
  536. int setrgid(gid_t);
  537. int setruid(uid_t);
  538. void setusershell(void);
  539. int strtofflags(char **, u_long *, u_long *);
  540. int swapon(const char *);
  541. int swapoff(const char *, u_int);
  542. int syscall(int, ...);
  543. off_t __syscall(quad_t, ...);
  544. int undelete(const char *);
  545. int unwhiteout(const char *);
  546. void *valloc(size_t); /* obsoleted by malloc() */
  547. int funlinkat(int, const char *, int, int);
  548. pid_t _Fork(void);
  549. #ifndef _OPTRESET_DECLARED
  550. #define _OPTRESET_DECLARED
  551. extern int optreset; /* getopt(3) external variable */
  552. #endif
  553. #endif /* __BSD_VISIBLE */
  554. __END_DECLS
  555. #endif /* !_UNISTD_H_ */