Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

265 lines
8.5 KiB

  1. /* $OpenBSD: unistd.h,v 1.62 2008/06/25 14:58:54 millert Exp $ */
  2. /* $NetBSD: unistd.h,v 1.26.4.1 1996/05/28 02:31:51 mrg Exp $ */
  3. /*-
  4. * Copyright (c) 1991 The Regents of the University of California.
  5. * 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. * @(#)unistd.h 5.13 (Berkeley) 6/17/91
  32. */
  33. #ifndef _UNISTD_H_
  34. #define _UNISTD_H_
  35. #include <sys/cdefs.h>
  36. #include <sys/types.h>
  37. #include <sys/unistd.h>
  38. #define STDIN_FILENO 0 /* standard input file descriptor */
  39. #define STDOUT_FILENO 1 /* standard output file descriptor */
  40. #define STDERR_FILENO 2 /* standard error file descriptor */
  41. #if __XPG_VISIBLE || __POSIX_VISIBLE >= 200112
  42. #define F_ULOCK 0 /* unlock locked section */
  43. #define F_LOCK 1 /* lock a section for exclusive use */
  44. #define F_TLOCK 2 /* test and lock a section for exclusive use */
  45. #define F_TEST 3 /* test a section for locks by other procs */
  46. #endif
  47. #if __POSIX_VISIBLE
  48. #define _POSIX_REENTRANT_FUNCTIONS 1
  49. #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
  50. #endif
  51. #ifndef NULL
  52. #ifdef __GNUG__
  53. #define NULL __null
  54. #else
  55. #define NULL 0L
  56. #endif
  57. #endif
  58. __BEGIN_DECLS
  59. __dead void _exit(int);
  60. int access(const char *, int);
  61. unsigned int alarm(unsigned int);
  62. int chdir(const char *);
  63. int chown(const char *, uid_t, gid_t);
  64. int close(int);
  65. int dup(int);
  66. int dup2(int, int);
  67. int execl(const char *, const char *, ...)
  68. __attribute__((sentinel));
  69. int execle(const char *, const char *, ...);
  70. int execlp(const char *, const char *, ...)
  71. __attribute__((sentinel));
  72. int execv(const char *, char * const *);
  73. int execve(const char *, char * const *, char * const *);
  74. int execvp(const char *, char * const *);
  75. pid_t fork(void);
  76. long fpathconf(int, int);
  77. char *getcwd(char *, size_t)
  78. __attribute__((__bounded__(__string__,1,2)))
  79. __attribute__((__bounded__(__minbytes__,1,1024)));
  80. gid_t getegid(void);
  81. uid_t geteuid(void);
  82. gid_t getgid(void);
  83. int getgroups(int, gid_t *);
  84. char *getlogin(void);
  85. pid_t getpgrp(void);
  86. pid_t getpid(void);
  87. pid_t getppid(void);
  88. uid_t getuid(void);
  89. int isatty(int);
  90. int link(const char *, const char *);
  91. off_t lseek(int, off_t, int);
  92. long pathconf(const char *, int);
  93. int pause(void);
  94. int pipe(int *);
  95. ssize_t read(int, void *, size_t)
  96. __attribute__((__bounded__(__buffer__,2,3)));
  97. int rmdir(const char *);
  98. int setgid(gid_t);
  99. int setuid(uid_t);
  100. unsigned int sleep(unsigned int);
  101. long sysconf(int);
  102. pid_t tcgetpgrp(int);
  103. int tcsetpgrp(int, pid_t);
  104. char *ttyname(int);
  105. int unlink(const char *);
  106. ssize_t write(int, const void *, size_t)
  107. __attribute__((__bounded__(__buffer__,2,3)));
  108. #if __POSIX_VISIBLE || __XPG_VISIBLE >= 300
  109. pid_t setsid(void);
  110. int setpgid(pid_t, pid_t);
  111. #endif
  112. #if __POSIX_VISIBLE >= 199209 || __XPG_VISIBLE
  113. size_t confstr(int, char *, size_t)
  114. __attribute__((__bounded__(__string__,2,3)));
  115. #ifndef _GETOPT_DEFINED_
  116. #define _GETOPT_DEFINED_
  117. int getopt(int, char * const *, const char *);
  118. extern char *optarg; /* getopt(3) external variables */
  119. extern int opterr, optind, optopt, optreset;
  120. /* XXX - getsubopt does not belong here */
  121. int getsubopt(char **, char * const *, char **);
  122. extern char *suboptarg; /* getsubopt(3) external variable */
  123. #endif /* _GETOPT_DEFINED_ */
  124. #endif
  125. #if __POSIX_VISIBLE >= 199506 || __XPG_VISIBLE
  126. int fsync(int);
  127. int ftruncate(int, off_t);
  128. int getlogin_r(char *, size_t)
  129. __attribute__((__bounded__(__string__,1,2)))
  130. __attribute__((__bounded__(__minbytes__,1,32)));
  131. #endif
  132. #if __XPG_VISIBLE || __BSD_VISIBLE
  133. char *crypt(const char *, const char *);
  134. int encrypt(char *, int);
  135. int fchdir(int);
  136. int fchown(int, uid_t, gid_t);
  137. long gethostid(void);
  138. char *getwd(char *)
  139. __attribute__ ((__bounded__(__minbytes__,1,1024)));
  140. int lchown(const char *, uid_t, gid_t);
  141. int mkstemp(char *);
  142. char *mktemp(char *);
  143. int nice(int);
  144. int readlink(const char *, char *, size_t)
  145. __attribute__ ((__bounded__(__string__,2,3)));
  146. int setkey(const char *);
  147. int setpgrp(pid_t pid, pid_t pgrp); /* obsoleted by setpgid() */
  148. int setregid(gid_t, gid_t);
  149. int setreuid(uid_t, uid_t);
  150. void swab(const void *, void *, size_t);
  151. void sync(void);
  152. int truncate(const char *, off_t);
  153. unsigned int ualarm(unsigned int, unsigned int);
  154. int usleep(useconds_t);
  155. pid_t vfork(void);
  156. #endif
  157. #if __XPG_VISIBLE >= 420
  158. pid_t getpgid(pid_t);
  159. pid_t getsid(pid_t);
  160. #endif
  161. #if __XPG_VISIBLE >= 500
  162. ssize_t pread(int, void *, size_t, off_t);
  163. ssize_t pwrite(int, const void *, size_t, off_t);
  164. int ttyname_r(int, char *, size_t)
  165. __attribute__((__bounded__(__string__,2,3)));
  166. #endif
  167. #if __BSD_VISIBLE || __XPG_VISIBLE <= 500
  168. /* Interfaces withdrawn by X/Open Issue 5 Version 0 */
  169. int brk(void *);
  170. int chroot(const char *);
  171. int getdtablesize(void);
  172. int getpagesize(void);
  173. char *getpass(const char *);
  174. void *sbrk(int);
  175. #endif
  176. #if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420
  177. int lockf(int, int, off_t);
  178. #endif
  179. #if __POSIX_VISIBLE >= 200112 || __XPG_VISIBLE >= 420 || __BSD_VISIBLE
  180. int symlink(const char *, const char *);
  181. int gethostname(char *, size_t)
  182. __attribute__ ((__bounded__(__string__,1,2)));
  183. int setegid(gid_t);
  184. int seteuid(uid_t);
  185. #endif
  186. #if __BSD_VISIBLE
  187. int acct(const char *);
  188. int closefrom(int);
  189. int des_cipher(const char *, char *, int32_t, int);
  190. int des_setkey(const char *);
  191. void endusershell(void);
  192. int exect(const char *, char * const *, char * const *);
  193. char *fflagstostr(u_int32_t);
  194. int getdomainname(char *, size_t)
  195. __attribute__ ((__bounded__(__string__,1,2)));
  196. int getgrouplist(const char *, gid_t, gid_t *, int *);
  197. mode_t getmode(const void *, mode_t);
  198. int getresgid(gid_t *, gid_t *, gid_t *);
  199. int getresuid(uid_t *, uid_t *, uid_t *);
  200. char *getusershell(void);
  201. int initgroups(const char *, gid_t);
  202. int iruserok(u_int32_t, int, const char *, const char *);
  203. int iruserok_sa(const void *, int, int, const char *, const char *);
  204. int issetugid(void);
  205. char *mkdtemp(char *);
  206. int mkstemps(char *, int);
  207. int nfssvc(int, void *);
  208. int profil(char *, size_t, unsigned long, unsigned int)
  209. __attribute__ ((__bounded__(__string__,1,2)));
  210. int quotactl(const char *, int, int, char *);
  211. int rcmd(char **, int, const char *,
  212. const char *, const char *, int *);
  213. int rcmd_af(char **, int, const char *,
  214. const char *, const char *, int *, int);
  215. int rcmdsh(char **, int, const char *,
  216. const char *, const char *, char *);
  217. char *re_comp(const char *);
  218. int re_exec(const char *);
  219. int reboot(int);
  220. int revoke(const char *);
  221. int rfork(int opts);
  222. int rresvport(int *);
  223. int rresvport_af(int *, int);
  224. int ruserok(const char *, int, const char *, const char *);
  225. #ifndef _SELECT_DEFINED_
  226. #define _SELECT_DECLARED
  227. struct timeval;
  228. int select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
  229. #endif
  230. int setdomainname(const char *, size_t);
  231. int setgroups(int, const gid_t *);
  232. int sethostid(long);
  233. int sethostname(const char *, size_t);
  234. int setlogin(const char *);
  235. void *setmode(const char *);
  236. int setresgid(gid_t, gid_t, gid_t);
  237. int setresuid(uid_t, uid_t, uid_t);
  238. int setrgid(gid_t);
  239. int setruid(uid_t);
  240. void setusershell(void);
  241. int strtofflags(char **, u_int32_t *, u_int32_t *);
  242. int swapctl(int cmd, const void *arg, int misc);
  243. int syscall(int, ...);
  244. #endif /* __BSD_VISIBLE */
  245. __END_DECLS
  246. #endif /* !_UNISTD_H_ */