unistd.h revision 103012
125889Sdfr/*- 225889Sdfr * Copyright (c) 1991, 1993, 1994 325889Sdfr * The Regents of the University of California. All rights reserved. 425889Sdfr * 525889Sdfr * Redistribution and use in source and binary forms, with or without 625889Sdfr * modification, are permitted provided that the following conditions 725889Sdfr * are met: 825889Sdfr * 1. Redistributions of source code must retain the above copyright 925889Sdfr * notice, this list of conditions and the following disclaimer. 1025889Sdfr * 2. Redistributions in binary form must reproduce the above copyright 1125889Sdfr * notice, this list of conditions and the following disclaimer in the 1225889Sdfr * documentation and/or other materials provided with the distribution. 1325889Sdfr * 3. All advertising materials mentioning features or use of this software 1425889Sdfr * must display the following acknowledgement: 1525889Sdfr * This product includes software developed by the University of 1625889Sdfr * California, Berkeley and its contributors. 1725889Sdfr * 4. Neither the name of the University nor the names of its contributors 1825889Sdfr * may be used to endorse or promote products derived from this software 1925889Sdfr * without specific prior written permission. 2025889Sdfr * 2125889Sdfr * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 2225889Sdfr * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 2325889Sdfr * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 2425889Sdfr * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 2525889Sdfr * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2625889Sdfr * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2725889Sdfr * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2825889Sdfr * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2925889Sdfr * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 3025889Sdfr * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 3125889Sdfr * SUCH DAMAGE. 3225889Sdfr * 3325889Sdfr * @(#)unistd.h 8.12 (Berkeley) 4/27/95 3425889Sdfr * $FreeBSD: head/include/unistd.h 103012 2002-09-06 11:24:06Z tjr $ 3525889Sdfr */ 3625889Sdfr 3725889Sdfr#ifndef _UNISTD_H_ 3825889Sdfr#define _UNISTD_H_ 3925889Sdfr 4025889Sdfr#include <sys/cdefs.h> 4125889Sdfr#include <sys/types.h> /* XXX adds too much pollution. */ 4225889Sdfr#include <sys/unistd.h> 4325889Sdfr#include <sys/_types.h> 4425889Sdfr 4525889Sdfr#ifndef _GID_T_DECLARED 4625889Sdfrtypedef __gid_t gid_t; 4725889Sdfr#define _GID_T_DECLARED 4825889Sdfr#endif 4925889Sdfr 5025889Sdfr#ifndef _SIZE_T_DECLARED 5125889Sdfrtypedef __size_t size_t; 5225889Sdfr#define _SIZE_T_DECLARED 5325889Sdfr#endif 5425889Sdfr 5525889Sdfr#ifndef _SSIZE_T_DECLARED 5625889Sdfrtypedef __ssize_t ssize_t; 5725889Sdfr#define _SSIZE_T_DECLARED 5825889Sdfr#endif 5925889Sdfr 6025889Sdfr#ifndef _UID_T_DECLARED 6125889Sdfrtypedef __uid_t_ uid_t; 6225889Sdfr#define _UID_T_DECLARED 6325889Sdfr#endif 6425889Sdfr 6525889Sdfr/* 6625889Sdfr * XXX missing type definitions for off_t, pid_t and useconds_t. 6725889Sdfr */ 6825889Sdfr 6925889Sdfr#define STDIN_FILENO 0 /* standard input file descriptor */ 7025889Sdfr#define STDOUT_FILENO 1 /* standard output file descriptor */ 7125889Sdfr#define STDERR_FILENO 2 /* standard error file descriptor */ 7225889Sdfr 7325889Sdfr#ifndef NULL 7425889Sdfr#define NULL 0 /* null pointer constant */ 7525889Sdfr#endif 7625889Sdfr 7725889Sdfr#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 7825889Sdfr#define F_ULOCK 0 /* unlock locked section */ 7925889Sdfr#define F_LOCK 1 /* lock a section for exclusive use */ 8025889Sdfr#define F_TLOCK 2 /* test and lock a section for exclusive use */ 8125889Sdfr#define F_TEST 3 /* test a section for locks by other procs */ 8225889Sdfr#endif 8325889Sdfr 8425889Sdfr__BEGIN_DECLS 8525889Sdfr/* 1003.1-1990 */ 8625889Sdfrvoid _exit(int) __dead2; 8725889Sdfrint access(const char *, int); 8825889Sdfrunsigned int alarm(unsigned int); 8925889Sdfrint chdir(const char *); 9025889Sdfrint chown(const char *, uid_t, gid_t); 9125889Sdfrint close(int); 9225889Sdfrint dup(int); 9325889Sdfrint dup2(int, int); 9425889Sdfrint eaccess(const char *, int); 9525889Sdfrint execl(const char *, const char *, ...); 96int execle(const char *, const char *, ...); 97int execlp(const char *, const char *, ...); 98int execv(const char *, char * const *); 99int execve(const char *, char * const *, char * const *); 100int execvp(const char *, char * const *); 101pid_t fork(void); 102long fpathconf(int, int); 103char *getcwd(char *, size_t); 104gid_t getegid(void); 105uid_t geteuid(void); 106gid_t getgid(void); 107int getgroups(int, gid_t []); 108char *getlogin(void); 109pid_t getpgrp(void); 110pid_t getpid(void); 111pid_t getppid(void); 112uid_t getuid(void); 113int isatty(int); 114int link(const char *, const char *); 115#ifndef _LSEEK_DECLARED 116#define _LSEEK_DECLARED 117off_t lseek(int, off_t, int); 118#endif 119long pathconf(const char *, int); 120int pause(void); 121int pipe(int *); 122ssize_t read(int, void *, size_t); 123int rmdir(const char *); 124int setgid(gid_t); 125int setpgid(pid_t, pid_t); 126void setproctitle(const char *_fmt, ...) __printf0like(1, 2); 127pid_t setsid(void); 128int setuid(uid_t); 129unsigned int sleep(unsigned int); 130long sysconf(int); 131pid_t tcgetpgrp(int); 132int tcsetpgrp(int, pid_t); 133char *ttyname(int); 134int unlink(const char *); 135ssize_t write(int, const void *, size_t); 136 137/* 1003.2-1992 */ 138#if __POSIX_VISIBLE >= 199209 139size_t confstr(int, char *, size_t); 140int getopt(int, char * const [], const char *); 141 142extern char *optarg; /* getopt(3) external variables */ 143extern int optind, opterr, optopt; 144 145#define _CS_PATH 1 /* default value of PATH */ 146#endif 147 148/* ISO/IEC 9945-1: 1996 */ 149#if __POSIX_VISIBLE >= 199506 150int fsync(int); 151 152/* 153 * ftruncate() was in the POSIX Realtime Extension (it's used for shared 154 * memory), but truncate() was not. 155 */ 156#ifndef _FTRUNCATE_DECLARED 157#define _FTRUNCATE_DECLARED 158int ftruncate(int, off_t); 159#endif 160 161int getlogin_r(char *, int); 162#endif 163 164/* 1003.1-2001 */ 165#if __POSIX_VISIBLE >= 200112 166int fchown(int, uid_t, gid_t); 167int gethostname(char *, int /* socklen_t */); 168int setegid(gid_t); 169int seteuid(uid_t); 170 171/* X/Open mistake copied by POSIX */ 172#define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2 173#define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3 174#define _CS_POSIX_V6_ILP32_OFF32_LIBS 4 175#define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5 176#define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6 177#define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7 178#define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8 179#define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9 180#define _CS_POSIX_V6_LP64_OFF64_LIBS 10 181#define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11 182#define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12 183#define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13 184#define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14 185#endif 186 187/* 188 * symlink() was originally in POSIX.1a, which was withdrawn after 189 * being overtaken by events (1003.1-2001). It was in XPG4.2, and of 190 * course has been in BSD practically forever. 191 */ 192#if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 || __BSD_VISIBLE 193int symlink(const char * __restrict, const char * __restrict); 194#endif 195 196/* X/Open System Interfaces */ 197#if __XSI_VISIBLE 198char *crypt(const char *, const char *); 199/* char *ctermid(char *); */ /* XXX ??? */ 200int encrypt(char *, int); 201int fchdir(int); 202int getpgid(pid_t _pid); 203int getsid(pid_t _pid); 204char *getwd(char *); /* LEGACY: obsoleted by getcwd() */ 205int lchown(const char *, uid_t, gid_t); 206int lockf(int, int, off_t); 207int nice(int); 208ssize_t pread(int, void *, size_t, off_t); 209ssize_t pwrite(int, const void *, size_t, off_t); 210int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */ 211int setregid(gid_t, gid_t); 212int setreuid(uid_t, uid_t); 213/* void swab(const void * __restrict, void * __restrict, ssize_t); */ 214void sync(void); 215unsigned int ualarm(unsigned int, unsigned int); 216int usleep(unsigned int); 217pid_t vfork(void); 218 219/* See comment at ftruncate() above. */ 220#ifndef _TRUNCATE_DECLARED 221#define _TRUNCATE_DECLARED 222int truncate(const char *, off_t); 223#endif 224#endif /* __XSI_VISIBLE */ 225 226#if __BSD_VISIBLE 227struct timeval; /* select(2) */ 228int acct(const char *); 229int async_daemon(void); 230int brk(const void *); 231int chroot(const char *); 232const char * 233 crypt_get_format(void); 234int crypt_set_format(const char *); 235int des_cipher(const char *, char *, long, int); 236int des_setkey(const char *key); 237void endusershell(void); 238int exect(const char *, char * const *, char * const *); 239char *fflagstostr(u_long); 240int getdomainname(char *, int); 241int getdtablesize(void); 242int getgrouplist(const char *, gid_t, gid_t *, int *); 243long gethostid(void); 244mode_t getmode(const void *, mode_t); 245int getpagesize(void) __pure2; 246char *getpass(const char *); 247int getpeereid(int, uid_t *, gid_t *); 248int getresgid(gid_t *, gid_t *, gid_t *); 249int getresuid(uid_t *, uid_t *, uid_t *); 250char *getusershell(void); 251int initgroups(const char *, gid_t); 252int iruserok(unsigned long, int, const char *, const char *); 253int iruserok_sa(const void *, int, int, const char *, const char *); 254int issetugid(void); 255char *mkdtemp(char *); 256int mknod(const char *, mode_t, dev_t); 257int mkstemp(char *); 258int mkstemps(char *, int); 259char *mktemp(char *); 260int nfsclnt(int, void *); 261int nfssvc(int, void *); 262int profil(char *, size_t, vm_offset_t, int); 263int rcmd(char **, int, const char *, const char *, const char *, int *); 264int rcmd_af(char **, int, const char *, 265 const char *, const char *, int *, int); 266int rcmdsh(char **, int, const char *, 267 const char *, const char *, const char *); 268char *re_comp(const char *); 269int re_exec(const char *); 270int readlink(const char *, char *, int); 271int reboot(int); 272int revoke(const char *); 273pid_t rfork(int); 274pid_t rfork_thread(int, void *, int (*)(void *), void *); 275int rresvport(int *); 276int rresvport_af(int *, int); 277int ruserok(const char *, int, const char *, const char *); 278void *sbrk(intptr_t); 279int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); 280int setdomainname(const char *, int); 281int setgroups(int, const gid_t *); 282void sethostid(long); 283int sethostname(const char *, int); 284int setkey(const char *); 285int setlogin(const char *); 286void *setmode(const char *); 287int setresgid(gid_t, gid_t, gid_t); 288int setresuid(uid_t, uid_t, uid_t); 289int setrgid(gid_t); 290int setruid(uid_t); 291void setusershell(void); 292int strtofflags(char **, u_long *, u_long *); 293int swapon(const char *); 294int syscall(int, ...); 295off_t __syscall(quad_t, ...); 296int ttyslot(void); 297int undelete(const char *); 298int unwhiteout(const char *); 299void *valloc(size_t); /* obsoleted by malloc() */ 300 301extern char *suboptarg; /* getsubopt(3) external variable */ 302int getsubopt(char **, char * const *, char **); 303extern int optreset; /* getopt(3) external variable */ 304#endif /* __BSD_VISIBLE */ 305__END_DECLS 306 307#endif /* !_UNISTD_H_ */ 308