xref: /illumos-gate/usr/src/ucbhead/unistd.h (revision 7c478bd9)
1*7c478bd9Sstevel@tonic-gate /*
2*7c478bd9Sstevel@tonic-gate  * CDDL HEADER START
3*7c478bd9Sstevel@tonic-gate  *
4*7c478bd9Sstevel@tonic-gate  * The contents of this file are subject to the terms of the
5*7c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
6*7c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
7*7c478bd9Sstevel@tonic-gate  * with the License.
8*7c478bd9Sstevel@tonic-gate  *
9*7c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10*7c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
11*7c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
12*7c478bd9Sstevel@tonic-gate  * and limitations under the License.
13*7c478bd9Sstevel@tonic-gate  *
14*7c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
15*7c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16*7c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
17*7c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
18*7c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
19*7c478bd9Sstevel@tonic-gate  *
20*7c478bd9Sstevel@tonic-gate  * CDDL HEADER END
21*7c478bd9Sstevel@tonic-gate  */
22*7c478bd9Sstevel@tonic-gate /*
23*7c478bd9Sstevel@tonic-gate  * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
24*7c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
25*7c478bd9Sstevel@tonic-gate  */
26*7c478bd9Sstevel@tonic-gate 
27*7c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
28*7c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
29*7c478bd9Sstevel@tonic-gate 
30*7c478bd9Sstevel@tonic-gate /*
31*7c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
32*7c478bd9Sstevel@tonic-gate  * The Regents of the University of California
33*7c478bd9Sstevel@tonic-gate  * All Rights Reserved
34*7c478bd9Sstevel@tonic-gate  *
35*7c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
36*7c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
37*7c478bd9Sstevel@tonic-gate  * contributors.
38*7c478bd9Sstevel@tonic-gate  */
39*7c478bd9Sstevel@tonic-gate 
40*7c478bd9Sstevel@tonic-gate #ifndef _UNISTD_H
41*7c478bd9Sstevel@tonic-gate #define	_UNISTD_H
42*7c478bd9Sstevel@tonic-gate 
43*7c478bd9Sstevel@tonic-gate #pragma ident	"%Z%%M%	%I%	%E% SMI"
44*7c478bd9Sstevel@tonic-gate 
45*7c478bd9Sstevel@tonic-gate #include <sys/fcntl.h>
46*7c478bd9Sstevel@tonic-gate 
47*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
48*7c478bd9Sstevel@tonic-gate extern "C" {
49*7c478bd9Sstevel@tonic-gate #endif
50*7c478bd9Sstevel@tonic-gate 
51*7c478bd9Sstevel@tonic-gate /* Symbolic constants for the "access" routine: */
52*7c478bd9Sstevel@tonic-gate #define	R_OK	4	/* Test for Read permission */
53*7c478bd9Sstevel@tonic-gate #define	W_OK	2	/* Test for Write permission */
54*7c478bd9Sstevel@tonic-gate #define	X_OK	1	/* Test for eXecute permission */
55*7c478bd9Sstevel@tonic-gate #define	F_OK	0	/* Test for existence of File */
56*7c478bd9Sstevel@tonic-gate 
57*7c478bd9Sstevel@tonic-gate #define	F_ULOCK	0	/* Unlock a previously locked region */
58*7c478bd9Sstevel@tonic-gate #define	F_LOCK	1	/* Lock a region for exclusive use */
59*7c478bd9Sstevel@tonic-gate #define	F_TLOCK	2	/* Test and lock a region for exclusive use */
60*7c478bd9Sstevel@tonic-gate #define	F_TEST	3	/* Test a region for other processes locks */
61*7c478bd9Sstevel@tonic-gate 
62*7c478bd9Sstevel@tonic-gate 
63*7c478bd9Sstevel@tonic-gate /* Symbolic constants for the "lseek" routine: */
64*7c478bd9Sstevel@tonic-gate #define	SEEK_SET	0	/* Set file pointer to "offset" */
65*7c478bd9Sstevel@tonic-gate #define	SEEK_CUR	1	/* Set file pointer to current plus "offset" */
66*7c478bd9Sstevel@tonic-gate #define	SEEK_END	2	/* Set file pointer to EOF plus "offset" */
67*7c478bd9Sstevel@tonic-gate 
68*7c478bd9Sstevel@tonic-gate /* Path names: */
69*7c478bd9Sstevel@tonic-gate #define	GF_PATH	"/etc/group"	/* Path name of the "group" file */
70*7c478bd9Sstevel@tonic-gate #define	PF_PATH	"/etc/passwd"	/* Path name of the "passwd" file */
71*7c478bd9Sstevel@tonic-gate 
72*7c478bd9Sstevel@tonic-gate 
73*7c478bd9Sstevel@tonic-gate /* command names for POSIX sysconf */
74*7c478bd9Sstevel@tonic-gate #define	_SC_ARG_MAX	1
75*7c478bd9Sstevel@tonic-gate #define	_SC_CHILD_MAX	2
76*7c478bd9Sstevel@tonic-gate #define	_SC_CLK_TCK	3
77*7c478bd9Sstevel@tonic-gate #define	_SC_NGROUPS_MAX 4
78*7c478bd9Sstevel@tonic-gate #define	_SC_OPEN_MAX	5
79*7c478bd9Sstevel@tonic-gate #define	_SC_JOB_CONTROL	6
80*7c478bd9Sstevel@tonic-gate #define	_SC_SAVED_IDS	7
81*7c478bd9Sstevel@tonic-gate #define	_SC_VERSION	8
82*7c478bd9Sstevel@tonic-gate #define	_SC_PASS_MAX	9
83*7c478bd9Sstevel@tonic-gate #define	_SC_LOGNAME_MAX	10
84*7c478bd9Sstevel@tonic-gate #define	_SC_PAGESIZE	11
85*7c478bd9Sstevel@tonic-gate #define	_SC_XOPEN_VERSION	12
86*7c478bd9Sstevel@tonic-gate /* 13 reserved for SVr4-ES/MP _SC_NACLS_MAX */
87*7c478bd9Sstevel@tonic-gate /* 14 reserved for SVr4-ES/MP _SC_NPROC_CONF */
88*7c478bd9Sstevel@tonic-gate /* 15 reserved for SVr4-ES/MP _SC_NPROC_ONLN */
89*7c478bd9Sstevel@tonic-gate #define	_SC_STREAM_MAX	16
90*7c478bd9Sstevel@tonic-gate #define	_SC_TZNAME_MAX	17
91*7c478bd9Sstevel@tonic-gate 
92*7c478bd9Sstevel@tonic-gate /* command names for POSIX pathconf */
93*7c478bd9Sstevel@tonic-gate 
94*7c478bd9Sstevel@tonic-gate #define	_PC_LINK_MAX	1
95*7c478bd9Sstevel@tonic-gate #define	_PC_MAX_CANON	2
96*7c478bd9Sstevel@tonic-gate #define	_PC_MAX_INPUT	3
97*7c478bd9Sstevel@tonic-gate #define	_PC_NAME_MAX	4
98*7c478bd9Sstevel@tonic-gate #define	_PC_PATH_MAX	5
99*7c478bd9Sstevel@tonic-gate #define	_PC_PIPE_BUF	6
100*7c478bd9Sstevel@tonic-gate #define	_PC_NO_TRUNC	7
101*7c478bd9Sstevel@tonic-gate #define	_PC_VDISABLE	8
102*7c478bd9Sstevel@tonic-gate #define	_PC_CHOWN_RESTRICTED	9
103*7c478bd9Sstevel@tonic-gate #define	_PC_LAST	9
104*7c478bd9Sstevel@tonic-gate 
105*7c478bd9Sstevel@tonic-gate /*
106*7c478bd9Sstevel@tonic-gate  * compile-time symbolic constants,
107*7c478bd9Sstevel@tonic-gate  * Support does not mean the feature is enabled.
108*7c478bd9Sstevel@tonic-gate  * Use pathconf/sysconf to obtain actual configuration value.
109*7c478bd9Sstevel@tonic-gate  */
110*7c478bd9Sstevel@tonic-gate 
111*7c478bd9Sstevel@tonic-gate #define	_POSIX_JOB_CONTROL	1
112*7c478bd9Sstevel@tonic-gate #define	_POSIX_SAVED_IDS	1
113*7c478bd9Sstevel@tonic-gate 
114*7c478bd9Sstevel@tonic-gate #ifndef _POSIX_VDISABLE
115*7c478bd9Sstevel@tonic-gate #define	_POSIX_VDISABLE		0
116*7c478bd9Sstevel@tonic-gate #endif
117*7c478bd9Sstevel@tonic-gate 
118*7c478bd9Sstevel@tonic-gate #define	STDIN_FILENO	0
119*7c478bd9Sstevel@tonic-gate #define	STDOUT_FILENO	1
120*7c478bd9Sstevel@tonic-gate #define	STDERR_FILENO	2
121*7c478bd9Sstevel@tonic-gate 
122*7c478bd9Sstevel@tonic-gate /* Current version of POSIX */
123*7c478bd9Sstevel@tonic-gate #define	_POSIX_VERSION		199009L
124*7c478bd9Sstevel@tonic-gate 
125*7c478bd9Sstevel@tonic-gate /* large file compilation environment setup */
126*7c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
127*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
128*7c478bd9Sstevel@tonic-gate #pragma	redefine_extname	lseek	lseek64
129*7c478bd9Sstevel@tonic-gate #else
130*7c478bd9Sstevel@tonic-gate #define	lseek			lseek64
131*7c478bd9Sstevel@tonic-gate #endif
132*7c478bd9Sstevel@tonic-gate #endif  /* !_LP64 && _FILE_OFFSET_BITS == 64 */
133*7c478bd9Sstevel@tonic-gate 
134*7c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
135*7c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
136*7c478bd9Sstevel@tonic-gate #pragma	redefine_extname	lseek64	lseek
137*7c478bd9Sstevel@tonic-gate #else
138*7c478bd9Sstevel@tonic-gate #define	lseek64			lseek
139*7c478bd9Sstevel@tonic-gate #endif
140*7c478bd9Sstevel@tonic-gate #endif  /* _LP64 && _LARGEFILE64_SOURCE */
141*7c478bd9Sstevel@tonic-gate 
142*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
143*7c478bd9Sstevel@tonic-gate extern pid_t getpid(void);
144*7c478bd9Sstevel@tonic-gate extern pid_t getppid(void);
145*7c478bd9Sstevel@tonic-gate extern pid_t getpgrp(void);
146*7c478bd9Sstevel@tonic-gate extern uid_t getuid(void);
147*7c478bd9Sstevel@tonic-gate extern int setpgid(pid_t, pid_t);
148*7c478bd9Sstevel@tonic-gate extern int setpgrp(pid_t, pid_t);	/* BSD */
149*7c478bd9Sstevel@tonic-gate 
150*7c478bd9Sstevel@tonic-gate extern int stime(const time_t *);
151*7c478bd9Sstevel@tonic-gate 
152*7c478bd9Sstevel@tonic-gate extern long pathconf(const char *, int);
153*7c478bd9Sstevel@tonic-gate extern long sysconf(int);
154*7c478bd9Sstevel@tonic-gate 
155*7c478bd9Sstevel@tonic-gate extern char *getwd(char *);
156*7c478bd9Sstevel@tonic-gate extern long gethostid(void);
157*7c478bd9Sstevel@tonic-gate 
158*7c478bd9Sstevel@tonic-gate extern ssize_t read(int, void *, size_t);
159*7c478bd9Sstevel@tonic-gate extern ssize_t write(int, const void *, size_t);
160*7c478bd9Sstevel@tonic-gate extern int ioctl(int, int, ...);
161*7c478bd9Sstevel@tonic-gate extern int close(int);
162*7c478bd9Sstevel@tonic-gate extern off_t lseek(int, off_t, int);
163*7c478bd9Sstevel@tonic-gate #else
164*7c478bd9Sstevel@tonic-gate extern off_t lseek();
165*7c478bd9Sstevel@tonic-gate #endif
166*7c478bd9Sstevel@tonic-gate 
167*7c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
168*7c478bd9Sstevel@tonic-gate 	!defined(__PRAGMA_REDEFINE_EXTNAME))
169*7c478bd9Sstevel@tonic-gate #if defined(__STDC__)
170*7c478bd9Sstevel@tonic-gate extern off64_t lseek64(int, off64_t, int);
171*7c478bd9Sstevel@tonic-gate #else
172*7c478bd9Sstevel@tonic-gate extern off64_t lseek64();
173*7c478bd9Sstevel@tonic-gate #endif
174*7c478bd9Sstevel@tonic-gate #endif  /* _LARGEFILE64_SOURCE... */
175*7c478bd9Sstevel@tonic-gate 
176*7c478bd9Sstevel@tonic-gate #ifdef __cplusplus
177*7c478bd9Sstevel@tonic-gate }
178*7c478bd9Sstevel@tonic-gate #endif
179*7c478bd9Sstevel@tonic-gate 
180*7c478bd9Sstevel@tonic-gate #endif	/* _UNISTD_H */
181