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