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