1 /* 2 * Copyright (c) 1989, 1993 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.2 (Berkeley) 1/7/94 34 * $FreeBSD: src/sys/sys/unistd.h,v 1.22.2.2 2000/08/22 01:46:30 jhb Exp $ 35 * $DragonFly: src/sys/sys/unistd.h,v 1.5 2005/12/03 02:19:52 joerg Exp $ 36 */ 37 38 #ifndef _SYS_UNISTD_H_ 39 #define _SYS_UNISTD_H_ 40 41 #include <sys/_posix.h> 42 43 /* compile-time symbolic constants */ 44 #define _POSIX_JOB_CONTROL /* implementation supports job control */ 45 46 /* 47 * Although we have saved user/group IDs, we do not use them in setuid 48 * as described in POSIX 1003.1, because the feature does not work for 49 * root. We use the saved IDs in seteuid/setegid, which are not currently 50 * part of the POSIX 1003.1 specification. 51 */ 52 #ifdef _NOT_AVAILABLE 53 #define _POSIX_SAVED_IDS /* saved set-user-ID and set-group-ID */ 54 #endif 55 56 #define _POSIX2_VERSION 199212L 57 58 /* execution-time symbolic constants */ 59 /* chown requires appropriate privileges */ 60 #define _POSIX_CHOWN_RESTRICTED 1 61 /* too-long path components generate errors */ 62 #define _POSIX_NO_TRUNC 1 63 /* may disable terminal special characters */ 64 #define _POSIX_VDISABLE 0xff 65 66 /* 67 * Threads features: 68 * 69 * Note that those commented out are not currently supported by the 70 * implementation. 71 */ 72 #define _POSIX_THREADS 200112L 73 #define _POSIX_THREAD_ATTR_STACKADDR 200112L 74 #define _POSIX_THREAD_ATTR_STACKSIZE 200112L 75 #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L 76 #define _POSIX_THREAD_PRIO_INHERIT 200112L 77 #define _POSIX_THREAD_PRIO_PROTECT 200112L 78 /* #define _POSIX_THREAD_PROCESS_SHARED */ 79 /* 80 * 1003.1c-1995 says on page 38 (2.9.3, paragraph 3) that if _POSIX_THREADS is 81 * defined, then _POSIX_THREAD_SAFE_FUNCTIONS must also be defined. (This is 82 * likely a typo (reversed dependency), in which case we would be compliant if 83 * the typo were officially acknowledged.) However, we do not support all of 84 * the required _r() interfaces, which means we cannot legitimately define 85 * _POSIX_THREAD_SAFE_FUNCTIONS. Therefore, we are non-compliant here in two 86 * ways. 87 */ 88 /* #define _POSIX_THREAD_SAFE_FUNCTIONS */ 89 #define _POSIX_SEMAPHORES 200112L 90 91 /* access function */ 92 #define F_OK 0 /* test for existence of file */ 93 #define X_OK 0x01 /* test for execute or search permission */ 94 #define W_OK 0x02 /* test for write permission */ 95 #define R_OK 0x04 /* test for read permission */ 96 97 /* whence values for lseek(2) */ 98 #define SEEK_SET 0 /* set file offset to offset */ 99 #define SEEK_CUR 1 /* set file offset to current plus offset */ 100 #define SEEK_END 2 /* set file offset to EOF plus offset */ 101 102 #ifndef _POSIX_SOURCE 103 /* whence values for lseek(2); renamed by POSIX 1003.1 */ 104 #define L_SET SEEK_SET 105 #define L_INCR SEEK_CUR 106 #define L_XTND SEEK_END 107 #endif 108 109 /* configurable pathname variables */ 110 #define _PC_LINK_MAX 1 111 #define _PC_MAX_CANON 2 112 #define _PC_MAX_INPUT 3 113 #define _PC_NAME_MAX 4 114 #define _PC_PATH_MAX 5 115 #define _PC_PIPE_BUF 6 116 #define _PC_CHOWN_RESTRICTED 7 117 #define _PC_NO_TRUNC 8 118 #define _PC_VDISABLE 9 119 120 /* configurable system variables */ 121 #define _SC_ARG_MAX 1 122 #define _SC_CHILD_MAX 2 123 #define _SC_CLK_TCK 3 124 #define _SC_NGROUPS_MAX 4 125 #define _SC_OPEN_MAX 5 126 #define _SC_JOB_CONTROL 6 127 #define _SC_SAVED_IDS 7 128 #define _SC_VERSION 8 129 #define _SC_BC_BASE_MAX 9 130 #define _SC_BC_DIM_MAX 10 131 #define _SC_BC_SCALE_MAX 11 132 #define _SC_BC_STRING_MAX 12 133 #define _SC_COLL_WEIGHTS_MAX 13 134 #define _SC_EXPR_NEST_MAX 14 135 #define _SC_LINE_MAX 15 136 #define _SC_RE_DUP_MAX 16 137 #define _SC_2_VERSION 17 138 #define _SC_2_C_BIND 18 139 #define _SC_2_C_DEV 19 140 #define _SC_2_CHAR_TERM 20 141 #define _SC_2_FORT_DEV 21 142 #define _SC_2_FORT_RUN 22 143 #define _SC_2_LOCALEDEF 23 144 #define _SC_2_SW_DEV 24 145 #define _SC_2_UPE 25 146 #define _SC_STREAM_MAX 26 147 #define _SC_TZNAME_MAX 27 148 #define _SC_IOV_MAX 56 149 150 /* configurable system strings */ 151 #define _CS_PATH 1 152 153 #ifdef _P1003_1B_VISIBLE 154 155 #define _POSIX_PRIORITY_SCHEDULING 200112L 156 157 #if 0 158 /* Not until the dust settles after the header commit 159 */ 160 #define _POSIX_ASYNCHRONOUS_IO 161 #define _POSIX_MEMLOCK 162 #define _POSIX_MEMLOCK_RANGE 163 #endif 164 165 /* ??? #define _POSIX_FSYNC 1 */ 166 #define _POSIX_MAPPED_FILES 200112L 167 #define _POSIX_SHARED_MEMORY_OBJECTS 200112L 168 169 /* POSIX.1B sysconf options */ 170 #define _SC_ASYNCHRONOUS_IO 28 171 #define _SC_MAPPED_FILES 29 172 #define _SC_MEMLOCK 30 173 #define _SC_MEMLOCK_RANGE 31 174 #define _SC_MEMORY_PROTECTION 32 175 #define _SC_MESSAGE_PASSING 33 176 #define _SC_PRIORITIZED_IO 34 177 #define _SC_PRIORITY_SCHEDULING 35 178 #define _SC_REALTIME_SIGNALS 36 179 #define _SC_SEMAPHORES 37 180 #define _SC_FSYNC 38 181 #define _SC_SHARED_MEMORY_OBJECTS 39 182 #define _SC_SYNCHRONIZED_IO 40 183 #define _SC_TIMERS 41 184 #define _SC_AIO_LISTIO_MAX 42 185 #define _SC_AIO_MAX 43 186 #define _SC_AIO_PRIO_DELTA_MAX 44 187 #define _SC_DELAYTIMER_MAX 45 188 #define _SC_MQ_OPEN_MAX 46 189 #define _SC_PAGESIZE 47 190 #define _SC_RTSIG_MAX 48 191 #define _SC_SEM_NSEMS_MAX 49 192 #define _SC_SEM_VALUE_MAX 50 193 #define _SC_SIGQUEUE_MAX 51 194 #define _SC_TIMER_MAX 52 195 196 /* POSIX.1B pathconf and fpathconf options */ 197 #define _PC_ASYNC_IO 53 198 #define _PC_PRIO_IO 54 199 #define _PC_SYNC_IO 55 200 201 #endif /* _P1003_1B_VISIBLE */ 202 203 #ifndef _POSIX_SOURCE 204 /* 205 * rfork() options. 206 * 207 * XXX currently, operations without RFPROC set are not supported. 208 */ 209 #define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */ 210 #define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */ 211 #define RFFDG (1<<2) /* copy fd table */ 212 #define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */ 213 #define RFPROC (1<<4) /* change child (else changes curproc) */ 214 #define RFMEM (1<<5) /* share `address space' */ 215 #define RFNOWAIT (1<<6) /* parent need not wait() on child */ 216 #define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */ 217 #define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */ 218 #define RFCFDG (1<<12) /* zero fd table */ 219 #define RFTHREAD (1<<13) /* enable kernel thread support */ 220 #define RFSIGSHARE (1<<14) /* share signal handlers */ 221 #define RFLINUXTHPN (1<<16) /* do linux clone exit parent notification */ 222 #define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */ 223 #define RFKERNELONLY RFPPWAIT 224 225 226 #endif /* !_POSIX_SOURCE */ 227 228 #endif /* !_SYS_UNISTD_H_ */ 229