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