1 /*- 2 * Copyright (c) 1991, 1993, 1994 3 * The Regents of the University of California. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 3. All advertising materials mentioning features or use of this software 14 * must display the following acknowledgement: 15 * This product includes software developed by the University of 16 * California, Berkeley and its contributors. 17 * 4. Neither the name of the University nor the names of its contributors 18 * may be used to endorse or promote products derived from this software 19 * without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 22 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 25 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * SUCH DAMAGE. 32 * 33 * @(#)unistd.h 8.12 (Berkeley) 4/27/95 34 * $FreeBSD$ 35 */ 36 37 #ifndef _UNISTD_H_ 38 #define _UNISTD_H_ 39 40 #include <sys/cdefs.h> 41 #include <sys/types.h> 42 #include <sys/unistd.h> 43 44 #define STDIN_FILENO 0 /* standard input file descriptor */ 45 #define STDOUT_FILENO 1 /* standard output file descriptor */ 46 #define STDERR_FILENO 2 /* standard error file descriptor */ 47 48 #ifndef NULL 49 #define NULL 0 /* null pointer constant */ 50 #endif 51 52 #ifndef _POSIX_SOURCE 53 #define F_ULOCK 0 /* unlock locked section */ 54 #define F_LOCK 1 /* lock a section for exclusive use */ 55 #define F_TLOCK 2 /* test and lock a section for exclusive use */ 56 #define F_TEST 3 /* test a section for locks by other procs */ 57 #endif 58 59 __BEGIN_DECLS 60 void _exit(int) __dead2; 61 int access(const char *, int); 62 unsigned int alarm(unsigned int); 63 int chdir(const char *); 64 int chown(const char *, uid_t, gid_t); 65 int close(int); 66 int dup(int); 67 int dup2(int, int); 68 int eaccess(const char *, int); 69 int execl(const char *, const char *, ...); 70 int execle(const char *, const char *, ...); 71 int execlp(const char *, const char *, ...); 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 gid_t getegid(void); 79 uid_t geteuid(void); 80 gid_t getgid(void); 81 int getgroups(int, gid_t []); 82 char *getlogin(void); 83 pid_t getpgrp(void); 84 pid_t getpid(void); 85 pid_t getppid(void); 86 uid_t getuid(void); 87 int isatty(int); 88 int link(const char *, const char *); 89 #ifndef _LSEEK_DECLARED 90 #define _LSEEK_DECLARED 91 off_t lseek(int, off_t, int); 92 #endif 93 long pathconf(const char *, int); 94 int pause(void); 95 int pipe(int *); 96 ssize_t read(int, void *, size_t); 97 int rmdir(const char *); 98 int setgid(gid_t); 99 int setpgid(pid_t, pid_t); 100 void setproctitle(const char *_fmt, ...) __printf0like(1, 2); 101 pid_t setsid(void); 102 int setuid(uid_t); 103 unsigned int sleep(unsigned int); 104 long sysconf(int); 105 pid_t tcgetpgrp(int); 106 int tcsetpgrp(int, pid_t); 107 char *ttyname(int); 108 int unlink(const char *); 109 ssize_t write(int, const void *, size_t); 110 111 extern char *optarg; /* getopt(3) external variables */ 112 extern int optind, opterr, optopt; 113 int getopt(int, char * const [], const char *); 114 115 #ifndef _POSIX_SOURCE 116 struct timeval; /* select(2) */ 117 int acct(const char *); 118 int async_daemon(void); 119 int brk(const void *); 120 int chroot(const char *); 121 size_t confstr(int, char *, size_t); 122 char *crypt(const char *, const char *); 123 __const char * 124 crypt_get_format(void); 125 int crypt_set_format(const char *); 126 int des_cipher(const char *, char *, long, int); 127 int des_setkey(const char *key); 128 int encrypt(char *, int); 129 void endusershell(void); 130 int exect(const char *, char * const *, char * const *); 131 int fchdir(int); 132 int fchown(int, uid_t, gid_t); 133 char *fflagstostr(u_long); 134 int fsync(int); 135 #ifndef _FTRUNCATE_DECLARED 136 #define _FTRUNCATE_DECLARED 137 int ftruncate(int, off_t); 138 #endif 139 int getdomainname(char *, int); 140 int getdtablesize(void); 141 int getgrouplist(const char *, gid_t, gid_t *, int *); 142 long gethostid(void); 143 int gethostname(char *, int); 144 int getlogin_r(char *, int); 145 mode_t getmode(const void *, mode_t); 146 int getpagesize(void) __pure2; 147 char *getpass(const char *); 148 int getpeereid(int, uid_t *, gid_t *); 149 int getpgid(pid_t _pid); 150 int getresgid(gid_t *, gid_t *, gid_t *); 151 int getresuid(uid_t *, uid_t *, uid_t *); 152 int getsid(pid_t _pid); 153 char *getusershell(void); 154 char *getwd(char *); /* obsoleted by getcwd() */ 155 int initgroups(const char *, gid_t); 156 int iruserok(unsigned long, int, const char *, const char *); 157 int iruserok_sa(const void *, int, int, const char *, const char *); 158 int issetugid(void); 159 int lchown(const char *, uid_t, gid_t); 160 int lockf(int, int, off_t); 161 char *mkdtemp(char *); 162 int mknod(const char *, mode_t, dev_t); 163 int mkstemp(char *); 164 int mkstemps(char *, int); 165 char *mktemp(char *); 166 int nfsclnt(int, void *); 167 int nfssvc(int, void *); 168 int nice(int); 169 ssize_t pread(int, void *, size_t, off_t); 170 int profil(char *, size_t, vm_offset_t, int); 171 ssize_t pwrite(int, const void *, size_t, off_t); 172 int rcmd(char **, int, const char *, const char *, const char *, int *); 173 int rcmd_af(char **, int, const char *, 174 const char *, const char *, int *, int); 175 int rcmdsh(char **, int, const char *, 176 const char *, const char *, const char *); 177 char *re_comp(const char *); 178 int re_exec(const char *); 179 int readlink(const char *, char *, int); 180 int reboot(int); 181 int revoke(const char *); 182 pid_t rfork(int); 183 pid_t rfork_thread(int, void *, int (*)(void *), void *); 184 int rresvport(int *); 185 int rresvport_af(int *, int); 186 int ruserok(const char *, int, const char *, const char *); 187 void *sbrk(intptr_t); 188 int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); 189 int setdomainname(const char *, int); 190 int setegid(gid_t); 191 int seteuid(uid_t); 192 int setgroups(int, const gid_t *); 193 void sethostid(long); 194 int sethostname(const char *, int); 195 int setkey(const char *); 196 int setlogin(const char *); 197 void *setmode(const char *); 198 int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */ 199 int setregid(gid_t, gid_t); 200 int setresgid(gid_t, gid_t, gid_t); 201 int setresuid(uid_t, uid_t, uid_t); 202 int setreuid(uid_t, uid_t); 203 int setrgid(gid_t); 204 int setruid(uid_t); 205 void setusershell(void); 206 int strtofflags(char **, u_long *, u_long *); 207 int swapon(const char *); 208 int symlink(const char *, const char *); 209 void sync(void); 210 int syscall(int, ...); 211 off_t __syscall(quad_t, ...); 212 #ifndef _TRUNCATE_DECLARED 213 #define _TRUNCATE_DECLARED 214 int truncate(const char *, off_t); 215 #endif 216 int ttyslot(void); 217 unsigned int ualarm(unsigned int, unsigned int); 218 int undelete(const char *); 219 int unwhiteout(const char *); 220 int usleep(unsigned int); 221 void *valloc(size_t); /* obsoleted by malloc() */ 222 pid_t vfork(void); 223 224 extern char *suboptarg; /* getsubopt(3) external variable */ 225 int getsubopt(char **, char * const *, char **); 226 #endif /* !_POSIX_SOURCE */ 227 extern int optreset; /* getopt(3) external variable */ 228 __END_DECLS 229 230 #endif /* !_UNISTD_H_ */ 231