| 1 | /*	$OpenBSD: unistd.h,v 1.31 2015/07/20 00:56:10 guenther Exp $	*/ |
| 2 | /*	$NetBSD: unistd.h,v 1.10 1994/06/29 06:46:06 cgd Exp $	*/ |
| 3 | |
| 4 | /* |
| 5 | * Copyright (c) 1989, 1993 |
| 6 | *	The Regents of the University of California. 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. Neither the name of the University nor the names of its contributors |
| 17 | * may be used to endorse or promote products derived from this software |
| 18 | * without specific prior written permission. |
| 19 | * |
| 20 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 26 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 27 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 28 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 29 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 30 | * SUCH DAMAGE. |
| 31 | * |
| 32 | *	@(#)unistd.h	8.2 (Berkeley) 1/7/94 |
| 33 | */ |
| 34 | |
| 35 | #ifndef _SYS_UNISTD_H_ |
| 36 | #define	_SYS_UNISTD_H_ |
| 37 | |
| 38 | #include <sys/cdefs.h> |
| 39 | |
| 40 | #define	_POSIX_VDISABLE		(0377) |
| 41 | #define	_POSIX_ASYNC_IO		(-1) |
| 42 | #define	_POSIX_PRIO_IO		(-1) |
| 43 | #define	_POSIX_SYNC_IO		(-1) |
| 44 | |
| 45 | /* Define the POSIX.1 version we target for compliance. */ |
| 46 | #define	_POSIX_VERSION		200809L |
| 47 | |
| 48 | /* access function */ |
| 49 | #define	F_OK		0	/* test for existence of file */ |
| 50 | #define	X_OK		0x01	/* test for execute or search permission */ |
| 51 | #define	W_OK		0x02	/* test for write permission */ |
| 52 | #define	R_OK		0x04	/* test for read permission */ |
| 53 | |
| 54 | /* whence values for lseek(2) */ |
| 55 | #define	SEEK_SET	0	/* set file offset to offset */ |
| 56 | #define	SEEK_CUR	1	/* set file offset to current plus offset */ |
| 57 | #define	SEEK_END	2	/* set file offset to EOF plus offset */ |
| 58 | |
| 59 | #if __BSD_VISIBLE |
| 60 | /* old BSD whence values for lseek(2); renamed by POSIX 1003.1 */ |
| 61 | #define	L_SET		SEEK_SET |
| 62 | #define	L_INCR		SEEK_CUR |
| 63 | #define	L_XTND		SEEK_END |
| 64 | |
| 65 | /* the parameters argument passed to the __tfork() syscall */ |
| 66 | struct __tfork { |
| 67 | 	void	*tf_tcb; |
| 68 | 	pid_t	*tf_tid; |
| 69 | 	void	*tf_stack; |
| 70 | }; |
| 71 | |
| 72 | /* the parameters argument for the kbind() syscall */ |
| 73 | struct __kbind { |
| 74 | 	void	*kb_addr; |
| 75 | 	size_t	kb_size; |
| 76 | }; |
| 77 | #define	KBIND_BLOCK_MAX	2	/* powerpc, sparc, and sparc64 need 2 blocks */ |
| 78 | #define	KBIND_DATA_MAX	24	/* sparc64 needs 6, four-byte words */ |
| 79 | #endif |
| 80 | |
| 81 | /* the pathconf(2) variable values are part of the ABI */ |
| 82 | |
| 83 | /* configurable pathname variables */ |
| 84 | #define	_PC_LINK_MAX			 1 |
| 85 | #define	_PC_MAX_CANON			 2 |
| 86 | #define	_PC_MAX_INPUT			 3 |
| 87 | #define	_PC_NAME_MAX			 4 |
| 88 | #define	_PC_PATH_MAX			 5 |
| 89 | #define	_PC_PIPE_BUF			 6 |
| 90 | #define	_PC_CHOWN_RESTRICTED		 7 |
| 91 | #define	_PC_NO_TRUNC			 8 |
| 92 | #define	_PC_VDISABLE			 9 |
| 93 | #define	_PC_2_SYMLINKS			10 |
| 94 | #define	_PC_ALLOC_SIZE_MIN		11 |
| 95 | #define	_PC_ASYNC_IO			12 |
| 96 | #define	_PC_FILESIZEBITS		13 |
| 97 | #define	_PC_PRIO_IO			14 |
| 98 | #define	_PC_REC_INCR_XFER_SIZE		15 |
| 99 | #define	_PC_REC_MAX_XFER_SIZE		16 |
| 100 | #define	_PC_REC_MIN_XFER_SIZE		17 |
| 101 | #define	_PC_REC_XFER_ALIGN		18 |
| 102 | #define	_PC_SYMLINK_MAX			19 |
| 103 | #define	_PC_SYNC_IO			20 |
| 104 | #define	_PC_TIMESTAMP_RESOLUTION	21 |
| 105 | |
| 106 | #endif /* !_SYS_UNISTD_H_ */ |