1139825Simp/*- 21541Srgrimes * Copyright (c) 1989, 1993 31541Srgrimes * The Regents of the University of California. All rights reserved. 41541Srgrimes * 51541Srgrimes * Redistribution and use in source and binary forms, with or without 61541Srgrimes * modification, are permitted provided that the following conditions 71541Srgrimes * are met: 81541Srgrimes * 1. Redistributions of source code must retain the above copyright 91541Srgrimes * notice, this list of conditions and the following disclaimer. 101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright 111541Srgrimes * notice, this list of conditions and the following disclaimer in the 121541Srgrimes * documentation and/or other materials provided with the distribution. 131541Srgrimes * 4. Neither the name of the University nor the names of its contributors 141541Srgrimes * may be used to endorse or promote products derived from this software 151541Srgrimes * without specific prior written permission. 161541Srgrimes * 171541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 201541Srgrimes * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 271541Srgrimes * SUCH DAMAGE. 281541Srgrimes * 291541Srgrimes * @(#)unistd.h 8.2 (Berkeley) 1/7/94 3050477Speter * $FreeBSD: releng/10.3/sys/sys/unistd.h 239347 2012-08-17 02:26:31Z davidxu $ 311541Srgrimes */ 321541Srgrimes 331541Srgrimes#ifndef _SYS_UNISTD_H_ 341541Srgrimes#define _SYS_UNISTD_H_ 351541Srgrimes 36103731Swollman#include <sys/cdefs.h> 3734319Sdufault 38103731Swollman/* 39103731Swollman * POSIX options and option groups we unconditionally do or don't 40103731Swollman * implement. Those options which are implemented (or not) entirely 41103731Swollman * in user mode are defined in <unistd.h>. Please keep this list in 42103731Swollman * alphabetical order. 43103731Swollman * 44103731Swollman * Anything which is defined as zero below **must** have an 45103731Swollman * implementation for the corresponding sysconf() which is able to 46103731Swollman * determine conclusively whether or not the feature is supported. 47103731Swollman * Anything which is defined as other than -1 below **must** have 48103731Swollman * complete headers, types, and function declarations as specified by 49103731Swollman * the POSIX standard; however, if the relevant sysconf() function 50103731Swollman * returns -1, the functions may be stubbed out. 51103731Swollman */ 52227341Sjhb#define _POSIX_ADVISORY_INFO 200112L 53103731Swollman#define _POSIX_ASYNCHRONOUS_IO 0 54103731Swollman#define _POSIX_CHOWN_RESTRICTED 1 55232776Skib#define _POSIX_CLOCK_SELECTION (-1) 56239347Sdavidxu#define _POSIX_CPUTIME 200112L 57103731Swollman#define _POSIX_FSYNC 200112L 58106055Swollman#define _POSIX_IPV6 0 59103731Swollman#define _POSIX_JOB_CONTROL 1 60103731Swollman#define _POSIX_MAPPED_FILES 200112L 61232776Skib#define _POSIX_MEMLOCK (-1) 62103731Swollman#define _POSIX_MEMLOCK_RANGE 200112L 63103731Swollman#define _POSIX_MEMORY_PROTECTION 200112L 64153006Sdavidxu#define _POSIX_MESSAGE_PASSING 200112L 65151659Swollman#define _POSIX_MONOTONIC_CLOCK 200112L 66103731Swollman#define _POSIX_NO_TRUNC 1 67232776Skib#define _POSIX_PRIORITIZED_IO (-1) 68103731Swollman#define _POSIX_PRIORITY_SCHEDULING 200112L 69103731Swollman#define _POSIX_RAW_SOCKETS 200112L 70151578Sdavidxu#define _POSIX_REALTIME_SIGNALS 200112L 71212852Stijl#define _POSIX_SEMAPHORES 200112L 72103731Swollman#define _POSIX_SHARED_MEMORY_OBJECTS 200112L 73232776Skib#define _POSIX_SPORADIC_SERVER (-1) 74232776Skib#define _POSIX_SYNCHRONIZED_IO (-1) 75153004Sdavidxu#define _POSIX_TIMEOUTS 200112L 76151872Sdavidxu#define _POSIX_TIMERS 200112L 77232776Skib#define _POSIX_TYPED_MEMORY_OBJECTS (-1) 78103731Swollman#define _POSIX_VDISABLE 0xff 791541Srgrimes 80103731Swollman#if __XSI_VISIBLE 81103731Swollman#define _XOPEN_SHM 1 82232776Skib#define _XOPEN_STREAMS (-1) 83103731Swollman#endif 84103731Swollman 851541Srgrimes/* 8620640Sbde * Although we have saved user/group IDs, we do not use them in setuid 8720640Sbde * as described in POSIX 1003.1, because the feature does not work for 8820640Sbde * root. We use the saved IDs in seteuid/setegid, which are not currently 89103731Swollman * part of the POSIX 1003.1 specification. XXX revisit for 1003.1-2001 90103731Swollman * as this is now mandatory. 911541Srgrimes */ 9220640Sbde#ifdef _NOT_AVAILABLE 93103731Swollman#define _POSIX_SAVED_IDS 1 /* saved set-user-ID and set-group-ID */ 9420640Sbde#endif 951541Srgrimes 96105045Smike/* Define the POSIX.1 version we target for compliance. */ 97105045Smike#define _POSIX_VERSION 200112L 98105045Smike 991541Srgrimes/* access function */ 1001541Srgrimes#define F_OK 0 /* test for existence of file */ 1011541Srgrimes#define X_OK 0x01 /* test for execute or search permission */ 1021541Srgrimes#define W_OK 0x02 /* test for write permission */ 1031541Srgrimes#define R_OK 0x04 /* test for read permission */ 1041541Srgrimes 1051541Srgrimes/* whence values for lseek(2) */ 106105789Sphk#ifndef SEEK_SET 1071541Srgrimes#define SEEK_SET 0 /* set file offset to offset */ 1081541Srgrimes#define SEEK_CUR 1 /* set file offset to current plus offset */ 1091541Srgrimes#define SEEK_END 2 /* set file offset to EOF plus offset */ 110168469Spjd#endif 111168471Spjd#if __BSD_VISIBLE 112168397Spjd#define SEEK_DATA 3 /* set file offset to next data past offset */ 113168397Spjd#define SEEK_HOLE 4 /* set file offset to next hole past offset */ 114105789Sphk#endif 1151541Srgrimes 1161541Srgrimes#ifndef _POSIX_SOURCE 1171541Srgrimes/* whence values for lseek(2); renamed by POSIX 1003.1 */ 1181541Srgrimes#define L_SET SEEK_SET 1191541Srgrimes#define L_INCR SEEK_CUR 1201541Srgrimes#define L_XTND SEEK_END 1211541Srgrimes#endif 1221541Srgrimes 1231541Srgrimes/* configurable pathname variables */ 1241541Srgrimes#define _PC_LINK_MAX 1 1251541Srgrimes#define _PC_MAX_CANON 2 1261541Srgrimes#define _PC_MAX_INPUT 3 1271541Srgrimes#define _PC_NAME_MAX 4 1281541Srgrimes#define _PC_PATH_MAX 5 1291541Srgrimes#define _PC_PIPE_BUF 6 1301541Srgrimes#define _PC_CHOWN_RESTRICTED 7 1311541Srgrimes#define _PC_NO_TRUNC 8 1321541Srgrimes#define _PC_VDISABLE 9 1331541Srgrimes 134103731Swollman#if __POSIX_VISIBLE >= 199309 135103768Sbde#define _PC_ASYNC_IO 53 136103768Sbde#define _PC_PRIO_IO 54 137103768Sbde#define _PC_SYNC_IO 55 138103731Swollman#endif 13934030Sdufault 140103731Swollman#if __POSIX_VISIBLE >= 200112 141103731Swollman#define _PC_ALLOC_SIZE_MIN 10 142103731Swollman#define _PC_FILESIZEBITS 12 143103731Swollman#define _PC_REC_INCR_XFER_SIZE 14 144103731Swollman#define _PC_REC_MAX_XFER_SIZE 15 145103731Swollman#define _PC_REC_MIN_XFER_SIZE 16 146103731Swollman#define _PC_REC_XFER_ALIGN 17 147106055Swollman#define _PC_SYMLINK_MAX 18 148103731Swollman#endif 14934030Sdufault 150103731Swollman#if __BSD_VISIBLE 151105572Srwatson#define _PC_ACL_EXTENDED 59 152105572Srwatson#define _PC_ACL_PATH_MAX 60 153105572Srwatson#define _PC_CAP_PRESENT 61 154105572Srwatson#define _PC_INF_PRESENT 62 155105572Srwatson#define _PC_MAC_PRESENT 63 156194955Strasz#define _PC_ACL_NFS4 64 157103731Swollman#endif 158101071Srwatson 159168397Spjd/* From OpenSolaris, used by SEEK_DATA/SEEK_HOLE. */ 160168397Spjd#define _PC_MIN_HOLE_SIZE 21 161168397Spjd 162103731Swollman#if __BSD_VISIBLE 16314222Speter/* 16414222Speter * rfork() options. 16514222Speter * 16665557Sjasone * XXX currently, some operations without RFPROC set are not supported. 16714222Speter */ 168103768Sbde#define RFNAMEG (1<<0) /* UNIMPL new plan9 `name space' */ 169103768Sbde#define RFENVG (1<<1) /* UNIMPL copy plan9 `env space' */ 170103768Sbde#define RFFDG (1<<2) /* copy fd table */ 171103768Sbde#define RFNOTEG (1<<3) /* UNIMPL create new plan9 `note group' */ 172103768Sbde#define RFPROC (1<<4) /* change child (else changes curproc) */ 173103768Sbde#define RFMEM (1<<5) /* share `address space' */ 174103768Sbde#define RFNOWAIT (1<<6) /* give child to init */ 175103768Sbde#define RFCNAMEG (1<<10) /* UNIMPL zero plan9 `name space' */ 176103768Sbde#define RFCENVG (1<<11) /* UNIMPL zero plan9 `env space' */ 177103768Sbde#define RFCFDG (1<<12) /* close all fds, zero fd table */ 178103731Swollman#define RFTHREAD (1<<13) /* enable kernel thread support */ 179103731Swollman#define RFSIGSHARE (1<<14) /* share signal handlers */ 180103768Sbde#define RFLINUXTHPN (1<<16) /* do linux clone exit parent notification */ 181103731Swollman#define RFSTOPPED (1<<17) /* leave child in a stopped state */ 182187945Strhodes#define RFHIGHPID (1<<18) /* use a pid higher than 10 (idleproc) */ 183223966Skib#define RFTSIGZMB (1<<19) /* select signal for exit parent notification */ 184223966Skib#define RFTSIGSHIFT 20 /* selected signal number is in bits 20-27 */ 185223966Skib#define RFTSIGMASK 0xFF 186223966Skib#define RFTSIGNUM(flags) (((flags) >> RFTSIGSHIFT) & RFTSIGMASK) 187223966Skib#define RFTSIGFLAGS(signum) ((signum) << RFTSIGSHIFT) 188224987Sjonathan#define RFPROCDESC (1<<28) /* return a process descriptor */ 189103768Sbde#define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */ 190223966Skib#define RFFLAGS (RFFDG | RFPROC | RFMEM | RFNOWAIT | RFCFDG | \ 191223966Skib RFTHREAD | RFSIGSHARE | RFLINUXTHPN | RFSTOPPED | RFHIGHPID | RFTSIGZMB | \ 192224987Sjonathan RFPROCDESC | RFPPWAIT) 193224987Sjonathan#define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPPWAIT | RFPROCDESC) 19426671Sdyson 195103731Swollman#endif /* __BSD_VISIBLE */ 19614222Speter 1971541Srgrimes#endif /* !_SYS_UNISTD_H_ */ 198