Print this page
Build fixes.
code review feeback, close open comment
Ensured various XPG7 stuff are declared properly in sys/stat.h (and cleanup)
New documentation for wcslen, wcsnlen, wcscasecmp (and friends), wcsdup.
Various other tweaks and markup improvements.
first round of POSIX 2008 stuff
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/head/unistd.h
+++ new/usr/src/head/unistd.h
1 1 /*
2 2 * CDDL HEADER START
3 3 *
4 4 * The contents of this file are subject to the terms of the
5 5 * Common Development and Distribution License (the "License").
6 6 * You may not use this file except in compliance with the License.
7 7 *
8 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 * or http://www.opensolaris.org/os/licensing.
10 10 * See the License for the specific language governing permissions
11 11 * and limitations under the License.
12 12 *
↓ open down ↓ |
12 lines elided |
↑ open up ↑ |
13 13 * When distributing Covered Code, include this CDDL HEADER in each
14 14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 15 * If applicable, add the following below this CDDL HEADER, with the
16 16 * fields enclosed by brackets "[]" replaced with your own identifying
17 17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 18 *
19 19 * CDDL HEADER END
20 20 */
21 21
22 22 /*
23 + * Copyright 2014 Garrett D'Amore <garrett@damore.org>
23 24 * Copyright (c) 2013 Gary Mills
24 25 *
25 26 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
26 27 */
27 28
28 29 /* Copyright (c) 1988 AT&T */
29 30 /* All Rights Reserved */
30 31
31 32 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
32 33
33 34 #ifndef _UNISTD_H
34 35 #define _UNISTD_H
35 36
36 37 #include <sys/feature_tests.h>
37 38
38 39 #include <sys/types.h>
39 40 #include <sys/unistd.h>
40 41
↓ open down ↓ |
8 lines elided |
↑ open up ↑ |
41 42 #ifdef __cplusplus
42 43 extern "C" {
43 44 #endif
44 45
45 46 /* Symbolic constants for the "access" routine: */
46 47 #define R_OK 4 /* Test for Read permission */
47 48 #define W_OK 2 /* Test for Write permission */
48 49 #define X_OK 1 /* Test for eXecute permission */
49 50 #define F_OK 0 /* Test for existence of File */
50 51
51 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
52 +#if defined(_XPG4_2) || !defined(_STRICT_SYMBOLS)
52 53 #define F_ULOCK 0 /* Unlock a previously locked region */
53 54 #define F_LOCK 1 /* Lock a region for exclusive use */
54 55 #define F_TLOCK 2 /* Test and lock a region for exclusive use */
55 56 #define F_TEST 3 /* Test a region for other processes locks */
56 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
57 +#endif
57 58
58 59 /* Symbolic constants for the "lseek" routine: */
59 60
60 61 #ifndef SEEK_SET
61 62 #define SEEK_SET 0 /* Set file pointer to "offset" */
62 63 #endif
63 64
64 65 #ifndef SEEK_CUR
65 66 #define SEEK_CUR 1 /* Set file pointer to current plus "offset" */
66 67 #endif
67 68
68 69 #ifndef SEEK_END
69 70 #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
70 71 #endif
71 72
72 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
73 +#if !defined(_STRICT_SYMBOLS)
73 74 #ifndef SEEK_DATA
74 75 #define SEEK_DATA 3 /* Set file pointer to next data past offset */
75 76 #endif
76 77
77 78 #ifndef SEEK_HOLE
78 79 #define SEEK_HOLE 4 /* Set file pointer to next hole past offset */
79 80 #endif
80 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
81 +#endif /* !defined(_STRICT_SYMBOLS) */
81 82
82 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
83 +#if !defined(_STRICT_SYMBOLS)
83 84 /* Path names: */
84 85 #define GF_PATH "/etc/group" /* Path name of the "group" file */
85 86 #define PF_PATH "/etc/passwd" /* Path name of the "passwd" file */
86 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
87 +#endif
87 88
88 89 /*
89 90 * compile-time symbolic constants,
90 91 * Support does not mean the feature is enabled.
91 92 * Use pathconf/sysconf to obtain actual configuration value.
92 93 */
93 94
94 95 /* Values unchanged in UNIX 03 */
95 96 #define _POSIX_ASYNC_IO 1
96 97 #define _POSIX_JOB_CONTROL 1
97 98 #define _POSIX_SAVED_IDS 1
98 99 #define _POSIX_SYNC_IO 1
99 100
100 101 /*
101 102 * POSIX.1b compile-time symbolic constants.
102 103 */
103 104 #if defined(_XPG6)
104 105 #define _POSIX_ASYNCHRONOUS_IO 200112L
105 106 #define _POSIX_FSYNC 200112L
106 107 #define _POSIX_MAPPED_FILES 200112L
107 108 #define _POSIX_MEMLOCK 200112L
108 109 #define _POSIX_MEMLOCK_RANGE 200112L
109 110 #define _POSIX_MEMORY_PROTECTION 200112L
110 111 #define _POSIX_MESSAGE_PASSING 200112L
111 112 #define _POSIX_PRIORITY_SCHEDULING 200112L
112 113 #define _POSIX_REALTIME_SIGNALS 200112L
113 114 #define _POSIX_SEMAPHORES 200112L
114 115 #define _POSIX_SHARED_MEMORY_OBJECTS 200112L
115 116 #define _POSIX_SYNCHRONIZED_IO 200112L
116 117 #else
117 118 #define _POSIX_ASYNCHRONOUS_IO 1
118 119 #define _POSIX_FSYNC 1
119 120 #define _POSIX_MAPPED_FILES 1
120 121 #define _POSIX_MEMLOCK 1
121 122 #define _POSIX_MEMLOCK_RANGE 1
122 123 #define _POSIX_MEMORY_PROTECTION 1
123 124 #define _POSIX_MESSAGE_PASSING 1
124 125 #define _POSIX_PRIORITY_SCHEDULING 1
125 126 #define _POSIX_REALTIME_SIGNALS 1
126 127 #define _POSIX_SEMAPHORES 1
127 128 #define _POSIX_SHARED_MEMORY_OBJECTS 1
128 129 #define _POSIX_SYNCHRONIZED_IO 1
129 130 #endif
130 131
131 132 /*
132 133 * POSIX.1c compile-time symbolic constants.
133 134 */
134 135 #if defined(_XPG6)
135 136 #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
136 137 #define _POSIX_THREADS 200112L
137 138 #define _POSIX_THREAD_ATTR_STACKADDR 200112L
138 139 #define _POSIX_THREAD_ATTR_STACKSIZE 200112L
139 140 #define _POSIX_THREAD_PROCESS_SHARED 200112L
140 141 #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
141 142 #define _POSIX_TIMERS 200112L
142 143 #else
143 144 #define _POSIX_THREAD_SAFE_FUNCTIONS 1
144 145 #define _POSIX_THREADS 1
145 146 #define _POSIX_THREAD_ATTR_STACKADDR 1
146 147 #define _POSIX_THREAD_ATTR_STACKSIZE 1
147 148 #define _POSIX_THREAD_PROCESS_SHARED 1
148 149 #define _POSIX_THREAD_PRIORITY_SCHEDULING 1
149 150 #define _POSIX_TIMERS 1
150 151 #endif
151 152
152 153 /* New in UNIX 03 */
153 154 #define _POSIX_ADVISORY_INFO 200112L
154 155 #define _POSIX_BARRIERS 200112L
155 156 #define _POSIX_CLOCK_SELECTION 200112L
156 157 #define _POSIX_IPV6 200112L
157 158 #define _POSIX_MONOTONIC_CLOCK 200112L
158 159 #define _POSIX_RAW_SOCKETS 200112L
159 160 #define _POSIX_READER_WRITER_LOCKS 200112L
160 161 #define _POSIX_SPAWN 200112L
161 162 #define _POSIX_SPIN_LOCKS 200112L
162 163 #define _POSIX_TIMEOUTS 200112L
163 164
164 165 /*
165 166 * Support for the POSIX.1 mutex protocol attribute. For realtime applications
166 167 * which need mutexes to support priority inheritance/ceiling.
167 168 */
168 169 #if defined(_XPG6)
169 170 #define _POSIX_THREAD_PRIO_INHERIT 200112L
170 171 #define _POSIX_THREAD_PRIO_PROTECT 200112L
171 172 #else
172 173 #define _POSIX_THREAD_PRIO_INHERIT 1
173 174 #define _POSIX_THREAD_PRIO_PROTECT 1
174 175 #endif
175 176
176 177 #ifndef _POSIX_VDISABLE
177 178 #define _POSIX_VDISABLE 0
178 179 #endif
179 180
180 181 #ifndef NULL
181 182 #if defined(_LP64)
182 183 #define NULL 0L
183 184 #else
184 185 #define NULL 0
185 186 #endif
186 187 #endif
187 188
188 189 #define STDIN_FILENO 0
189 190 #define STDOUT_FILENO 1
190 191 #define STDERR_FILENO 2
191 192
192 193 /*
193 194 * Large File Summit-related announcement macros. The system supports both
194 195 * the additional and transitional Large File Summit interfaces. (The final
195 196 * two macros provide a finer granularity breakdown of _LFS64_LARGEFILE.)
196 197 */
197 198 #define _LFS_LARGEFILE 1
198 199 #define _LFS64_LARGEFILE 1
199 200 #define _LFS64_STDIO 1
200 201 #define _LFS64_ASYNCHRONOUS_IO 1
201 202
202 203 /* large file compilation environment setup */
203 204 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
204 205 #ifdef __PRAGMA_REDEFINE_EXTNAME
205 206 #pragma redefine_extname ftruncate ftruncate64
206 207 #pragma redefine_extname lseek lseek64
207 208 #pragma redefine_extname pread pread64
208 209 #pragma redefine_extname pwrite pwrite64
209 210 #pragma redefine_extname truncate truncate64
210 211 #pragma redefine_extname lockf lockf64
211 212 #pragma redefine_extname tell tell64
212 213 #else /* __PRAGMA_REDEFINE_EXTNAME */
213 214 #define ftruncate ftruncate64
214 215 #define lseek lseek64
215 216 #define pread pread64
216 217 #define pwrite pwrite64
217 218 #define truncate truncate64
218 219 #define lockf lockf64
219 220 #define tell tell64
220 221 #endif /* __PRAGMA_REDEFINE_EXTNAME */
221 222 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
222 223
223 224 /* In the LP64 compilation environment, the APIs are already large file */
224 225 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
225 226 #ifdef __PRAGMA_REDEFINE_EXTNAME
226 227 #pragma redefine_extname ftruncate64 ftruncate
227 228 #pragma redefine_extname lseek64 lseek
228 229 #pragma redefine_extname pread64 pread
229 230 #pragma redefine_extname pwrite64 pwrite
230 231 #pragma redefine_extname truncate64 truncate
231 232 #pragma redefine_extname lockf64 lockf
232 233 #pragma redefine_extname tell64 tell
233 234 #else /* __PRAGMA_REDEFINE_EXTNAME */
↓ open down ↓ |
137 lines elided |
↑ open up ↑ |
234 235 #define ftruncate64 ftruncate
235 236 #define lseek64 lseek
236 237 #define pread64 pread
237 238 #define pwrite64 pwrite
238 239 #define truncate64 truncate
239 240 #define lockf64 lockf
240 241 #define tell64 tell
241 242 #endif /* __PRAGMA_REDEFINE_EXTNAME */
242 243 #endif /* _LP64 && _LARGEFILE64_SOURCE */
243 244
244 -#if defined(__STDC__)
245 -
246 245 extern int access(const char *, int);
247 246 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
248 247 extern int acct(const char *);
249 248 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
250 249 extern unsigned alarm(unsigned);
250 +
251 251 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
252 -#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
253 - defined(__EXTENSIONS__)
252 +#if (!defined(_STRICT_SYMBOLS)) || (defined(_XPG4_2) && !defined(_XPG6))
254 253 extern int brk(void *);
255 -#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
254 +extern void *sbrk(intptr_t);
255 +#endif
256 +
256 257 extern int chdir(const char *);
257 258 extern int chown(const char *, uid_t, gid_t);
259 +
258 260 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
259 -#if !defined(_POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && \
260 - !defined(_XPG6)) || defined(__EXTENSIONS__)
261 +#if (!defined(_STRICT_SYMBOLS)) || (defined(_XOPEN_SOURCE) && !defined(_XPG6))
261 262 extern int chroot(const char *);
262 -#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */
263 +#endif
264 +
263 265 extern int close(int);
266 +
264 267 #if defined(_XPG4) || defined(__EXTENSIONS__)
265 268 extern size_t confstr(int, char *, size_t);
266 269 extern char *crypt(const char *, const char *);
267 -#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
270 +extern void encrypt(char *, int);
271 +#endif
272 +
268 273 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
269 274 defined(__EXTENSIONS__)
270 275 extern char *ctermid(char *);
271 -#endif /* (!defined(_POSIX_C_SOURCE) ... */
276 +#endif
277 +
272 278 #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__)
273 279 extern char *ctermid_r(char *);
274 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */
280 +#endif
281 +
275 282 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
276 283 #if !defined(_XPG6) || defined(__EXTENSIONS__)
277 284 extern char *cuserid(char *);
278 285 #endif
286 +
279 287 extern int dup(int);
280 288 extern int dup2(int, int);
281 289 extern int dup3(int, int, int);
282 -#if defined(_XPG4) || defined(__EXTENSIONS__)
283 -extern void encrypt(char *, int);
284 -#endif /* defined(XPG4) || defined(__EXTENSIONS__) */
285 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
286 -extern void endusershell(void);
287 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
290 +
288 291 extern int execl(const char *, const char *, ...);
289 292 extern int execle(const char *, const char *, ...);
290 293 extern int execlp(const char *, const char *, ...);
291 294 extern int execv(const char *, char *const *);
292 295 extern int execve(const char *, char *const *, char *const *);
293 296 extern int execvp(const char *, char *const *);
294 297 extern void _exit(int)
295 298 __NORETURN;
296 299 /*
297 - * The following fattach prototype is duplicated in <stropts.h>. The
298 - * duplication is necessitated by XPG4.2 which requires the prototype
300 + * The following fattach & fdetach prototypes are duplicated in <stropts.h>.
301 + * The duplication is necessitated by XPG4.2 which requires the prototype
299 302 * be defined in <stropts.h>.
300 303 */
301 304 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
302 305 extern int fattach(int, const char *);
303 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
304 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
305 -extern int fchdir(int);
306 -extern int fchown(int, uid_t, gid_t);
307 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
308 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
309 306 extern int fchroot(int);
310 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
311 -#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
312 - defined(__EXTENSIONS__)
313 -extern int fdatasync(int);
314 -#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
315 -/*
316 - * The following fdetach prototype is duplicated in <stropts.h>. The
317 - * duplication is necessitated by XPG4.2 which requires the prototype
318 - * be defined in <stropts.h>.
319 - */
320 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
321 307 extern int fdetach(const char *);
322 -#endif /* !defined(__XOPEN_OR_POSIX)... */
308 +#endif
309 +
310 +#if !defined(_STRICT_SYMBOLS) || (_POSIX_C_SOURCE > 2)
311 +extern int fdatasync(int);
312 +extern int fsync(int);
313 +#endif
314 +
323 315 extern pid_t fork(void);
324 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
325 -extern pid_t fork1(void);
326 -extern pid_t forkall(void);
327 -#endif /* !defined(__XOPEN_OR_POSIX)... */
328 316 extern long fpathconf(int, int);
329 -#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
330 - defined(__EXTENSIONS__)
331 -extern int fsync(int);
332 -#endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
317 +
333 318 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \
334 319 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
335 320 defined(__EXTENSIONS__)
336 321 extern int ftruncate(int, off_t);
337 -#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
338 -extern char *getcwd(char *, size_t);
339 -#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
340 - defined(__EXTENSIONS__)
341 -extern int getdtablesize(void);
342 322 #endif
323 +
324 +extern char *getcwd(char *, size_t);
343 325 extern gid_t getegid(void);
344 326 extern uid_t geteuid(void);
345 327 extern gid_t getgid(void);
346 328 extern int getgroups(int, gid_t *);
347 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
329 +
330 +#if (!defined(_STRICT_SYMBOLS)) || defined(_XPG4_2)
331 +extern int fchdir(int);
332 +extern int fchown(int, uid_t, gid_t);
348 333 extern long gethostid(void);
349 334 #endif
335 +
350 336 #if defined(_XPG4_2)
351 337 extern int gethostname(char *, size_t);
352 -#elif !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
338 +#elif !defined(_STRICT_SYMBOLS)
353 339 extern int gethostname(char *, int);
354 340 #endif
355 341
356 342 #ifndef __GETLOGIN_DEFINED /* Avoid duplicate in stdlib.h */
357 343 #define __GETLOGIN_DEFINED
358 344 #ifndef __USE_LEGACY_LOGNAME__
359 345 #ifdef __PRAGMA_REDEFINE_EXTNAME
360 346 #pragma redefine_extname getlogin getloginx
361 347 #else /* __PRAGMA_REDEFINE_EXTNAME */
362 348 extern char *getloginx(void);
363 349 #define getlogin getloginx
364 350 #endif /* __PRAGMA_REDEFINE_EXTNAME */
365 351 #endif /* __USE_LEGACY_LOGNAME__ */
366 352 extern char *getlogin(void);
367 353 #endif /* __GETLOGIN_DEFINED */
↓ open down ↓ |
5 lines elided |
↑ open up ↑ |
368 354
369 355 #if defined(_XPG4) || defined(__EXTENSIONS__)
370 356 extern int getopt(int, char *const *, const char *);
371 357 extern char *optarg;
372 358 extern int opterr, optind, optopt;
373 359 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
374 360 #if !defined(_XPG6) || defined(__EXTENSIONS__)
375 361 extern char *getpass(const char *);
376 362 #endif
377 363 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
378 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
364 +
365 +#if (!defined(_STRICT_SYMBOLS)) || (defined(_XPG4_2) && !defined(_XPG6))
366 +extern int getdtablesize(void);
379 367 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
380 -#if !defined(_XPG6) || defined(__EXTENSIONS__)
381 368 extern int getpagesize(void);
382 369 #endif
383 -extern pid_t getpgid(pid_t);
384 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
370 +
385 371 extern pid_t getpid(void);
386 372 extern pid_t getppid(void);
387 373 extern pid_t getpgrp(void);
388 374
389 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
390 -char *gettxt(const char *, const char *);
391 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
392 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
375 +#if !defined(_STRICT_SYMBOLS) || defined(_XPG4_2)
376 +extern pid_t getpgid(pid_t);
393 377 extern pid_t getsid(pid_t);
394 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
378 +extern int lchown(const char *, uid_t, gid_t);
379 +#endif
380 +
395 381 extern uid_t getuid(void);
396 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
397 -extern char *getusershell(void);
398 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
399 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
400 -extern char *getwd(char *);
401 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
382 +extern int isatty(int);
383 +
402 384 /*
403 385 * The following ioctl prototype is duplicated in <stropts.h>. The
404 386 * duplication is necessitated by XPG4.2 which requires the prototype
405 387 * be defined in <stropts.h>.
406 388 */
407 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
389 +#if !defined(_STRICT_SYMBOLS)
408 390 extern int ioctl(int, int, ...);
409 391 extern int isaexec(const char *, char *const *, char *const *);
410 392 extern int issetugid(void);
411 393 #endif
412 -extern int isatty(int);
413 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
414 -extern int lchown(const char *, uid_t, gid_t);
415 -#endif
394 +
395 +
416 396 extern int link(const char *, const char *);
417 397 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
418 398 extern offset_t llseek(int, offset_t, int);
419 399 #endif
420 400 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
421 401 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
422 402 defined(__EXTENSIONS__)
423 403 extern int lockf(int, int, off_t);
424 404 #endif
425 405 extern off_t lseek(int, off_t, int);
426 406 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
427 407 defined(__EXTENSIONS__)
428 408 extern int nice(int);
429 409 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
430 410 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
431 411 extern int mincore(caddr_t, size_t, char *);
432 412 #endif
433 413 extern long pathconf(const char *, int);
434 414 extern int pause(void);
435 415 extern int pipe(int *);
436 416 extern int pipe2(int *, int);
437 417 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \
438 418 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
439 419 defined(__EXTENSIONS__)
440 420 extern ssize_t pread(int, void *, size_t, off_t);
441 421 #endif
442 422 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
443 423 extern void profil(unsigned short *, size_t, unsigned long, unsigned int);
444 424 #endif
445 425 /*
446 426 * pthread_atfork() is also declared in <pthread.h> as per SUSv3. The
447 427 * declarations are identical. A change to either one may also require
448 428 * appropriate namespace updates in order to avoid redeclaration
449 429 * warnings in the case where both prototypes are exposed via inclusion
450 430 * of both <pthread.h> and <unistd.h>.
451 431 */
452 432 #if !defined(__XOPEN_OR_POSIX) || \
453 433 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \
454 434 defined(__EXTENSIONS__)
455 435 extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
456 436 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */
457 437 #if !defined(_LP64) && \
458 438 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__))
459 439 extern int ptrace(int, pid_t, int, int);
460 440 #endif
461 441 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \
462 442 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
463 443 defined(__EXTENSIONS__)
464 444 extern ssize_t pwrite(int, const void *, size_t, off_t);
465 445 #endif
466 446 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
467 447 /* per RFC 3542; This is also defined in netdb.h */
468 448 extern int rcmd_af(char **, unsigned short, const char *, const char *,
469 449 const char *, int *, int);
470 450 #endif
471 451 extern ssize_t read(int, void *, size_t);
472 452 #if !defined(__XOPEN_OR_POSIX) || \
473 453 defined(_XPG4_2) || defined(__EXTENSIONS__)
474 454 extern ssize_t readlink(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD,
475 455 size_t);
476 456 #endif
477 457 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \
478 458 defined(__EXTENSIONS__)
479 459 #if __cplusplus >= 199711L
480 460 namespace std {
481 461 #endif
482 462 extern int rename(const char *, const char *);
483 463 #if __cplusplus >= 199711L
484 464 } /* end of namespace std */
485 465
486 466 using std::rename;
487 467 #endif /* __cplusplus >= 199711L */
488 468 #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */
489 469 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
490 470 extern int resolvepath(const char *, char *, size_t);
↓ open down ↓ |
65 lines elided |
↑ open up ↑ |
491 471 /* per RFC 3542; This is also defined in netdb.h */
492 472 extern int rexec_af(char **, unsigned short, const char *, const char *,
493 473 const char *, int *, int);
494 474 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
495 475 extern int rmdir(const char *);
496 476 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
497 477 /* per RFC 3542; This is also defined in netdb.h */
498 478 extern int rresvport_af(int *, int);
499 479 #endif
500 480
501 -#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
502 - defined(__EXTENSIONS__)
503 -extern void *sbrk(intptr_t);
504 -#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
505 481 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
506 482 extern int setegid(gid_t);
507 483 extern int seteuid(uid_t);
508 484 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
509 485 extern int setgid(gid_t);
510 486 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
511 487 extern int setgroups(int, const gid_t *);
512 488 extern int sethostname(char *, int);
513 489 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
514 490 extern int setpgid(pid_t, pid_t);
515 491 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
516 492 extern pid_t setpgrp(void);
517 493 extern int setregid(gid_t, gid_t);
518 494 extern int setreuid(uid_t, uid_t);
519 495 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
520 496 extern pid_t setsid(void);
521 497 extern int setuid(uid_t);
522 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
523 -extern void setusershell(void);
524 -#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
525 498 extern unsigned sleep(unsigned);
526 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
499 +
500 +#if !defined(_STRICT_SYMBOLS)
501 +extern char *gettxt(const char *, const char *);
502 +extern void endusershell(void);
503 +extern pid_t fork1(void);
504 +extern pid_t forkall(void);
505 +extern char *getusershell(void);
506 +extern void setusershell(void);
527 507 extern int stime(const time_t *);
528 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
508 +#endif
509 +
529 510 #if defined(_XPG4)
530 511 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */
531 512 extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t);
532 513 #endif /* defined(_XPG4) */
514 +
533 515 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
534 516 extern int symlink(const char *, const char *);
535 517 extern void sync(void);
536 518 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
537 519 #if defined(_XPG5) && !defined(_XPG6)
538 520 #ifdef __PRAGMA_REDEFINE_EXTNAME
539 521 #pragma redefine_extname sysconf __sysconf_xpg5
540 522 #else /* __PRAGMA_REDEFINE_EXTNAME */
541 523 #define sysconf __sysconf_xpg5
542 524 #endif /* __PRAGMA_REDEFINE_EXTNAME */
543 525 #endif /* defined(_XPG5) && !defined(_XPG6) */
544 -extern long sysconf(int);
545 -extern pid_t tcgetpgrp(int);
546 -extern int tcsetpgrp(int, pid_t);
526 +
547 527 #if !defined(__XOPEN_OR_POSIX) || \
548 528 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
549 529 defined(__EXTENSIONS__)
550 530 extern off_t tell(int);
551 -#endif /* !defined(__XOPEN_OR_POSIX)... */
531 +#endif
532 +
552 533 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
553 534 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
554 535 defined(__EXTENSIONS__)
555 536 extern int truncate(const char *, off_t);
556 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
537 +#endif
538 +
539 +extern long sysconf(int);
540 +extern pid_t tcgetpgrp(int);
541 +extern int tcsetpgrp(int, pid_t);
557 542 extern char *ttyname(int);
558 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
559 -extern useconds_t ualarm(useconds_t, useconds_t);
560 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
561 543 extern int unlink(const char *);
562 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
544 +extern ssize_t write(int, const void *, size_t);
545 +
546 +#if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS)
547 +extern char *getwd(char *);
548 +extern useconds_t ualarm(useconds_t, useconds_t);
563 549 extern int usleep(useconds_t);
564 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
565 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
566 550 extern pid_t vfork(void) __RETURNS_TWICE;
567 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
568 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
569 -extern void vhangup(void);
570 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
571 -extern ssize_t write(int, const void *, size_t);
572 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
573 -extern void yield(void);
574 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
551 +#pragma unknown_control_flow(vfork)
552 +#endif
575 553
576 -#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
577 - defined(__EXTENSIONS__)
578 - /* || defined(_XPG7) */
554 +#if defined(_XPG7) || defined(_ATFILE_SOURCE) || !defined(_STRICT_SYMBOLS)
579 555 extern int faccessat(int, const char *, int, int);
580 556 extern int fchownat(int, const char *, uid_t, gid_t, int);
581 557 extern int linkat(int, const char *, int, const char *, int);
582 558 extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD,
583 559 char *_RESTRICT_KYWD, size_t);
584 560 extern int renameat(int, const char *, int, const char *);
585 561 extern int symlinkat(const char *, int, const char *);
586 562 extern int unlinkat(int, const char *, int);
587 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */
588 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
563 +#endif
564 +
565 +#if !defined(_STRICT_SYMBOLS)
589 566 extern int get_nprocs(void);
590 567 extern int get_nprocs_conf(void);
591 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
568 +extern void vhangup(void);
569 +extern void yield(void);
570 +#endif
592 571
593 572 /* transitional large file interface versions */
594 573 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
595 574 !defined(__PRAGMA_REDEFINE_EXTNAME))
596 575 extern int ftruncate64(int, off64_t);
597 576 extern off64_t lseek64(int, off64_t, int);
598 577 extern ssize_t pread64(int, void *, size_t, off64_t);
599 578 extern ssize_t pwrite64(int, const void *, size_t, off64_t);
600 579 extern off64_t tell64(int);
601 580 extern int truncate64(const char *, off64_t);
602 581 extern int lockf64(int, int, off64_t);
603 582 #endif /* _LARGEFILE64_SOURCE */
604 583
605 -#else /* __STDC__ */
606 -
607 -extern int access();
608 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
609 -extern int acct();
610 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
611 -extern unsigned alarm();
612 -#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
613 - defined(__EXTENSIONS__)
614 -extern int brk();
615 -#endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
616 -extern int chdir();
617 -extern int chown();
618 -#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
619 - defined(__EXTENSIONS__)
620 -extern int chroot();
621 -#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
622 -extern int close();
623 -#if defined(_XPG4) || defined(__EXTENSIONS__)
624 -extern size_t confstr();
625 -extern char *crypt();
626 -#endif /* defined(XPG4) || defined(__EXTENSIONS__) */
627 -#if !defined(_POSIX_C_SOURCE) || defined(_XPG3) || defined(__EXTENSIONS__)
628 -extern char *ctermid();
629 -#endif /* (!defined(_POSIX_C_SOURCE) || defined(_XPG3)... */
630 -#if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__)
631 -extern char *ctermid_r();
632 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */
633 -#if !defined(_XPG6) || defined(__EXTENSIONS__)
634 -extern char *cuserid();
635 -#endif
636 -extern int dup();
637 -extern int dup2();
638 -extern int dup3();
639 -#if defined(_XPG4) || defined(__EXTENSIONS__)
640 -extern void encrypt();
641 -#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
642 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
643 -extern void endusershell();
644 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
645 -extern int execl();
646 -extern int execle();
647 -extern int execlp();
648 -extern int execv();
649 -extern int execve();
650 -extern int execvp();
651 -extern void _exit();
652 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
653 -extern int fattach();
654 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
655 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
656 -extern int fchdir();
657 -extern int fchown();
658 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
659 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
660 -extern int fchroot();
661 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
662 -#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
663 - defined(__EXTENSIONS__)
664 -extern int fdatasync();
665 -#endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
666 -#if !defined(__XOPEN_OR_POSIX)
667 -extern int fdetach();
668 -#endif /* !defined(__XOPEN_OR_POSIX) */
669 -extern pid_t fork();
670 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
671 -extern pid_t fork1();
672 -extern pid_t forkall();
673 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
674 -extern long fpathconf();
675 -#if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
676 - defined(__EXTENSIONS__)
677 -extern int fsync();
678 -#endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
679 -#if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \
680 - (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
681 - defined(__EXTENSIONS__)
682 -extern int ftruncate();
683 -#endif /* !defined(__XOPEN_OR_POSIX) (_POSIX_C_SOURCE > 2)... */
684 -extern char *getcwd();
685 -#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
686 - defined(__EXTENSIONS__)
687 -extern int getdtablesize();
688 -#endif
689 -extern gid_t getegid();
690 -extern uid_t geteuid();
691 -extern gid_t getgid();
692 -extern int getgroups();
693 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
694 -extern long gethostid();
695 -#endif
696 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
697 -extern int gethostname();
698 -#endif
699 -
700 -#ifndef __GETLOGIN_DEFINED /* Avoid duplicate in stdlib.h */
701 -#define __GETLOGIN_DEFINED
702 -#ifndef __USE_LEGACY_LOGNAME__
703 -#ifdef __PRAGMA_REDEFINE_EXTNAME
704 -#pragma redefine_extname getlogin getloginx
705 -#else /* __PRAGMA_REDEFINE_EXTNAME */
706 -extern char *getloginx();
707 -#define getlogin getloginx
708 -#endif /* __PRAGMA_REDEFINE_EXTNAME */
709 -#endif /* __USE_LEGACY_LOGNAME__ */
710 -extern char *getlogin();
711 -#endif /* __GETLOGIN_DEFINED */
712 -
713 -#if defined(_XPG4) || defined(__EXTENSIONS__)
714 -extern int getopt();
715 -extern char *optarg;
716 -extern int opterr, optind, optopt;
717 -#if !defined(_XPG6) || defined(__EXTENSIONS__)
718 -extern char *getpass();
719 -#endif
720 -#endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
721 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
722 -#if !defined(_XPG6) || defined(__EXTENSIONS__)
723 -extern int getpagesize();
724 -#endif
725 -extern pid_t getpgid();
726 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
727 -extern pid_t getpid();
728 -extern pid_t getppid();
729 -extern pid_t getpgrp();
730 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
731 -char *gettxt();
732 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
733 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
734 -extern pid_t getsid();
735 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
736 -extern uid_t getuid();
737 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
738 -extern char *getusershell();
739 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
740 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
741 -extern char *getwd();
742 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
743 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
744 -extern int ioctl();
745 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
746 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
747 -extern int isaexec();
748 -extern int issetugid();
749 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
750 -extern int isatty();
751 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
752 -extern int lchown();
753 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
754 -extern int link();
755 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
756 -extern offset_t llseek();
757 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
758 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
759 - (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
760 - defined(__EXTENSIONS__)
761 -extern int lockf();
762 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
763 -extern off_t lseek();
764 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
765 -extern int mincore();
766 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
767 -#if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
768 - defined(__EXTENSIONS__)
769 -extern int nice();
770 -#endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
771 -extern long pathconf();
772 -extern int pause();
773 -extern int pipe();
774 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \
775 - (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
776 - defined(__EXTENSIONS__)
777 -extern ssize_t pread();
778 -#endif
779 -#if !defined(_LP64) && \
780 - (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__))
781 -extern void profil();
782 -extern int ptrace();
783 -#endif
784 -#if !defined(__XOPEN_OR_POSIX) || \
785 - ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \
786 - defined(__EXTENSIONS__)
787 -extern int pthread_atfork();
788 -#endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */
789 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG5) || \
790 - (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
791 - defined(__EXTENSIONS__)
792 -extern ssize_t pwrite();
793 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG5) */
794 -extern ssize_t read();
795 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
796 -/* per RFC 3542; This is also defined in netdb.h */
797 -extern int rcmd_af();
798 -#endif
799 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
800 -extern ssize_t readlink();
801 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
802 -#if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \
803 - defined(__EXTENSIONS__)
804 -extern int rename();
805 -#endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */
806 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
807 -extern int resolvepath();
808 -/* per RFC 3542; This is also defined in netdb.h */
809 -extern int rexec_af();
810 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
811 -extern int rmdir();
812 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
813 -/* per RFC 3542; This is also defined in netdb.h */
814 -extern int rresvport_af();
815 -#endif
816 -#if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
817 - defined(__EXTENSIONS__)
818 -extern void *sbrk();
819 -#endif /* !defined(__XOPEN_OR_POSIX)|| (defined(_XPG4_2)... */
820 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
821 -extern int setegid();
822 -extern int seteuid();
823 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
824 -extern int setgid();
825 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
826 -extern int setgroups();
827 -extern int sethostname();
828 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
829 -extern int setpgid();
830 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
831 -extern pid_t setpgrp();
832 -extern int setregid();
833 -extern int setreuid();
834 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
835 -extern pid_t setsid();
836 -extern int setuid();
837 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
838 -extern void setusershell();
839 -#endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
840 -extern unsigned sleep();
841 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
842 -extern int stime();
843 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
844 -#if defined(_XPG4)
845 -/* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */
846 -extern void swab();
847 -#endif /* defined(_XPG4) */
848 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
849 -extern int symlink();
850 -extern void sync();
851 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
852 -#if defined(_XPG5)
853 -#ifdef __PRAGMA_REDEFINE_EXTNAME
854 -#pragma redefine_extname sysconf __sysconf_xpg5
855 -extern long sysconf();
856 -#else /* __PRAGMA_REDEFINE_EXTNAME */
857 -extern long __sysconf_xpg5();
858 -#define sysconf __sysconf_xpg5
859 -#endif /* __PRAGMA_REDEFINE_EXTNAME */
860 -#endif /* defined(_XPG5) */
861 -extern pid_t tcgetpgrp();
862 -extern int tcsetpgrp();
863 -#if !defined(__XOPEN_OR_POSIX) || \
864 - (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
865 - defined(__EXTENSIONS__)
866 -extern off_t tell();
867 -#endif /* !defined(__XOPEN_OR_POSIX)... */
868 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
869 - (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
870 - defined(__EXTENSIONS__)
871 -extern int truncate();
872 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
873 -extern char *ttyname();
874 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
875 -extern useconds_t ualarm();
876 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
877 -extern int unlink();
878 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
879 -extern int usleep();
880 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
881 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
882 -extern pid_t vfork();
883 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
884 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
885 -extern void vhangup();
886 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
887 -extern ssize_t write();
888 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
889 -extern void yield();
890 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
891 -
892 -#if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
893 - defined(__EXTENSIONS__)
894 - /* || defined(_XPG7) */
895 -extern int faccessat();
896 -extern int fchownat();
897 -extern int linkat();
898 -extern ssize_t readlinkat();
899 -extern int renameat();
900 -extern int symlinkat();
901 -extern int unlinkat();
902 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */
903 -#if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
904 -extern int get_nprocs();
905 -extern int get_nprocs_conf();
906 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
907 -
908 -/* transitional large file interface versions */
909 -#if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
910 - !defined(__PRAGMA_REDEFINE_EXTNAME))
911 -extern int ftruncate64();
912 -extern off64_t lseek64();
913 -extern ssize_t pread64();
914 -extern ssize_t pwrite64();
915 -extern off64_t tell64();
916 -extern int truncate64();
917 -extern int lockf64();
918 -#endif /* _LARGEFILE64_SOURCE */
919 -
920 -#endif /* __STDC__ */
921 -
922 -#if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
923 -#pragma unknown_control_flow(vfork)
924 -#endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
925 -
926 584 /*
927 585 * getlogin_r() & ttyname_r() prototypes are defined here.
928 586 */
929 587
930 588 /*
931 589 * Previous releases of Solaris, starting at 2.3, provided definitions of
932 590 * various functions as specified in POSIX.1c, Draft 6. For some of these
933 591 * functions, the final POSIX 1003.1c standard had a different number of
934 592 * arguments and return values.
935 593 *
936 594 * The following segment of this header provides support for the standard
937 595 * interfaces while supporting applications written under earlier
938 596 * releases. The application defines appropriate values of the feature
939 597 * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
940 598 * whether it was written to expect the Draft 6 or standard versions of
941 599 * these interfaces, before including this header. This header then
942 600 * provides a mapping from the source version of the interface to an
943 601 * appropriate binary interface. Such mappings permit an application
944 602 * to be built from libraries and objects which have mixed expectations
945 603 * of the definitions of these functions.
946 604 *
947 605 * For applications using the Draft 6 definitions, the binary symbol is the
948 606 * same as the source symbol, and no explicit mapping is needed. For the
949 607 * standard interface, the function func() is mapped to the binary symbol
950 608 * _posix_func(). The preferred mechanism for the remapping is a compiler
951 609 * #pragma. If the compiler does not provide such a #pragma, the header file
952 610 * defines a static function func() which calls the _posix_func() version;
953 611 * this has to be done instead of #define since POSIX specifies that an
954 612 * application can #undef the symbol and still be bound to the correct
955 613 * implementation. Unfortunately, the statics confuse lint so we fallback to
↓ open down ↓ |
20 lines elided |
↑ open up ↑ |
956 614 * #define in that case.
957 615 *
958 616 * NOTE: Support for the Draft 6 definitions is provided for compatibility
959 617 * only. New applications/libraries should use the standard definitions.
960 618 */
961 619
962 620 #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
963 621 !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \
964 622 defined(_POSIX_PTHREAD_SEMANTICS)
965 623
966 -#if defined(__STDC__)
967 -
968 624 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
969 625
970 626 #ifndef __USE_LEGACY_LOGNAME__
971 627 #ifdef __PRAGMA_REDEFINE_EXTNAME
972 628 #pragma redefine_extname getlogin_r __posix_getloginx_r
973 629 extern int getlogin_r(char *, int);
974 630 #else /* __PRAGMA_REDEFINE_EXTNAME */
975 631 extern int __posix_getloginx_r(char *, int);
976 632 #define getlogin_r __posix_getloginx_r
977 633 #endif /* __PRAGMA_REDEFINE_EXTNAME */
978 634 #else /* __USE_LEGACY_LOGNAME__ */
979 635 #ifdef __PRAGMA_REDEFINE_EXTNAME
980 636 #pragma redefine_extname getlogin_r __posix_getlogin_r
981 637 extern int getlogin_r(char *, int);
982 638 #else /* __PRAGMA_REDEFINE_EXTNAME */
983 639 extern int __posix_getlogin_r(char *, int);
984 640
985 641 #ifdef __lint
986 642
987 643 #define getlogin_r __posix_getlogin_r
988 644
989 645 #else /* !__lint */
990 646
991 647 static int
992 648 getlogin_r(char *__name, int __len)
993 649 {
994 650 return (__posix_getlogin_r(__name, __len));
995 651 }
996 652
997 653 #endif /* !__lint */
998 654 #endif /* __PRAGMA_REDEFINE_EXTNAME */
999 655 #endif /* __USE_LEGACY_LOGNAME__ */
1000 656
1001 657 #ifdef __PRAGMA_REDEFINE_EXTNAME
1002 658 #pragma redefine_extname ttyname_r __posix_ttyname_r
1003 659 extern int ttyname_r(int, char *, size_t);
1004 660 #else /* __PRAGMA_REDEFINE_EXTNAME */
1005 661 extern int __posix_ttyname_r(int, char *, size_t);
1006 662
1007 663 #ifdef __lint
1008 664
1009 665 #define ttyname_r __posix_ttyname_r
1010 666
1011 667 #else /* !__lint */
1012 668
1013 669 static int
1014 670 ttyname_r(int __fildes, char *__buf, size_t __size)
1015 671 {
1016 672 return (__posix_ttyname_r(__fildes, __buf, __size));
1017 673 }
1018 674
1019 675 #endif /* !__lint */
1020 676 #endif /* __PRAGMA_REDEFINE_EXTNAME */
1021 677
1022 678 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
1023 679
1024 680 #ifndef __USE_LEGACY_LOGNAME__
1025 681 #ifdef __PRAGMA_REDEFINE_EXTNAME
1026 682 #pragma redefine_extname getlogin_r getloginx_r
1027 683 #else /* __PRAGMA_REDEFINE_EXTNAME */
↓ open down ↓ |
50 lines elided |
↑ open up ↑ |
1028 684 extern char *getloginx_r(char *, int);
1029 685 #define getlogin_r getloginx_r
1030 686 #endif /* __PRAGMA_REDEFINE_EXTNAME */
1031 687 #endif /* __USE_LEGACY_LOGNAME__ */
1032 688 extern char *getlogin_r(char *, int);
1033 689
1034 690 extern char *ttyname_r(int, char *, int);
1035 691
1036 692 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
1037 693
1038 -#else /* __STDC__ */
1039 -
1040 -#if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
1041 -
1042 -#ifndef __USE_LEGACY_LOGNAME__
1043 -#ifdef __PRAGMA_REDEFINE_EXTNAME
1044 -#pragma redefine_extname getlogin_r __posix_getloginx_r
1045 -extern int getlogin_r();
1046 -#else /* __PRAGMA_REDEFINE_EXTNAME */
1047 -extern int __posix_getloginx_r();
1048 -#define getlogin_r __posix_getloginx_r
1049 -#endif /* __PRAGMA_REDEFINE_EXTNAME */
1050 -#else /* __USE_LEGACY_LOGNAME__ */
1051 -#ifdef __PRAGMA_REDEFINE_EXTNAME
1052 -#pragma redefine_extname getlogin_r __posix_getlogin_r
1053 -extern int getlogin_r();
1054 -#else /* __PRAGMA_REDEFINE_EXTNAME */
1055 -extern int __posix_getlogin_r();
1056 -
1057 -#ifdef __lint
1058 -
1059 -#define getlogin_r __posix_getlogin_r
1060 -
1061 -#else /* !__lint */
1062 -
1063 -static int
1064 -getlogin_r(__name, __len)
1065 - char *__name;
1066 - int __len;
1067 -{
1068 - return (__posix_getlogin_r(__name, __len));
1069 -}
1070 -#endif /* !__lint */
1071 -#endif /* __PRAGMA_REDEFINE_EXTNAME */
1072 -#endif /* __USE_LEGACY_LOGNAME__ */
1073 -
1074 -#ifdef __PRAGMA_REDEFINE_EXTNAME
1075 -#pragma redefine_extname ttyname_r __posix_ttyname_r
1076 -extern int ttyname_r();
1077 -#else /* __PRAGMA_REDEFINE_EXTNAME */
1078 -
1079 -extern int __posix_ttyname_r();
1080 -
1081 -#ifdef __lint
1082 -
1083 -#define ttyname_r __posix_ttyname_r
1084 -
1085 -#else /* !__lint */
1086 -
1087 -ttyname_r(__fildes, __buf, __size)
1088 - int __fildes;
1089 - char *__buf;
1090 - size_t __size;
1091 -{
1092 - return (__posix_ttyname_r(__fildes, __buf, __size));
1093 -}
1094 -#endif /* !__lint */
1095 -#endif /* __PRAGMA_REDEFINE_EXTNAME */
1096 -
1097 -#else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
1098 -
1099 -#ifndef __USE_LEGACY_LOGNAME__
1100 -#ifdef __PRAGMA_REDEFINE_EXTNAME
1101 -#pragma redefine_extname getlogin_r getloginx_r
1102 -#else /* __PRAGMA_REDEFINE_EXTNAME */
1103 -extern char *getloginx_r();
1104 -#define getlogin_r getloginx_r
1105 -#endif /* __PRAGMA_REDEFINE_EXTNAME */
1106 -#endif /* __USE_LEGACY_LOGNAME__ */
1107 -extern char *getlogin_r();
1108 -
1109 -extern char *ttyname_r();
1110 -
1111 -#endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
1112 -
1113 -#endif /* __STDC__ */
1114 -
1115 694 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
1116 695
1117 696 #ifdef __cplusplus
1118 697 }
1119 698 #endif
1120 699
1121 700 #endif /* _UNISTD_H */
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX