1 /* 2 * Copyright (c) 1989 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.redist.c% 6 * 7 * @(#)unistd.h 5.12 (Berkeley) 02/22/91 8 */ 9 10 #ifndef _UNISTD_H_ 11 #define _UNISTD_H_ 12 13 /* compile-time symbolic constants */ 14 #define _POSIX_JOB_CONTROL /* implementation supports job control */ 15 /*#define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ 16 #define _POSIX_VERSION 198808L 17 18 /* execution-time symbolic constants */ 19 #define _POSIX_CHOWN_RESTRICTED /* chown requires appropriate privileges */ 20 #define _POSIX_NO_TRUNC /* too-long path components generate errors */ 21 /* may disable terminal special characters */ 22 #define _POSIX_VDISABLE ((unsigned char)'\377') 23 24 /* access function */ 25 #define F_OK 0 /* test for existence of file */ 26 #define X_OK 0x01 /* test for execute or search permission */ 27 #define W_OK 0x02 /* test for write permission */ 28 #define R_OK 0x04 /* test for read permission */ 29 30 /* whence values for lseek(2) */ 31 #define SEEK_SET 0 /* set file offset to offset */ 32 #define SEEK_CUR 1 /* set file offset to current plus offset */ 33 #define SEEK_END 2 /* set file offset to EOF plus offset */ 34 35 #ifndef _POSIX_SOURCE 36 /* whence values for lseek(2); renamed by POSIX 1003.1 */ 37 #define L_SET SEEK_SET 38 #define L_INCR SEEK_CUR 39 #define L_XTND SEEK_END 40 #endif 41 42 /* map a stream pointer to a file descriptor */ 43 #define STDIN_FILENO 0 /* standard input value, stdin */ 44 #define STDOUT_FILENO 1 /* standard output value, stdout */ 45 #define STDERR_FILENO 2 /* standard error value, stdout */ 46 47 /* fnmatch function */ 48 #define FNM_PATHNAME 0x01 /* match pathnames, not filenames */ 49 #ifndef _POSIX_SOURCE 50 #define FNM_QUOTE 0x02 /* escape special chars with \ */ 51 #endif 52 53 #ifndef NULL 54 #define NULL 0 /* null pointer constant */ 55 #endif 56 57 /* configurable pathname variables */ 58 #define _PC_LINK_MAX 1 59 #define _PC_MAX_CANON 2 60 #define _PC_MAX_INPUT 3 61 #define _PC_NAME_MAX 4 62 #define _PC_PATH_MAX 5 63 #define _PC_PIPE_BUF 6 64 #define _PC_CHOWN_RESTRICTED 7 65 #define _PC_NO_TRUNC 8 66 #define _PC_VDISABLE 9 67 68 /* configurable system variables */ 69 #define _SC_ARG_MAX 1 70 #define _SC_CHILD_MAX 2 71 #define _SC_CLK_TCK 3 72 #define _SC_NGROUPS_MAX 4 73 #define _SC_OPEN_MAX 5 74 #define _SC_JOB_CONTROL 6 75 #define _SC_SAVED_IDS 7 76 #define _SC_VERSION 8 77 78 /* POSIX.1 2.5 specifically requires that unistd.h define size_t */ 79 #include <sys/types.h> 80 81 #ifdef _SIZE_T_ 82 typedef _SIZE_T_ size_t; 83 #undef _SIZE_T_ 84 #endif 85 86 /* ugly, but the only reasonable value for the time being */ 87 typedef int ssize_t; /* what read() returns */ 88 89 #ifndef KERNEL 90 #include <sys/cdefs.h> 91 92 __BEGIN_DECLS 93 void volatile _exit __P((int)); 94 int access __P((const char *, int)); 95 unsigned int alarm __P((unsigned int)); 96 int chdir __P((const char *)); 97 int chown __P((const char *, uid_t, gid_t)); 98 int close __P((int)); 99 char *cuserid __P((const char *)); 100 int dup __P((int)); 101 int dup2 __P((int, int)); 102 int execl __P((const char *, const char *, ...)); 103 int execle __P((const char *, const char *, ...)); 104 int execlp __P((const char *, const char *, ...)); 105 int execv __P((const char *, char * const *)); 106 int execve __P((const char *, char * const *, char * const *)); 107 int execvp __P((const char *, char * const *)); 108 pid_t fork __P((void)); 109 long fpathconf __P((int, int)); /* not yet implemented */ 110 char *getcwd __P((char *, size_t)); 111 gid_t getegid __P((void)); 112 uid_t geteuid __P((void)); 113 gid_t getgid __P((void)); 114 int getgroups __P((int, gid_t *)); 115 char *getlogin __P((void)); 116 pid_t getpgrp __P((void)); 117 pid_t getpid __P((void)); 118 pid_t getppid __P((void)); 119 uid_t getuid __P((void)); 120 int isatty __P((int)); 121 int link __P((const char *, const char *)); 122 off_t lseek __P((int, off_t, int)); 123 long pathconf __P((const char *, int)); /* not yet */ 124 int pause __P((void)); 125 int pipe __P((int *)); 126 ssize_t read __P((int, void *, size_t)); 127 int rmdir __P((const char *)); 128 int setgid __P((gid_t)); 129 int setpgid __P((pid_t, pid_t)); 130 pid_t setsid __P((void)); 131 int setuid __P((uid_t)); 132 unsigned int sleep __P((unsigned int)); 133 long sysconf __P((int)); /* not yet */ 134 pid_t tcgetpgrp __P((int)); 135 pid_t tcsetpgrp __P((int, pid_t)); 136 char *ttyname __P((int)); 137 int unlink __P((const char *)); 138 ssize_t write __P((int, const void *, size_t)); 139 140 #ifndef _POSIX_SOURCE 141 /* a number of BSD-specific declarations will go here */ 142 #endif 143 144 #endif /* KERNEL */ 145 146 __END_DECLS 147 148 #endif /* !_UNISTD_H_ */ 149