unistd.h revision 98269
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: head/include/unistd.h 98269 2002-06-15 23:35:37Z wollman $ 35 */ 36 37#ifndef _UNISTD_H_ 38#define _UNISTD_H_ 39 40#include <sys/cdefs.h> 41#include <sys/types.h> /* XXX adds too much pollution. */ 42#include <sys/unistd.h> 43#include <sys/_types.h> 44 45#ifdef _BSD_GID_T_ 46typedef _BSD_GID_T_ gid_t; 47#undef _BSD_GID_T_ 48#endif 49 50#ifdef _BSD_SIZE_T_ 51typedef _BSD_SIZE_T_ size_t; 52#undef _BSD_SIZE_T_ 53#endif 54 55#ifdef _BSD_SSIZE_T_ 56typedef _BSD_SSIZE_T_ ssize_t; 57#undef _BSD_SSIZE_T_ 58#endif 59 60#ifdef _BSD_UID_T_ 61typedef _BSD_UID_T_ uid_t; 62#undef _BSD_UID_T_ 63#endif 64 65/* 66 * XXX missing type definitions for off_t, pid_t and useconds_t. 67 */ 68 69#define STDIN_FILENO 0 /* standard input file descriptor */ 70#define STDOUT_FILENO 1 /* standard output file descriptor */ 71#define STDERR_FILENO 2 /* standard error file descriptor */ 72 73#ifndef NULL 74#define NULL 0 /* null pointer constant */ 75#endif 76 77#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 78#define F_ULOCK 0 /* unlock locked section */ 79#define F_LOCK 1 /* lock a section for exclusive use */ 80#define F_TLOCK 2 /* test and lock a section for exclusive use */ 81#define F_TEST 3 /* test a section for locks by other procs */ 82#endif 83 84__BEGIN_DECLS 85/* 1003.1-1990 */ 86void _exit(int) __dead2; 87int access(const char *, int); 88unsigned int alarm(unsigned int); 89int chdir(const char *); 90int chown(const char *, uid_t, gid_t); 91int close(int); 92int dup(int); 93int dup2(int, int); 94int eaccess(const char *, int); 95int 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 137extern char *optarg; /* getopt(3) external variables */ 138extern int optind, opterr, optopt; 139int getopt(int, char * const [], const char *); 140 141/* 1003.1b-1993 */ 142#if __POSIX_VISIBLE >= 199309 143/* 144 * Need to check old copies of POSIX to determine when each of these 145 * interfaces was added. 146 */ 147size_t confstr(int, char *, size_t); 148int fchown(int, uid_t, gid_t); 149int fsync(int); 150 151/* symlink is from .1a and XPG4.2 -- need to check version for the former */ 152int symlink(const char *, const char *); 153#endif 154 155/* ISO/IEC 9945-1: 1996 */ 156#if __POSIX_VISIBLE >= 199506 157/* 158 * ftruncate() was in the POSIX Realtime Extension (it's used for shared 159 * memory), but truncate() was not. 160 */ 161#ifndef _FTRUNCATE_DECLARED 162#define _FTRUNCATE_DECLARED 163int ftruncate(int, off_t); 164#endif 165 166int getlogin_r(char *, int); 167#endif 168 169/* 1003.1-2001 */ 170#if __POSIX_VISIBLE >= 200112 171int gethostname(char *, int /* socklen_t */); 172int setegid(gid_t); 173int seteuid(uid_t); 174#endif 175 176/* X/Open System Interfaces */ 177#if __XSI_VISIBLE 178char *crypt(const char *, const char *); 179/* char *ctermid(char *); */ /* XXX ??? */ 180int encrypt(char *, int); 181int fchdir(int); 182int getpgid(pid_t _pid); 183int getsid(pid_t _pid); 184char *getwd(char *); /* LEGACY: obsoleted by getcwd() */ 185int lchown(const char *, uid_t, gid_t); 186int lockf(int, int, off_t); 187int nice(int); 188ssize_t pread(int, void *, size_t, off_t); 189ssize_t pwrite(int, const void *, size_t, off_t); 190int setpgrp(pid_t _pid, pid_t _pgrp); /* obsoleted by setpgid() */ 191int setregid(gid_t, gid_t); 192int setreuid(uid_t, uid_t); 193/* void swab(const void *__restrict, void *__restrict, ssize_t); */ 194void sync(void); 195unsigned int ualarm(unsigned int, unsigned int); 196int usleep(unsigned int); 197pid_t vfork(void); 198 199/* See comment at ftruncate() above. */ 200#ifndef _TRUNCATE_DECLARED 201#define _TRUNCATE_DECLARED 202int truncate(const char *, off_t); 203#endif 204#endif /* __XSI_VISIBLE */ 205 206#if __BSD_VISIBLE 207struct timeval; /* select(2) */ 208int acct(const char *); 209int async_daemon(void); 210int brk(const void *); 211int chroot(const char *); 212const char * 213 crypt_get_format(void); 214int crypt_set_format(const char *); 215int des_cipher(const char *, char *, long, int); 216int des_setkey(const char *key); 217void endusershell(void); 218int exect(const char *, char * const *, char * const *); 219char *fflagstostr(u_long); 220int getdomainname(char *, int); 221int getdtablesize(void); 222int getgrouplist(const char *, gid_t, gid_t *, int *); 223long gethostid(void); 224mode_t getmode(const void *, mode_t); 225int getpagesize(void) __pure2; 226char *getpass(const char *); 227int getpeereid(int, uid_t *, gid_t *); 228int getresgid(gid_t *, gid_t *, gid_t *); 229int getresuid(uid_t *, uid_t *, uid_t *); 230char *getusershell(void); 231int initgroups(const char *, gid_t); 232int iruserok(unsigned long, int, const char *, const char *); 233int iruserok_sa(const void *, int, int, const char *, const char *); 234int issetugid(void); 235char *mkdtemp(char *); 236int mknod(const char *, mode_t, dev_t); 237int mkstemp(char *); 238int mkstemps(char *, int); 239char *mktemp(char *); 240int nfsclnt(int, void *); 241int nfssvc(int, void *); 242int profil(char *, size_t, vm_offset_t, int); 243int rcmd(char **, int, const char *, const char *, const char *, int *); 244int rcmd_af(char **, int, const char *, 245 const char *, const char *, int *, int); 246int rcmdsh(char **, int, const char *, 247 const char *, const char *, const char *); 248char *re_comp(const char *); 249int re_exec(const char *); 250int readlink(const char *, char *, int); 251int reboot(int); 252int revoke(const char *); 253pid_t rfork(int); 254pid_t rfork_thread(int, void *, int (*)(void *), void *); 255int rresvport(int *); 256int rresvport_af(int *, int); 257int ruserok(const char *, int, const char *, const char *); 258void *sbrk(intptr_t); 259int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); 260int setdomainname(const char *, int); 261int setgroups(int, const gid_t *); 262void sethostid(long); 263int sethostname(const char *, int); 264int setkey(const char *); 265int setlogin(const char *); 266void *setmode(const char *); 267int setresgid(gid_t, gid_t, gid_t); 268int setresuid(uid_t, uid_t, uid_t); 269int setrgid(gid_t); 270int setruid(uid_t); 271void setusershell(void); 272int strtofflags(char **, u_long *, u_long *); 273int swapon(const char *); 274int syscall(int, ...); 275off_t __syscall(quad_t, ...); 276int ttyslot(void); 277int undelete(const char *); 278int unwhiteout(const char *); 279void *valloc(size_t); /* obsoleted by malloc() */ 280 281extern char *suboptarg; /* getsubopt(3) external variable */ 282int getsubopt(char **, char * const *, char **); 283extern int optreset; /* getopt(3) external variable */ 284#endif /* __BSD_VISIBLE */ 285__END_DECLS 286 287#endif /* !_UNISTD_H_ */ 288