1*4a5d661aSToomas Soome /*- 2*4a5d661aSToomas Soome * Copyright (c) 1991, 1993, 1994 3*4a5d661aSToomas Soome * The Regents of the University of California. All rights reserved. 4*4a5d661aSToomas Soome * 5*4a5d661aSToomas Soome * Redistribution and use in source and binary forms, with or without 6*4a5d661aSToomas Soome * modification, are permitted provided that the following conditions 7*4a5d661aSToomas Soome * are met: 8*4a5d661aSToomas Soome * 1. Redistributions of source code must retain the above copyright 9*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer. 10*4a5d661aSToomas Soome * 2. Redistributions in binary form must reproduce the above copyright 11*4a5d661aSToomas Soome * notice, this list of conditions and the following disclaimer in the 12*4a5d661aSToomas Soome * documentation and/or other materials provided with the distribution. 13*4a5d661aSToomas Soome * 3. Neither the name of the University nor the names of its contributors 14*4a5d661aSToomas Soome * may be used to endorse or promote products derived from this software 15*4a5d661aSToomas Soome * without specific prior written permission. 16*4a5d661aSToomas Soome * 17*4a5d661aSToomas Soome * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18*4a5d661aSToomas Soome * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19*4a5d661aSToomas Soome * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20*4a5d661aSToomas Soome * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21*4a5d661aSToomas Soome * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22*4a5d661aSToomas Soome * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23*4a5d661aSToomas Soome * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24*4a5d661aSToomas Soome * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25*4a5d661aSToomas Soome * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26*4a5d661aSToomas Soome * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27*4a5d661aSToomas Soome * SUCH DAMAGE. 28*4a5d661aSToomas Soome * 29*4a5d661aSToomas Soome * @(#)unistd.h 8.12 (Berkeley) 4/27/95 30*4a5d661aSToomas Soome * $FreeBSD$ 31*4a5d661aSToomas Soome */ 32*4a5d661aSToomas Soome 33*4a5d661aSToomas Soome #ifndef _UNISTD_H_ 34*4a5d661aSToomas Soome #define _UNISTD_H_ 35*4a5d661aSToomas Soome 36*4a5d661aSToomas Soome #include <sys/cdefs.h> 37*4a5d661aSToomas Soome #include <sys/types.h> /* XXX adds too much pollution. */ 38*4a5d661aSToomas Soome #include <sys/unistd.h> 39*4a5d661aSToomas Soome #include <sys/_null.h> 40*4a5d661aSToomas Soome #include <sys/_types.h> 41*4a5d661aSToomas Soome 42*4a5d661aSToomas Soome #ifndef _GID_T_DECLARED 43*4a5d661aSToomas Soome typedef __gid_t gid_t; 44*4a5d661aSToomas Soome #define _GID_T_DECLARED 45*4a5d661aSToomas Soome #endif 46*4a5d661aSToomas Soome 47*4a5d661aSToomas Soome #ifndef _OFF_T_DECLARED 48*4a5d661aSToomas Soome typedef __off_t off_t; 49*4a5d661aSToomas Soome #define _OFF_T_DECLARED 50*4a5d661aSToomas Soome #endif 51*4a5d661aSToomas Soome 52*4a5d661aSToomas Soome #ifndef _PID_T_DECLARED 53*4a5d661aSToomas Soome typedef __pid_t pid_t; 54*4a5d661aSToomas Soome #define _PID_T_DECLARED 55*4a5d661aSToomas Soome #endif 56*4a5d661aSToomas Soome 57*4a5d661aSToomas Soome #ifndef _SIZE_T_DECLARED 58*4a5d661aSToomas Soome typedef __size_t size_t; 59*4a5d661aSToomas Soome #define _SIZE_T_DECLARED 60*4a5d661aSToomas Soome #endif 61*4a5d661aSToomas Soome 62*4a5d661aSToomas Soome #ifndef _SSIZE_T_DECLARED 63*4a5d661aSToomas Soome typedef __ssize_t ssize_t; 64*4a5d661aSToomas Soome #define _SSIZE_T_DECLARED 65*4a5d661aSToomas Soome #endif 66*4a5d661aSToomas Soome 67*4a5d661aSToomas Soome #ifndef _UID_T_DECLARED 68*4a5d661aSToomas Soome typedef __uid_t uid_t; 69*4a5d661aSToomas Soome #define _UID_T_DECLARED 70*4a5d661aSToomas Soome #endif 71*4a5d661aSToomas Soome 72*4a5d661aSToomas Soome #ifndef _USECONDS_T_DECLARED 73*4a5d661aSToomas Soome typedef __useconds_t useconds_t; 74*4a5d661aSToomas Soome #define _USECONDS_T_DECLARED 75*4a5d661aSToomas Soome #endif 76*4a5d661aSToomas Soome 77*4a5d661aSToomas Soome #define STDIN_FILENO 0 /* standard input file descriptor */ 78*4a5d661aSToomas Soome #define STDOUT_FILENO 1 /* standard output file descriptor */ 79*4a5d661aSToomas Soome #define STDERR_FILENO 2 /* standard error file descriptor */ 80*4a5d661aSToomas Soome 81*4a5d661aSToomas Soome #if __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 82*4a5d661aSToomas Soome #define F_ULOCK 0 /* unlock locked section */ 83*4a5d661aSToomas Soome #define F_LOCK 1 /* lock a section for exclusive use */ 84*4a5d661aSToomas Soome #define F_TLOCK 2 /* test and lock a section for exclusive use */ 85*4a5d661aSToomas Soome #define F_TEST 3 /* test a section for locks by other procs */ 86*4a5d661aSToomas Soome #endif 87*4a5d661aSToomas Soome 88*4a5d661aSToomas Soome /* 89*4a5d661aSToomas Soome * POSIX options and option groups we unconditionally do or don't 90*4a5d661aSToomas Soome * implement. This list includes those options which are exclusively 91*4a5d661aSToomas Soome * implemented (or not) in user mode. Please keep this list in 92*4a5d661aSToomas Soome * alphabetical order. 93*4a5d661aSToomas Soome * 94*4a5d661aSToomas Soome * Anything which is defined as zero below **must** have an 95*4a5d661aSToomas Soome * implementation for the corresponding sysconf() which is able to 96*4a5d661aSToomas Soome * determine conclusively whether or not the feature is supported. 97*4a5d661aSToomas Soome * Anything which is defined as other than -1 below **must** have 98*4a5d661aSToomas Soome * complete headers, types, and function declarations as specified by 99*4a5d661aSToomas Soome * the POSIX standard; however, if the relevant sysconf() function 100*4a5d661aSToomas Soome * returns -1, the functions may be stubbed out. 101*4a5d661aSToomas Soome */ 102*4a5d661aSToomas Soome #define _POSIX_BARRIERS 200112L 103*4a5d661aSToomas Soome #define _POSIX_CPUTIME 200112L 104*4a5d661aSToomas Soome #define _POSIX_READER_WRITER_LOCKS 200112L 105*4a5d661aSToomas Soome #define _POSIX_REGEXP 1 106*4a5d661aSToomas Soome #define _POSIX_SHELL 1 107*4a5d661aSToomas Soome #define _POSIX_SPAWN 200112L 108*4a5d661aSToomas Soome #define _POSIX_SPIN_LOCKS 200112L 109*4a5d661aSToomas Soome #define _POSIX_THREAD_ATTR_STACKADDR 200112L 110*4a5d661aSToomas Soome #define _POSIX_THREAD_ATTR_STACKSIZE 200112L 111*4a5d661aSToomas Soome #define _POSIX_THREAD_CPUTIME 200112L 112*4a5d661aSToomas Soome #define _POSIX_THREAD_PRIO_INHERIT 200112L 113*4a5d661aSToomas Soome #define _POSIX_THREAD_PRIO_PROTECT 200112L 114*4a5d661aSToomas Soome #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L 115*4a5d661aSToomas Soome #define _POSIX_THREAD_PROCESS_SHARED -1 116*4a5d661aSToomas Soome #define _POSIX_THREAD_SAFE_FUNCTIONS -1 117*4a5d661aSToomas Soome #define _POSIX_THREAD_SPORADIC_SERVER -1 118*4a5d661aSToomas Soome #define _POSIX_THREADS 200112L 119*4a5d661aSToomas Soome #define _POSIX_TRACE -1 120*4a5d661aSToomas Soome #define _POSIX_TRACE_EVENT_FILTER -1 121*4a5d661aSToomas Soome #define _POSIX_TRACE_INHERIT -1 122*4a5d661aSToomas Soome #define _POSIX_TRACE_LOG -1 123*4a5d661aSToomas Soome #define _POSIX2_C_BIND 200112L /* mandatory */ 124*4a5d661aSToomas Soome #define _POSIX2_C_DEV -1 /* need c99 utility */ 125*4a5d661aSToomas Soome #define _POSIX2_CHAR_TERM 1 126*4a5d661aSToomas Soome #define _POSIX2_FORT_DEV -1 /* need fort77 utility */ 127*4a5d661aSToomas Soome #define _POSIX2_FORT_RUN 200112L 128*4a5d661aSToomas Soome #define _POSIX2_LOCALEDEF -1 129*4a5d661aSToomas Soome #define _POSIX2_PBS -1 130*4a5d661aSToomas Soome #define _POSIX2_PBS_ACCOUNTING -1 131*4a5d661aSToomas Soome #define _POSIX2_PBS_CHECKPOINT -1 132*4a5d661aSToomas Soome #define _POSIX2_PBS_LOCATE -1 133*4a5d661aSToomas Soome #define _POSIX2_PBS_MESSAGE -1 134*4a5d661aSToomas Soome #define _POSIX2_PBS_TRACK -1 135*4a5d661aSToomas Soome #define _POSIX2_SW_DEV -1 /* XXX ??? */ 136*4a5d661aSToomas Soome #define _POSIX2_UPE 200112L 137*4a5d661aSToomas Soome #define _V6_ILP32_OFF32 -1 138*4a5d661aSToomas Soome #define _V6_ILP32_OFFBIG 0 139*4a5d661aSToomas Soome #define _V6_LP64_OFF64 0 140*4a5d661aSToomas Soome #define _V6_LPBIG_OFFBIG -1 141*4a5d661aSToomas Soome 142*4a5d661aSToomas Soome #if __XSI_VISIBLE 143*4a5d661aSToomas Soome #define _XOPEN_CRYPT -1 /* XXX ??? */ 144*4a5d661aSToomas Soome #define _XOPEN_ENH_I18N -1 /* mandatory in XSI */ 145*4a5d661aSToomas Soome #define _XOPEN_LEGACY -1 146*4a5d661aSToomas Soome #define _XOPEN_REALTIME -1 147*4a5d661aSToomas Soome #define _XOPEN_REALTIME_THREADS -1 148*4a5d661aSToomas Soome #define _XOPEN_UNIX -1 149*4a5d661aSToomas Soome #endif 150*4a5d661aSToomas Soome 151*4a5d661aSToomas Soome /* Define the POSIX.2 version we target for compliance. */ 152*4a5d661aSToomas Soome #define _POSIX2_VERSION 199212L 153*4a5d661aSToomas Soome 154*4a5d661aSToomas Soome /* 155*4a5d661aSToomas Soome * POSIX-style system configuration variable accessors (for the 156*4a5d661aSToomas Soome * sysconf function). The kernel does not directly implement the 157*4a5d661aSToomas Soome * sysconf() interface; rather, a C library stub translates references 158*4a5d661aSToomas Soome * to sysconf() into calls to sysctl() using a giant switch statement. 159*4a5d661aSToomas Soome * Those that are marked `user' are implemented entirely in the C 160*4a5d661aSToomas Soome * library and never query the kernel. pathconf() is implemented 161*4a5d661aSToomas Soome * directly by the kernel so those are not defined here. 162*4a5d661aSToomas Soome */ 163*4a5d661aSToomas Soome #define _SC_ARG_MAX 1 164*4a5d661aSToomas Soome #define _SC_CHILD_MAX 2 165*4a5d661aSToomas Soome #define _SC_CLK_TCK 3 166*4a5d661aSToomas Soome #define _SC_NGROUPS_MAX 4 167*4a5d661aSToomas Soome #define _SC_OPEN_MAX 5 168*4a5d661aSToomas Soome #define _SC_JOB_CONTROL 6 169*4a5d661aSToomas Soome #define _SC_SAVED_IDS 7 170*4a5d661aSToomas Soome #define _SC_VERSION 8 171*4a5d661aSToomas Soome #define _SC_BC_BASE_MAX 9 /* user */ 172*4a5d661aSToomas Soome #define _SC_BC_DIM_MAX 10 /* user */ 173*4a5d661aSToomas Soome #define _SC_BC_SCALE_MAX 11 /* user */ 174*4a5d661aSToomas Soome #define _SC_BC_STRING_MAX 12 /* user */ 175*4a5d661aSToomas Soome #define _SC_COLL_WEIGHTS_MAX 13 /* user */ 176*4a5d661aSToomas Soome #define _SC_EXPR_NEST_MAX 14 /* user */ 177*4a5d661aSToomas Soome #define _SC_LINE_MAX 15 /* user */ 178*4a5d661aSToomas Soome #define _SC_RE_DUP_MAX 16 /* user */ 179*4a5d661aSToomas Soome #define _SC_2_VERSION 17 /* user */ 180*4a5d661aSToomas Soome #define _SC_2_C_BIND 18 /* user */ 181*4a5d661aSToomas Soome #define _SC_2_C_DEV 19 /* user */ 182*4a5d661aSToomas Soome #define _SC_2_CHAR_TERM 20 /* user */ 183*4a5d661aSToomas Soome #define _SC_2_FORT_DEV 21 /* user */ 184*4a5d661aSToomas Soome #define _SC_2_FORT_RUN 22 /* user */ 185*4a5d661aSToomas Soome #define _SC_2_LOCALEDEF 23 /* user */ 186*4a5d661aSToomas Soome #define _SC_2_SW_DEV 24 /* user */ 187*4a5d661aSToomas Soome #define _SC_2_UPE 25 /* user */ 188*4a5d661aSToomas Soome #define _SC_STREAM_MAX 26 /* user */ 189*4a5d661aSToomas Soome #define _SC_TZNAME_MAX 27 /* user */ 190*4a5d661aSToomas Soome 191*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 199309 192*4a5d661aSToomas Soome #define _SC_ASYNCHRONOUS_IO 28 193*4a5d661aSToomas Soome #define _SC_MAPPED_FILES 29 194*4a5d661aSToomas Soome #define _SC_MEMLOCK 30 195*4a5d661aSToomas Soome #define _SC_MEMLOCK_RANGE 31 196*4a5d661aSToomas Soome #define _SC_MEMORY_PROTECTION 32 197*4a5d661aSToomas Soome #define _SC_MESSAGE_PASSING 33 198*4a5d661aSToomas Soome #define _SC_PRIORITIZED_IO 34 199*4a5d661aSToomas Soome #define _SC_PRIORITY_SCHEDULING 35 200*4a5d661aSToomas Soome #define _SC_REALTIME_SIGNALS 36 201*4a5d661aSToomas Soome #define _SC_SEMAPHORES 37 202*4a5d661aSToomas Soome #define _SC_FSYNC 38 203*4a5d661aSToomas Soome #define _SC_SHARED_MEMORY_OBJECTS 39 204*4a5d661aSToomas Soome #define _SC_SYNCHRONIZED_IO 40 205*4a5d661aSToomas Soome #define _SC_TIMERS 41 206*4a5d661aSToomas Soome #define _SC_AIO_LISTIO_MAX 42 207*4a5d661aSToomas Soome #define _SC_AIO_MAX 43 208*4a5d661aSToomas Soome #define _SC_AIO_PRIO_DELTA_MAX 44 209*4a5d661aSToomas Soome #define _SC_DELAYTIMER_MAX 45 210*4a5d661aSToomas Soome #define _SC_MQ_OPEN_MAX 46 211*4a5d661aSToomas Soome #define _SC_PAGESIZE 47 212*4a5d661aSToomas Soome #define _SC_RTSIG_MAX 48 213*4a5d661aSToomas Soome #define _SC_SEM_NSEMS_MAX 49 214*4a5d661aSToomas Soome #define _SC_SEM_VALUE_MAX 50 215*4a5d661aSToomas Soome #define _SC_SIGQUEUE_MAX 51 216*4a5d661aSToomas Soome #define _SC_TIMER_MAX 52 217*4a5d661aSToomas Soome #endif 218*4a5d661aSToomas Soome 219*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200112 220*4a5d661aSToomas Soome #define _SC_2_PBS 59 /* user */ 221*4a5d661aSToomas Soome #define _SC_2_PBS_ACCOUNTING 60 /* user */ 222*4a5d661aSToomas Soome #define _SC_2_PBS_CHECKPOINT 61 /* user */ 223*4a5d661aSToomas Soome #define _SC_2_PBS_LOCATE 62 /* user */ 224*4a5d661aSToomas Soome #define _SC_2_PBS_MESSAGE 63 /* user */ 225*4a5d661aSToomas Soome #define _SC_2_PBS_TRACK 64 /* user */ 226*4a5d661aSToomas Soome #define _SC_ADVISORY_INFO 65 227*4a5d661aSToomas Soome #define _SC_BARRIERS 66 /* user */ 228*4a5d661aSToomas Soome #define _SC_CLOCK_SELECTION 67 229*4a5d661aSToomas Soome #define _SC_CPUTIME 68 230*4a5d661aSToomas Soome #define _SC_FILE_LOCKING 69 231*4a5d661aSToomas Soome #define _SC_GETGR_R_SIZE_MAX 70 /* user */ 232*4a5d661aSToomas Soome #define _SC_GETPW_R_SIZE_MAX 71 /* user */ 233*4a5d661aSToomas Soome #define _SC_HOST_NAME_MAX 72 234*4a5d661aSToomas Soome #define _SC_LOGIN_NAME_MAX 73 235*4a5d661aSToomas Soome #define _SC_MONOTONIC_CLOCK 74 236*4a5d661aSToomas Soome #define _SC_MQ_PRIO_MAX 75 237*4a5d661aSToomas Soome #define _SC_READER_WRITER_LOCKS 76 /* user */ 238*4a5d661aSToomas Soome #define _SC_REGEXP 77 /* user */ 239*4a5d661aSToomas Soome #define _SC_SHELL 78 /* user */ 240*4a5d661aSToomas Soome #define _SC_SPAWN 79 /* user */ 241*4a5d661aSToomas Soome #define _SC_SPIN_LOCKS 80 /* user */ 242*4a5d661aSToomas Soome #define _SC_SPORADIC_SERVER 81 243*4a5d661aSToomas Soome #define _SC_THREAD_ATTR_STACKADDR 82 /* user */ 244*4a5d661aSToomas Soome #define _SC_THREAD_ATTR_STACKSIZE 83 /* user */ 245*4a5d661aSToomas Soome #define _SC_THREAD_CPUTIME 84 /* user */ 246*4a5d661aSToomas Soome #define _SC_THREAD_DESTRUCTOR_ITERATIONS 85 /* user */ 247*4a5d661aSToomas Soome #define _SC_THREAD_KEYS_MAX 86 /* user */ 248*4a5d661aSToomas Soome #define _SC_THREAD_PRIO_INHERIT 87 /* user */ 249*4a5d661aSToomas Soome #define _SC_THREAD_PRIO_PROTECT 88 /* user */ 250*4a5d661aSToomas Soome #define _SC_THREAD_PRIORITY_SCHEDULING 89 /* user */ 251*4a5d661aSToomas Soome #define _SC_THREAD_PROCESS_SHARED 90 /* user */ 252*4a5d661aSToomas Soome #define _SC_THREAD_SAFE_FUNCTIONS 91 /* user */ 253*4a5d661aSToomas Soome #define _SC_THREAD_SPORADIC_SERVER 92 /* user */ 254*4a5d661aSToomas Soome #define _SC_THREAD_STACK_MIN 93 /* user */ 255*4a5d661aSToomas Soome #define _SC_THREAD_THREADS_MAX 94 /* user */ 256*4a5d661aSToomas Soome #define _SC_TIMEOUTS 95 /* user */ 257*4a5d661aSToomas Soome #define _SC_THREADS 96 /* user */ 258*4a5d661aSToomas Soome #define _SC_TRACE 97 /* user */ 259*4a5d661aSToomas Soome #define _SC_TRACE_EVENT_FILTER 98 /* user */ 260*4a5d661aSToomas Soome #define _SC_TRACE_INHERIT 99 /* user */ 261*4a5d661aSToomas Soome #define _SC_TRACE_LOG 100 /* user */ 262*4a5d661aSToomas Soome #define _SC_TTY_NAME_MAX 101 /* user */ 263*4a5d661aSToomas Soome #define _SC_TYPED_MEMORY_OBJECTS 102 264*4a5d661aSToomas Soome #define _SC_V6_ILP32_OFF32 103 /* user */ 265*4a5d661aSToomas Soome #define _SC_V6_ILP32_OFFBIG 104 /* user */ 266*4a5d661aSToomas Soome #define _SC_V6_LP64_OFF64 105 /* user */ 267*4a5d661aSToomas Soome #define _SC_V6_LPBIG_OFFBIG 106 /* user */ 268*4a5d661aSToomas Soome #define _SC_IPV6 118 269*4a5d661aSToomas Soome #define _SC_RAW_SOCKETS 119 270*4a5d661aSToomas Soome #define _SC_SYMLOOP_MAX 120 271*4a5d661aSToomas Soome #endif 272*4a5d661aSToomas Soome 273*4a5d661aSToomas Soome #if __XSI_VISIBLE 274*4a5d661aSToomas Soome #define _SC_ATEXIT_MAX 107 /* user */ 275*4a5d661aSToomas Soome #define _SC_IOV_MAX 56 276*4a5d661aSToomas Soome #define _SC_PAGE_SIZE _SC_PAGESIZE 277*4a5d661aSToomas Soome #define _SC_XOPEN_CRYPT 108 /* user */ 278*4a5d661aSToomas Soome #define _SC_XOPEN_ENH_I18N 109 /* user */ 279*4a5d661aSToomas Soome #define _SC_XOPEN_LEGACY 110 /* user */ 280*4a5d661aSToomas Soome #define _SC_XOPEN_REALTIME 111 281*4a5d661aSToomas Soome #define _SC_XOPEN_REALTIME_THREADS 112 282*4a5d661aSToomas Soome #define _SC_XOPEN_SHM 113 283*4a5d661aSToomas Soome #define _SC_XOPEN_STREAMS 114 284*4a5d661aSToomas Soome #define _SC_XOPEN_UNIX 115 285*4a5d661aSToomas Soome #define _SC_XOPEN_VERSION 116 286*4a5d661aSToomas Soome #define _SC_XOPEN_XCU_VERSION 117 /* user */ 287*4a5d661aSToomas Soome #endif 288*4a5d661aSToomas Soome 289*4a5d661aSToomas Soome #if __BSD_VISIBLE 290*4a5d661aSToomas Soome #define _SC_NPROCESSORS_CONF 57 291*4a5d661aSToomas Soome #define _SC_NPROCESSORS_ONLN 58 292*4a5d661aSToomas Soome #define _SC_CPUSET_SIZE 122 293*4a5d661aSToomas Soome #endif 294*4a5d661aSToomas Soome 295*4a5d661aSToomas Soome /* Extensions found in Solaris and Linux. */ 296*4a5d661aSToomas Soome #define _SC_PHYS_PAGES 121 297*4a5d661aSToomas Soome 298*4a5d661aSToomas Soome /* Keys for the confstr(3) function. */ 299*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 199209 300*4a5d661aSToomas Soome #define _CS_PATH 1 /* default value of PATH */ 301*4a5d661aSToomas Soome #endif 302*4a5d661aSToomas Soome 303*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200112 304*4a5d661aSToomas Soome #define _CS_POSIX_V6_ILP32_OFF32_CFLAGS 2 305*4a5d661aSToomas Soome #define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS 3 306*4a5d661aSToomas Soome #define _CS_POSIX_V6_ILP32_OFF32_LIBS 4 307*4a5d661aSToomas Soome #define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS 5 308*4a5d661aSToomas Soome #define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS 6 309*4a5d661aSToomas Soome #define _CS_POSIX_V6_ILP32_OFFBIG_LIBS 7 310*4a5d661aSToomas Soome #define _CS_POSIX_V6_LP64_OFF64_CFLAGS 8 311*4a5d661aSToomas Soome #define _CS_POSIX_V6_LP64_OFF64_LDFLAGS 9 312*4a5d661aSToomas Soome #define _CS_POSIX_V6_LP64_OFF64_LIBS 10 313*4a5d661aSToomas Soome #define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS 11 314*4a5d661aSToomas Soome #define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS 12 315*4a5d661aSToomas Soome #define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS 13 316*4a5d661aSToomas Soome #define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS 14 317*4a5d661aSToomas Soome #endif 318*4a5d661aSToomas Soome 319*4a5d661aSToomas Soome __BEGIN_DECLS 320*4a5d661aSToomas Soome /* 1003.1-1990 */ 321*4a5d661aSToomas Soome void _exit(int) __dead2; 322*4a5d661aSToomas Soome int access(const char *, int); 323*4a5d661aSToomas Soome unsigned int alarm(unsigned int); 324*4a5d661aSToomas Soome int chdir(const char *); 325*4a5d661aSToomas Soome int chown(const char *, uid_t, gid_t); 326*4a5d661aSToomas Soome int close(int); 327*4a5d661aSToomas Soome void closefrom(int); 328*4a5d661aSToomas Soome int dup(int); 329*4a5d661aSToomas Soome int dup2(int, int); 330*4a5d661aSToomas Soome int execl(const char *, const char *, ...) __null_sentinel; 331*4a5d661aSToomas Soome int execle(const char *, const char *, ...); 332*4a5d661aSToomas Soome int execlp(const char *, const char *, ...) __null_sentinel; 333*4a5d661aSToomas Soome int execv(const char *, char * const *); 334*4a5d661aSToomas Soome int execve(const char *, char * const *, char * const *); 335*4a5d661aSToomas Soome int execvp(const char *, char * const *); 336*4a5d661aSToomas Soome pid_t fork(void); 337*4a5d661aSToomas Soome long fpathconf(int, int); 338*4a5d661aSToomas Soome char *getcwd(char *, size_t); 339*4a5d661aSToomas Soome gid_t getegid(void); 340*4a5d661aSToomas Soome uid_t geteuid(void); 341*4a5d661aSToomas Soome gid_t getgid(void); 342*4a5d661aSToomas Soome int getgroups(int, gid_t []); 343*4a5d661aSToomas Soome char *getlogin(void); 344*4a5d661aSToomas Soome pid_t getpgrp(void); 345*4a5d661aSToomas Soome pid_t getpid(void); 346*4a5d661aSToomas Soome pid_t getppid(void); 347*4a5d661aSToomas Soome uid_t getuid(void); 348*4a5d661aSToomas Soome int isatty(int); 349*4a5d661aSToomas Soome int link(const char *, const char *); 350*4a5d661aSToomas Soome #ifndef _LSEEK_DECLARED 351*4a5d661aSToomas Soome #define _LSEEK_DECLARED 352*4a5d661aSToomas Soome off_t lseek(int, off_t, int); 353*4a5d661aSToomas Soome #endif 354*4a5d661aSToomas Soome long pathconf(const char *, int); 355*4a5d661aSToomas Soome int pause(void); 356*4a5d661aSToomas Soome int pipe(int *); 357*4a5d661aSToomas Soome ssize_t read(int, void *, size_t); 358*4a5d661aSToomas Soome int rmdir(const char *); 359*4a5d661aSToomas Soome int setgid(gid_t); 360*4a5d661aSToomas Soome int setpgid(pid_t, pid_t); 361*4a5d661aSToomas Soome pid_t setsid(void); 362*4a5d661aSToomas Soome int setuid(uid_t); 363*4a5d661aSToomas Soome unsigned int sleep(unsigned int); 364*4a5d661aSToomas Soome long sysconf(int); 365*4a5d661aSToomas Soome pid_t tcgetpgrp(int); 366*4a5d661aSToomas Soome int tcsetpgrp(int, pid_t); 367*4a5d661aSToomas Soome char *ttyname(int); 368*4a5d661aSToomas Soome int ttyname_r(int, char *, size_t); 369*4a5d661aSToomas Soome int unlink(const char *); 370*4a5d661aSToomas Soome ssize_t write(int, const void *, size_t); 371*4a5d661aSToomas Soome 372*4a5d661aSToomas Soome /* 1003.2-1992 */ 373*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE 374*4a5d661aSToomas Soome size_t confstr(int, char *, size_t); 375*4a5d661aSToomas Soome #ifndef _GETOPT_DECLARED 376*4a5d661aSToomas Soome #define _GETOPT_DECLARED 377*4a5d661aSToomas Soome int getopt(int, char * const [], const char *); 378*4a5d661aSToomas Soome 379*4a5d661aSToomas Soome extern char *optarg; /* getopt(3) external variables */ 380*4a5d661aSToomas Soome extern int optind, opterr, optopt; 381*4a5d661aSToomas Soome #endif /* _GETOPT_DECLARED */ 382*4a5d661aSToomas Soome #endif 383*4a5d661aSToomas Soome 384*4a5d661aSToomas Soome /* ISO/IEC 9945-1: 1996 */ 385*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 199506 || __XSI_VISIBLE 386*4a5d661aSToomas Soome int fsync(int); 387*4a5d661aSToomas Soome 388*4a5d661aSToomas Soome /* 389*4a5d661aSToomas Soome * ftruncate() was in the POSIX Realtime Extension (it's used for shared 390*4a5d661aSToomas Soome * memory), but truncate() was not. 391*4a5d661aSToomas Soome */ 392*4a5d661aSToomas Soome #ifndef _FTRUNCATE_DECLARED 393*4a5d661aSToomas Soome #define _FTRUNCATE_DECLARED 394*4a5d661aSToomas Soome int ftruncate(int, off_t); 395*4a5d661aSToomas Soome #endif 396*4a5d661aSToomas Soome #endif 397*4a5d661aSToomas Soome 398*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 199506 399*4a5d661aSToomas Soome int getlogin_r(char *, int); 400*4a5d661aSToomas Soome #endif 401*4a5d661aSToomas Soome 402*4a5d661aSToomas Soome /* 1003.1-2001 */ 403*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE 404*4a5d661aSToomas Soome int fchown(int, uid_t, gid_t); 405*4a5d661aSToomas Soome ssize_t readlink(const char * __restrict, char * __restrict, size_t); 406*4a5d661aSToomas Soome #endif 407*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200112 408*4a5d661aSToomas Soome int gethostname(char *, size_t); 409*4a5d661aSToomas Soome int setegid(gid_t); 410*4a5d661aSToomas Soome int seteuid(uid_t); 411*4a5d661aSToomas Soome #endif 412*4a5d661aSToomas Soome 413*4a5d661aSToomas Soome /* 1003.1-2008 */ 414*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE 415*4a5d661aSToomas Soome int getsid(pid_t _pid); 416*4a5d661aSToomas Soome int fchdir(int); 417*4a5d661aSToomas Soome int getpgid(pid_t _pid); 418*4a5d661aSToomas Soome int lchown(const char *, uid_t, gid_t); 419*4a5d661aSToomas Soome ssize_t pread(int, void *, size_t, off_t); 420*4a5d661aSToomas Soome ssize_t pwrite(int, const void *, size_t, off_t); 421*4a5d661aSToomas Soome 422*4a5d661aSToomas Soome /* See comment at ftruncate() above. */ 423*4a5d661aSToomas Soome #ifndef _TRUNCATE_DECLARED 424*4a5d661aSToomas Soome #define _TRUNCATE_DECLARED 425*4a5d661aSToomas Soome int truncate(const char *, off_t); 426*4a5d661aSToomas Soome #endif 427*4a5d661aSToomas Soome #endif /* __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE */ 428*4a5d661aSToomas Soome 429*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200809 430*4a5d661aSToomas Soome int faccessat(int, const char *, int, int); 431*4a5d661aSToomas Soome int fchownat(int, const char *, uid_t, gid_t, int); 432*4a5d661aSToomas Soome int fexecve(int, char *const [], char *const []); 433*4a5d661aSToomas Soome int linkat(int, const char *, int, const char *, int); 434*4a5d661aSToomas Soome ssize_t readlinkat(int, const char * __restrict, char * __restrict, size_t); 435*4a5d661aSToomas Soome int symlinkat(const char *, int, const char *); 436*4a5d661aSToomas Soome int unlinkat(int, const char *, int); 437*4a5d661aSToomas Soome #endif /* __POSIX_VISIBLE >= 200809 */ 438*4a5d661aSToomas Soome 439*4a5d661aSToomas Soome /* 440*4a5d661aSToomas Soome * symlink() was originally in POSIX.1a, which was withdrawn after 441*4a5d661aSToomas Soome * being overtaken by events (1003.1-2001). It was in XPG4.2, and of 442*4a5d661aSToomas Soome * course has been in BSD since 4.2. 443*4a5d661aSToomas Soome */ 444*4a5d661aSToomas Soome #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 402 445*4a5d661aSToomas Soome int symlink(const char * __restrict, const char * __restrict); 446*4a5d661aSToomas Soome #endif 447*4a5d661aSToomas Soome 448*4a5d661aSToomas Soome /* X/Open System Interfaces */ 449*4a5d661aSToomas Soome #if __XSI_VISIBLE 450*4a5d661aSToomas Soome char *crypt(const char *, const char *); 451*4a5d661aSToomas Soome /* char *ctermid(char *); */ /* XXX ??? */ 452*4a5d661aSToomas Soome int encrypt(char *, int); 453*4a5d661aSToomas Soome long gethostid(void); 454*4a5d661aSToomas Soome int lockf(int, int, off_t); 455*4a5d661aSToomas Soome int nice(int); 456*4a5d661aSToomas Soome int setregid(gid_t, gid_t); 457*4a5d661aSToomas Soome int setreuid(uid_t, uid_t); 458*4a5d661aSToomas Soome 459*4a5d661aSToomas Soome #ifndef _SWAB_DECLARED 460*4a5d661aSToomas Soome #define _SWAB_DECLARED 461*4a5d661aSToomas Soome void swab(const void * __restrict, void * __restrict, ssize_t); 462*4a5d661aSToomas Soome #endif /* _SWAB_DECLARED */ 463*4a5d661aSToomas Soome 464*4a5d661aSToomas Soome void sync(void); 465*4a5d661aSToomas Soome 466*4a5d661aSToomas Soome #endif /* __XSI_VISIBLE */ 467*4a5d661aSToomas Soome 468*4a5d661aSToomas Soome #if (__XSI_VISIBLE && __XSI_VISIBLE <= 500) || __BSD_VISIBLE 469*4a5d661aSToomas Soome int brk(const void *); 470*4a5d661aSToomas Soome int chroot(const char *); 471*4a5d661aSToomas Soome int getdtablesize(void); 472*4a5d661aSToomas Soome int getpagesize(void) __pure2; 473*4a5d661aSToomas Soome char *getpass(const char *); 474*4a5d661aSToomas Soome void *sbrk(intptr_t); 475*4a5d661aSToomas Soome #endif 476*4a5d661aSToomas Soome 477*4a5d661aSToomas Soome #if (__XSI_VISIBLE && __XSI_VISIBLE <= 600) || __BSD_VISIBLE 478*4a5d661aSToomas Soome char *getwd(char *); /* obsoleted by getcwd() */ 479*4a5d661aSToomas Soome useconds_t 480*4a5d661aSToomas Soome ualarm(useconds_t, useconds_t); 481*4a5d661aSToomas Soome int usleep(useconds_t); 482*4a5d661aSToomas Soome pid_t vfork(void) __returns_twice; 483*4a5d661aSToomas Soome #endif 484*4a5d661aSToomas Soome 485*4a5d661aSToomas Soome #if __BSD_VISIBLE 486*4a5d661aSToomas Soome struct timeval; /* select(2) */ 487*4a5d661aSToomas Soome int acct(const char *); 488*4a5d661aSToomas Soome int async_daemon(void); 489*4a5d661aSToomas Soome int check_utility_compat(const char *); 490*4a5d661aSToomas Soome const char * 491*4a5d661aSToomas Soome crypt_get_format(void); 492*4a5d661aSToomas Soome int crypt_set_format(const char *); 493*4a5d661aSToomas Soome int des_cipher(const char *, char *, long, int); 494*4a5d661aSToomas Soome int des_setkey(const char *key); 495*4a5d661aSToomas Soome int dup3(int, int, int); 496*4a5d661aSToomas Soome int eaccess(const char *, int); 497*4a5d661aSToomas Soome void endusershell(void); 498*4a5d661aSToomas Soome int exect(const char *, char * const *, char * const *); 499*4a5d661aSToomas Soome int execvP(const char *, const char *, char * const *); 500*4a5d661aSToomas Soome int feature_present(const char *); 501*4a5d661aSToomas Soome char *fflagstostr(u_long); 502*4a5d661aSToomas Soome int getdomainname(char *, int); 503*4a5d661aSToomas Soome int getgrouplist(const char *, gid_t, gid_t *, int *); 504*4a5d661aSToomas Soome int getloginclass(char *, size_t); 505*4a5d661aSToomas Soome mode_t getmode(const void *, mode_t); 506*4a5d661aSToomas Soome int getosreldate(void); 507*4a5d661aSToomas Soome int getpeereid(int, uid_t *, gid_t *); 508*4a5d661aSToomas Soome int getresgid(gid_t *, gid_t *, gid_t *); 509*4a5d661aSToomas Soome int getresuid(uid_t *, uid_t *, uid_t *); 510*4a5d661aSToomas Soome char *getusershell(void); 511*4a5d661aSToomas Soome int initgroups(const char *, gid_t); 512*4a5d661aSToomas Soome int iruserok(unsigned long, int, const char *, const char *); 513*4a5d661aSToomas Soome int iruserok_sa(const void *, int, int, const char *, const char *); 514*4a5d661aSToomas Soome int issetugid(void); 515*4a5d661aSToomas Soome void __FreeBSD_libc_enter_restricted_mode(void); 516*4a5d661aSToomas Soome long lpathconf(const char *, int); 517*4a5d661aSToomas Soome #ifndef _MKDTEMP_DECLARED 518*4a5d661aSToomas Soome char *mkdtemp(char *); 519*4a5d661aSToomas Soome #define _MKDTEMP_DECLARED 520*4a5d661aSToomas Soome #endif 521*4a5d661aSToomas Soome #ifndef _MKNOD_DECLARED 522*4a5d661aSToomas Soome int mknod(const char *, mode_t, dev_t); 523*4a5d661aSToomas Soome #define _MKNOD_DECLARED 524*4a5d661aSToomas Soome #endif 525*4a5d661aSToomas Soome #ifndef _MKSTEMP_DECLARED 526*4a5d661aSToomas Soome int mkstemp(char *); 527*4a5d661aSToomas Soome #define _MKSTEMP_DECLARED 528*4a5d661aSToomas Soome #endif 529*4a5d661aSToomas Soome int mkstemps(char *, int); 530*4a5d661aSToomas Soome #ifndef _MKTEMP_DECLARED 531*4a5d661aSToomas Soome char *mktemp(char *); 532*4a5d661aSToomas Soome #define _MKTEMP_DECLARED 533*4a5d661aSToomas Soome #endif 534*4a5d661aSToomas Soome int nfssvc(int, void *); 535*4a5d661aSToomas Soome int nlm_syscall(int, int, int, char **); 536*4a5d661aSToomas Soome int pipe2(int *, int); 537*4a5d661aSToomas Soome int profil(char *, size_t, vm_offset_t, int); 538*4a5d661aSToomas Soome int rcmd(char **, int, const char *, const char *, const char *, int *); 539*4a5d661aSToomas Soome int rcmd_af(char **, int, const char *, 540*4a5d661aSToomas Soome const char *, const char *, int *, int); 541*4a5d661aSToomas Soome int rcmdsh(char **, int, const char *, 542*4a5d661aSToomas Soome const char *, const char *, const char *); 543*4a5d661aSToomas Soome char *re_comp(const char *); 544*4a5d661aSToomas Soome int re_exec(const char *); 545*4a5d661aSToomas Soome int reboot(int); 546*4a5d661aSToomas Soome int revoke(const char *); 547*4a5d661aSToomas Soome pid_t rfork(int); 548*4a5d661aSToomas Soome pid_t rfork_thread(int, void *, int (*)(void *), void *); 549*4a5d661aSToomas Soome int rresvport(int *); 550*4a5d661aSToomas Soome int rresvport_af(int *, int); 551*4a5d661aSToomas Soome int ruserok(const char *, int, const char *, const char *); 552*4a5d661aSToomas Soome #if __BSD_VISIBLE 553*4a5d661aSToomas Soome #ifndef _SELECT_DECLARED 554*4a5d661aSToomas Soome #define _SELECT_DECLARED 555*4a5d661aSToomas Soome int select(int, fd_set *, fd_set *, fd_set *, struct timeval *); 556*4a5d661aSToomas Soome #endif 557*4a5d661aSToomas Soome #endif 558*4a5d661aSToomas Soome int setdomainname(const char *, int); 559*4a5d661aSToomas Soome int setgroups(int, const gid_t *); 560*4a5d661aSToomas Soome void sethostid(long); 561*4a5d661aSToomas Soome int sethostname(const char *, int); 562*4a5d661aSToomas Soome #ifndef _SETKEY_DECLARED 563*4a5d661aSToomas Soome int setkey(const char *); 564*4a5d661aSToomas Soome #define _SETKEY_DECLARED 565*4a5d661aSToomas Soome #endif 566*4a5d661aSToomas Soome int setlogin(const char *); 567*4a5d661aSToomas Soome int setloginclass(const char *); 568*4a5d661aSToomas Soome void *setmode(const char *); 569*4a5d661aSToomas Soome int setpgrp(pid_t, pid_t); /* obsoleted by setpgid() */ 570*4a5d661aSToomas Soome void setproctitle(const char *_fmt, ...) __printf0like(1, 2); 571*4a5d661aSToomas Soome int setresgid(gid_t, gid_t, gid_t); 572*4a5d661aSToomas Soome int setresuid(uid_t, uid_t, uid_t); 573*4a5d661aSToomas Soome int setrgid(gid_t); 574*4a5d661aSToomas Soome int setruid(uid_t); 575*4a5d661aSToomas Soome void setusershell(void); 576*4a5d661aSToomas Soome int strtofflags(char **, u_long *, u_long *); 577*4a5d661aSToomas Soome int swapon(const char *); 578*4a5d661aSToomas Soome int swapoff(const char *); 579*4a5d661aSToomas Soome int syscall(int, ...); 580*4a5d661aSToomas Soome off_t __syscall(quad_t, ...); 581*4a5d661aSToomas Soome int undelete(const char *); 582*4a5d661aSToomas Soome int unwhiteout(const char *); 583*4a5d661aSToomas Soome void *valloc(size_t); /* obsoleted by malloc() */ 584*4a5d661aSToomas Soome 585*4a5d661aSToomas Soome #ifndef _OPTRESET_DECLARED 586*4a5d661aSToomas Soome #define _OPTRESET_DECLARED 587*4a5d661aSToomas Soome extern int optreset; /* getopt(3) external variable */ 588*4a5d661aSToomas Soome #endif 589*4a5d661aSToomas Soome #endif /* __BSD_VISIBLE */ 590*4a5d661aSToomas Soome __END_DECLS 591*4a5d661aSToomas Soome 592*4a5d661aSToomas Soome #endif /* !_UNISTD_H_ */ 593