Print this page
5218 posix definition of NULL
correct unistd.h and iso/stddef_iso.h
update gate source affected
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 *
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 23 * Copyright 2014 Garrett D'Amore <garrett@damore.org>
↓ open down ↓ |
23 lines elided |
↑ open up ↑ |
24 24 * Copyright (c) 2013 Gary Mills
25 25 *
26 26 * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved.
27 27 */
28 28
29 29 /* Copyright (c) 1988 AT&T */
30 30 /* All Rights Reserved */
31 31
32 32 /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */
33 33
34 +/*
35 + * Copyright 2014 PALO, Richard.
36 + */
37 +
34 38 #ifndef _UNISTD_H
35 39 #define _UNISTD_H
36 40
37 41 #include <sys/feature_tests.h>
38 42
43 +#include <sys/null.h>
39 44 #include <sys/types.h>
40 45 #include <sys/unistd.h>
41 46
42 47 #ifdef __cplusplus
43 48 extern "C" {
44 49 #endif
45 50
46 51 /* Symbolic constants for the "access" routine: */
47 52 #define R_OK 4 /* Test for Read permission */
48 53 #define W_OK 2 /* Test for Write permission */
49 54 #define X_OK 1 /* Test for eXecute permission */
50 55 #define F_OK 0 /* Test for existence of File */
51 56
52 57 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
53 58 #define F_ULOCK 0 /* Unlock a previously locked region */
54 59 #define F_LOCK 1 /* Lock a region for exclusive use */
55 60 #define F_TLOCK 2 /* Test and lock a region for exclusive use */
56 61 #define F_TEST 3 /* Test a region for other processes locks */
57 62 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
58 63
59 64 /* Symbolic constants for the "lseek" routine: */
60 65
61 66 #ifndef SEEK_SET
62 67 #define SEEK_SET 0 /* Set file pointer to "offset" */
63 68 #endif
64 69
65 70 #ifndef SEEK_CUR
66 71 #define SEEK_CUR 1 /* Set file pointer to current plus "offset" */
67 72 #endif
68 73
69 74 #ifndef SEEK_END
70 75 #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
71 76 #endif
72 77
73 78 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
74 79 #ifndef SEEK_DATA
75 80 #define SEEK_DATA 3 /* Set file pointer to next data past offset */
76 81 #endif
77 82
78 83 #ifndef SEEK_HOLE
79 84 #define SEEK_HOLE 4 /* Set file pointer to next hole past offset */
80 85 #endif
81 86 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
82 87
83 88 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
84 89 /* Path names: */
85 90 #define GF_PATH "/etc/group" /* Path name of the "group" file */
86 91 #define PF_PATH "/etc/passwd" /* Path name of the "passwd" file */
87 92 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
88 93
89 94 /*
90 95 * compile-time symbolic constants,
91 96 * Support does not mean the feature is enabled.
92 97 * Use pathconf/sysconf to obtain actual configuration value.
93 98 */
94 99
95 100 /* Values unchanged in UNIX 03 */
96 101 #define _POSIX_ASYNC_IO 1
97 102 #define _POSIX_JOB_CONTROL 1
98 103 #define _POSIX_SAVED_IDS 1
99 104 #define _POSIX_SYNC_IO 1
100 105
101 106 /*
102 107 * POSIX.1b compile-time symbolic constants.
103 108 */
104 109 #if defined(_XPG6)
105 110 #define _POSIX_ASYNCHRONOUS_IO 200112L
106 111 #define _POSIX_FSYNC 200112L
107 112 #define _POSIX_MAPPED_FILES 200112L
108 113 #define _POSIX_MEMLOCK 200112L
109 114 #define _POSIX_MEMLOCK_RANGE 200112L
110 115 #define _POSIX_MEMORY_PROTECTION 200112L
111 116 #define _POSIX_MESSAGE_PASSING 200112L
112 117 #define _POSIX_PRIORITY_SCHEDULING 200112L
113 118 #define _POSIX_REALTIME_SIGNALS 200112L
114 119 #define _POSIX_SEMAPHORES 200112L
115 120 #define _POSIX_SHARED_MEMORY_OBJECTS 200112L
116 121 #define _POSIX_SYNCHRONIZED_IO 200112L
117 122 #else
118 123 #define _POSIX_ASYNCHRONOUS_IO 1
119 124 #define _POSIX_FSYNC 1
120 125 #define _POSIX_MAPPED_FILES 1
121 126 #define _POSIX_MEMLOCK 1
122 127 #define _POSIX_MEMLOCK_RANGE 1
123 128 #define _POSIX_MEMORY_PROTECTION 1
124 129 #define _POSIX_MESSAGE_PASSING 1
125 130 #define _POSIX_PRIORITY_SCHEDULING 1
126 131 #define _POSIX_REALTIME_SIGNALS 1
127 132 #define _POSIX_SEMAPHORES 1
128 133 #define _POSIX_SHARED_MEMORY_OBJECTS 1
129 134 #define _POSIX_SYNCHRONIZED_IO 1
130 135 #endif
131 136
132 137 /*
133 138 * POSIX.1c compile-time symbolic constants.
134 139 */
135 140 #if defined(_XPG6)
136 141 #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L
137 142 #define _POSIX_THREADS 200112L
138 143 #define _POSIX_THREAD_ATTR_STACKADDR 200112L
139 144 #define _POSIX_THREAD_ATTR_STACKSIZE 200112L
140 145 #define _POSIX_THREAD_PROCESS_SHARED 200112L
141 146 #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L
142 147 #define _POSIX_TIMERS 200112L
143 148 #else
144 149 #define _POSIX_THREAD_SAFE_FUNCTIONS 1
145 150 #define _POSIX_THREADS 1
146 151 #define _POSIX_THREAD_ATTR_STACKADDR 1
147 152 #define _POSIX_THREAD_ATTR_STACKSIZE 1
148 153 #define _POSIX_THREAD_PROCESS_SHARED 1
149 154 #define _POSIX_THREAD_PRIORITY_SCHEDULING 1
150 155 #define _POSIX_TIMERS 1
151 156 #endif
152 157
153 158 /* New in UNIX 03 */
154 159 #define _POSIX_ADVISORY_INFO 200112L
155 160 #define _POSIX_BARRIERS 200112L
156 161 #define _POSIX_CLOCK_SELECTION 200112L
157 162 #define _POSIX_IPV6 200112L
158 163 #define _POSIX_MONOTONIC_CLOCK 200112L
159 164 #define _POSIX_RAW_SOCKETS 200112L
160 165 #define _POSIX_READER_WRITER_LOCKS 200112L
161 166 #define _POSIX_SPAWN 200112L
162 167 #define _POSIX_SPIN_LOCKS 200112L
163 168 #define _POSIX_TIMEOUTS 200112L
164 169
165 170 /*
166 171 * Support for the POSIX.1 mutex protocol attribute. For realtime applications
167 172 * which need mutexes to support priority inheritance/ceiling.
168 173 */
169 174 #if defined(_XPG6)
170 175 #define _POSIX_THREAD_PRIO_INHERIT 200112L
↓ open down ↓ |
122 lines elided |
↑ open up ↑ |
171 176 #define _POSIX_THREAD_PRIO_PROTECT 200112L
172 177 #else
173 178 #define _POSIX_THREAD_PRIO_INHERIT 1
174 179 #define _POSIX_THREAD_PRIO_PROTECT 1
175 180 #endif
176 181
177 182 #ifndef _POSIX_VDISABLE
178 183 #define _POSIX_VDISABLE 0
179 184 #endif
180 185
181 -#ifndef NULL
182 -#if defined(_LP64)
183 -#define NULL 0L
184 -#else
185 -#define NULL 0
186 -#endif
187 -#endif
188 -
189 186 #define STDIN_FILENO 0
190 187 #define STDOUT_FILENO 1
191 188 #define STDERR_FILENO 2
192 189
193 190 /*
194 191 * Large File Summit-related announcement macros. The system supports both
195 192 * the additional and transitional Large File Summit interfaces. (The final
196 193 * two macros provide a finer granularity breakdown of _LFS64_LARGEFILE.)
197 194 */
198 195 #define _LFS_LARGEFILE 1
199 196 #define _LFS64_LARGEFILE 1
200 197 #define _LFS64_STDIO 1
201 198 #define _LFS64_ASYNCHRONOUS_IO 1
202 199
203 200 /* large file compilation environment setup */
204 201 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
205 202 #ifdef __PRAGMA_REDEFINE_EXTNAME
206 203 #pragma redefine_extname ftruncate ftruncate64
207 204 #pragma redefine_extname lseek lseek64
208 205 #pragma redefine_extname pread pread64
209 206 #pragma redefine_extname pwrite pwrite64
210 207 #pragma redefine_extname truncate truncate64
211 208 #pragma redefine_extname lockf lockf64
212 209 #pragma redefine_extname tell tell64
213 210 #else /* __PRAGMA_REDEFINE_EXTNAME */
214 211 #define ftruncate ftruncate64
215 212 #define lseek lseek64
216 213 #define pread pread64
217 214 #define pwrite pwrite64
218 215 #define truncate truncate64
219 216 #define lockf lockf64
220 217 #define tell tell64
221 218 #endif /* __PRAGMA_REDEFINE_EXTNAME */
222 219 #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */
223 220
224 221 /* In the LP64 compilation environment, the APIs are already large file */
225 222 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
226 223 #ifdef __PRAGMA_REDEFINE_EXTNAME
227 224 #pragma redefine_extname ftruncate64 ftruncate
228 225 #pragma redefine_extname lseek64 lseek
229 226 #pragma redefine_extname pread64 pread
230 227 #pragma redefine_extname pwrite64 pwrite
231 228 #pragma redefine_extname truncate64 truncate
232 229 #pragma redefine_extname lockf64 lockf
233 230 #pragma redefine_extname tell64 tell
234 231 #else /* __PRAGMA_REDEFINE_EXTNAME */
235 232 #define ftruncate64 ftruncate
236 233 #define lseek64 lseek
237 234 #define pread64 pread
238 235 #define pwrite64 pwrite
239 236 #define truncate64 truncate
240 237 #define lockf64 lockf
241 238 #define tell64 tell
242 239 #endif /* __PRAGMA_REDEFINE_EXTNAME */
243 240 #endif /* _LP64 && _LARGEFILE64_SOURCE */
244 241
245 242 extern int access(const char *, int);
246 243 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
247 244 extern int acct(const char *);
248 245 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
249 246 extern unsigned alarm(unsigned);
250 247 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
251 248 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
252 249 defined(__EXTENSIONS__)
253 250 extern int brk(void *);
254 251 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
255 252 extern int chdir(const char *);
256 253 extern int chown(const char *, uid_t, gid_t);
257 254 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
258 255 #if !defined(_POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && \
259 256 !defined(_XPG6)) || defined(__EXTENSIONS__)
260 257 extern int chroot(const char *);
261 258 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */
262 259 extern int close(int);
263 260 #if defined(_XPG4) || defined(__EXTENSIONS__)
264 261 extern size_t confstr(int, char *, size_t);
265 262 extern char *crypt(const char *, const char *);
266 263 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
267 264 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
268 265 defined(__EXTENSIONS__)
269 266 extern char *ctermid(char *);
270 267 #endif /* (!defined(_POSIX_C_SOURCE) ... */
271 268 #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__)
272 269 extern char *ctermid_r(char *);
273 270 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */
274 271 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
275 272 #if !defined(_XPG6) || defined(__EXTENSIONS__)
276 273 extern char *cuserid(char *);
277 274 #endif
278 275 extern int dup(int);
279 276 extern int dup2(int, int);
280 277 extern int dup3(int, int, int);
281 278 #if defined(_XPG4) || defined(__EXTENSIONS__)
282 279 extern void encrypt(char *, int);
283 280 #endif /* defined(XPG4) || defined(__EXTENSIONS__) */
284 281 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
285 282 extern void endusershell(void);
286 283 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
287 284 extern int execl(const char *, const char *, ...);
288 285 extern int execle(const char *, const char *, ...);
289 286 extern int execlp(const char *, const char *, ...);
290 287 extern int execv(const char *, char *const *);
291 288 extern int execve(const char *, char *const *, char *const *);
292 289 extern int execvp(const char *, char *const *);
293 290 extern void _exit(int)
294 291 __NORETURN;
295 292 /*
296 293 * The following fattach prototype is duplicated in <stropts.h>. The
297 294 * duplication is necessitated by XPG4.2 which requires the prototype
298 295 * be defined in <stropts.h>.
299 296 */
300 297 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
301 298 extern int fattach(int, const char *);
302 299 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
303 300 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
304 301 extern int fchdir(int);
305 302 extern int fchown(int, uid_t, gid_t);
306 303 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
307 304 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
308 305 extern int fchroot(int);
309 306 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
310 307 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \
311 308 defined(__EXTENSIONS__)
312 309 extern int fdatasync(int);
313 310 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
314 311 /*
315 312 * The following fdetach prototype is duplicated in <stropts.h>. The
316 313 * duplication is necessitated by XPG4.2 which requires the prototype
317 314 * be defined in <stropts.h>.
318 315 */
319 316 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
320 317 extern int fdetach(const char *);
321 318 #endif /* !defined(__XOPEN_OR_POSIX)... */
322 319 extern pid_t fork(void);
323 320 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
324 321 extern pid_t fork1(void);
325 322 extern pid_t forkall(void);
326 323 #endif /* !defined(__XOPEN_OR_POSIX)... */
327 324 extern long fpathconf(int, int);
328 325 #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \
329 326 defined(__EXTENSIONS__)
330 327 extern int fsync(int);
331 328 #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */
332 329 #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \
333 330 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
334 331 defined(__EXTENSIONS__)
335 332 extern int ftruncate(int, off_t);
336 333 #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */
337 334 extern char *getcwd(char *, size_t);
338 335 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
339 336 defined(__EXTENSIONS__)
340 337 extern int getdtablesize(void);
341 338 #endif
342 339 extern gid_t getegid(void);
343 340 extern uid_t geteuid(void);
344 341 extern gid_t getgid(void);
345 342 extern int getgroups(int, gid_t *);
346 343 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
347 344 extern long gethostid(void);
348 345 #endif
349 346 #if defined(_XPG4_2)
350 347 extern int gethostname(char *, size_t);
351 348 #elif !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
352 349 extern int gethostname(char *, int);
353 350 #endif
354 351
355 352 #ifndef __GETLOGIN_DEFINED /* Avoid duplicate in stdlib.h */
356 353 #define __GETLOGIN_DEFINED
357 354 #ifndef __USE_LEGACY_LOGNAME__
358 355 #ifdef __PRAGMA_REDEFINE_EXTNAME
359 356 #pragma redefine_extname getlogin getloginx
360 357 #else /* __PRAGMA_REDEFINE_EXTNAME */
361 358 extern char *getloginx(void);
362 359 #define getlogin getloginx
363 360 #endif /* __PRAGMA_REDEFINE_EXTNAME */
364 361 #endif /* __USE_LEGACY_LOGNAME__ */
365 362 extern char *getlogin(void);
366 363 #endif /* __GETLOGIN_DEFINED */
367 364
368 365 #if defined(_XPG4) || defined(__EXTENSIONS__)
369 366 extern int getopt(int, char *const *, const char *);
370 367 extern char *optarg;
371 368 extern int opterr, optind, optopt;
372 369 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
373 370 #if !defined(_XPG6) || defined(__EXTENSIONS__)
374 371 extern char *getpass(const char *);
375 372 #endif
376 373 #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */
377 374 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
378 375 /* Marked as LEGACY in SUSv2 and removed in SUSv3 */
379 376 #if !defined(_XPG6) || defined(__EXTENSIONS__)
380 377 extern int getpagesize(void);
381 378 #endif
382 379 extern pid_t getpgid(pid_t);
383 380 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
384 381 extern pid_t getpid(void);
385 382 extern pid_t getppid(void);
386 383 extern pid_t getpgrp(void);
387 384
388 385 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
389 386 char *gettxt(const char *, const char *);
390 387 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
391 388 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
392 389 extern pid_t getsid(pid_t);
393 390 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
394 391 extern uid_t getuid(void);
395 392 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
396 393 extern char *getusershell(void);
397 394 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
398 395 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
399 396 extern char *getwd(char *);
400 397 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
401 398 /*
402 399 * The following ioctl prototype is duplicated in <stropts.h>. The
403 400 * duplication is necessitated by XPG4.2 which requires the prototype
404 401 * be defined in <stropts.h>.
405 402 */
406 403 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
407 404 extern int ioctl(int, int, ...);
408 405 extern int isaexec(const char *, char *const *, char *const *);
409 406 extern int issetugid(void);
410 407 #endif
411 408 extern int isatty(int);
412 409 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
413 410 extern int lchown(const char *, uid_t, gid_t);
414 411 #endif
415 412 extern int link(const char *, const char *);
416 413 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
417 414 extern offset_t llseek(int, offset_t, int);
418 415 #endif
419 416 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
420 417 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
421 418 defined(__EXTENSIONS__)
422 419 extern int lockf(int, int, off_t);
423 420 #endif
424 421 extern off_t lseek(int, off_t, int);
425 422 #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
426 423 defined(__EXTENSIONS__)
427 424 extern int nice(int);
428 425 #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */
429 426 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
430 427 extern int mincore(caddr_t, size_t, char *);
431 428 #endif
432 429 extern long pathconf(const char *, int);
433 430 extern int pause(void);
434 431 extern int pipe(int *);
435 432 extern int pipe2(int *, int);
436 433 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \
437 434 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
438 435 defined(__EXTENSIONS__)
439 436 extern ssize_t pread(int, void *, size_t, off_t);
440 437 #endif
441 438 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
442 439 extern void profil(unsigned short *, size_t, unsigned long, unsigned int);
443 440 #endif
444 441 /*
445 442 * pthread_atfork() is also declared in <pthread.h> as per SUSv3. The
446 443 * declarations are identical. A change to either one may also require
447 444 * appropriate namespace updates in order to avoid redeclaration
448 445 * warnings in the case where both prototypes are exposed via inclusion
449 446 * of both <pthread.h> and <unistd.h>.
450 447 */
451 448 #if !defined(__XOPEN_OR_POSIX) || \
452 449 ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \
453 450 defined(__EXTENSIONS__)
454 451 extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void));
455 452 #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */
456 453 #if !defined(_LP64) && \
457 454 (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__))
458 455 extern int ptrace(int, pid_t, int, int);
459 456 #endif
460 457 #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \
461 458 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
462 459 defined(__EXTENSIONS__)
463 460 extern ssize_t pwrite(int, const void *, size_t, off_t);
464 461 #endif
465 462 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
466 463 /* per RFC 3542; This is also defined in netdb.h */
467 464 extern int rcmd_af(char **, unsigned short, const char *, const char *,
468 465 const char *, int *, int);
469 466 #endif
470 467 extern ssize_t read(int, void *, size_t);
471 468 #if !defined(__XOPEN_OR_POSIX) || \
472 469 defined(_XPG4_2) || defined(__EXTENSIONS__)
473 470 extern ssize_t readlink(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD,
474 471 size_t);
475 472 #endif
476 473 #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \
477 474 defined(__EXTENSIONS__)
478 475 #if __cplusplus >= 199711L
479 476 namespace std {
480 477 #endif
481 478 extern int rename(const char *, const char *);
482 479 #if __cplusplus >= 199711L
483 480 } /* end of namespace std */
484 481
485 482 using std::rename;
486 483 #endif /* __cplusplus >= 199711L */
487 484 #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */
488 485 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
489 486 extern int resolvepath(const char *, char *, size_t);
490 487 /* per RFC 3542; This is also defined in netdb.h */
491 488 extern int rexec_af(char **, unsigned short, const char *, const char *,
492 489 const char *, int *, int);
493 490 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
494 491 extern int rmdir(const char *);
495 492 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
496 493 /* per RFC 3542; This is also defined in netdb.h */
497 494 extern int rresvport_af(int *, int);
498 495 #endif
499 496
500 497 #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \
501 498 defined(__EXTENSIONS__)
502 499 extern void *sbrk(intptr_t);
503 500 #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */
504 501 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__)
505 502 extern int setegid(gid_t);
506 503 extern int seteuid(uid_t);
507 504 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */
508 505 extern int setgid(gid_t);
509 506 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
510 507 extern int setgroups(int, const gid_t *);
511 508 extern int sethostname(char *, int);
512 509 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
513 510 extern int setpgid(pid_t, pid_t);
514 511 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
515 512 extern pid_t setpgrp(void);
516 513 extern int setregid(gid_t, gid_t);
517 514 extern int setreuid(uid_t, uid_t);
518 515 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
519 516 extern pid_t setsid(void);
520 517 extern int setuid(uid_t);
521 518 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
522 519 extern void setusershell(void);
523 520 #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */
524 521 extern unsigned sleep(unsigned);
525 522 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
526 523 extern int stime(const time_t *);
527 524 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
528 525 #if defined(_XPG4)
529 526 /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */
530 527 extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t);
531 528 #endif /* defined(_XPG4) */
532 529 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
533 530 extern int symlink(const char *, const char *);
534 531 extern void sync(void);
535 532 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */
536 533 #if defined(_XPG5) && !defined(_XPG6)
537 534 #ifdef __PRAGMA_REDEFINE_EXTNAME
538 535 #pragma redefine_extname sysconf __sysconf_xpg5
539 536 #else /* __PRAGMA_REDEFINE_EXTNAME */
540 537 #define sysconf __sysconf_xpg5
541 538 #endif /* __PRAGMA_REDEFINE_EXTNAME */
542 539 #endif /* defined(_XPG5) && !defined(_XPG6) */
543 540 extern long sysconf(int);
544 541 extern pid_t tcgetpgrp(int);
545 542 extern int tcsetpgrp(int, pid_t);
546 543 #if !defined(__XOPEN_OR_POSIX) || \
547 544 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
548 545 defined(__EXTENSIONS__)
549 546 extern off_t tell(int);
550 547 #endif /* !defined(__XOPEN_OR_POSIX)... */
551 548 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \
552 549 (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \
553 550 defined(__EXTENSIONS__)
554 551 extern int truncate(const char *, off_t);
555 552 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
556 553 extern char *ttyname(int);
557 554 #if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS)
558 555 extern useconds_t ualarm(useconds_t, useconds_t);
559 556 #endif
560 557 extern int unlink(const char *);
561 558 #if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS)
562 559 extern int usleep(useconds_t);
563 560 #endif
564 561 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
565 562 extern pid_t vfork(void) __RETURNS_TWICE;
566 563 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
567 564 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
568 565 extern void vhangup(void);
569 566 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
570 567 extern ssize_t write(int, const void *, size_t);
571 568 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
572 569 extern void yield(void);
573 570 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
574 571
575 572 #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \
576 573 defined(__EXTENSIONS__)
577 574 /* || defined(_XPG7) */
578 575 extern int faccessat(int, const char *, int, int);
579 576 extern int fchownat(int, const char *, uid_t, gid_t, int);
580 577 extern int linkat(int, const char *, int, const char *, int);
581 578 extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD,
582 579 char *_RESTRICT_KYWD, size_t);
583 580 extern int renameat(int, const char *, int, const char *);
584 581 extern int symlinkat(const char *, int, const char *);
585 582 extern int unlinkat(int, const char *, int);
586 583 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */
587 584 #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)
588 585 extern int get_nprocs(void);
589 586 extern int get_nprocs_conf(void);
590 587 #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */
591 588
592 589 /* transitional large file interface versions */
593 590 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
594 591 !defined(__PRAGMA_REDEFINE_EXTNAME))
595 592 extern int ftruncate64(int, off64_t);
596 593 extern off64_t lseek64(int, off64_t, int);
597 594 extern ssize_t pread64(int, void *, size_t, off64_t);
598 595 extern ssize_t pwrite64(int, const void *, size_t, off64_t);
599 596 extern off64_t tell64(int);
600 597 extern int truncate64(const char *, off64_t);
601 598 extern int lockf64(int, int, off64_t);
602 599 #endif /* _LARGEFILE64_SOURCE */
603 600
604 601 #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__)
605 602 #pragma unknown_control_flow(vfork)
606 603 #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */
607 604
608 605 /*
609 606 * getlogin_r() & ttyname_r() prototypes are defined here.
610 607 */
611 608
612 609 /*
613 610 * Previous releases of Solaris, starting at 2.3, provided definitions of
614 611 * various functions as specified in POSIX.1c, Draft 6. For some of these
615 612 * functions, the final POSIX 1003.1c standard had a different number of
616 613 * arguments and return values.
617 614 *
618 615 * The following segment of this header provides support for the standard
619 616 * interfaces while supporting applications written under earlier
620 617 * releases. The application defines appropriate values of the feature
621 618 * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate
622 619 * whether it was written to expect the Draft 6 or standard versions of
623 620 * these interfaces, before including this header. This header then
624 621 * provides a mapping from the source version of the interface to an
625 622 * appropriate binary interface. Such mappings permit an application
626 623 * to be built from libraries and objects which have mixed expectations
627 624 * of the definitions of these functions.
628 625 *
629 626 * For applications using the Draft 6 definitions, the binary symbol is the
630 627 * same as the source symbol, and no explicit mapping is needed. For the
631 628 * standard interface, the function func() is mapped to the binary symbol
632 629 * _posix_func(). The preferred mechanism for the remapping is a compiler
633 630 * #pragma. If the compiler does not provide such a #pragma, the header file
634 631 * defines a static function func() which calls the _posix_func() version;
635 632 * this has to be done instead of #define since POSIX specifies that an
636 633 * application can #undef the symbol and still be bound to the correct
637 634 * implementation. Unfortunately, the statics confuse lint so we fallback to
638 635 * #define in that case.
639 636 *
640 637 * NOTE: Support for the Draft 6 definitions is provided for compatibility
641 638 * only. New applications/libraries should use the standard definitions.
642 639 */
643 640
644 641 #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \
645 642 !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \
646 643 defined(_POSIX_PTHREAD_SEMANTICS)
647 644
648 645 #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS)
649 646
650 647 #ifndef __USE_LEGACY_LOGNAME__
651 648 #ifdef __PRAGMA_REDEFINE_EXTNAME
652 649 #pragma redefine_extname getlogin_r __posix_getloginx_r
653 650 extern int getlogin_r(char *, int);
654 651 #else /* __PRAGMA_REDEFINE_EXTNAME */
655 652 extern int __posix_getloginx_r(char *, int);
656 653 #define getlogin_r __posix_getloginx_r
657 654 #endif /* __PRAGMA_REDEFINE_EXTNAME */
658 655 #else /* __USE_LEGACY_LOGNAME__ */
659 656 #ifdef __PRAGMA_REDEFINE_EXTNAME
660 657 #pragma redefine_extname getlogin_r __posix_getlogin_r
661 658 extern int getlogin_r(char *, int);
662 659 #else /* __PRAGMA_REDEFINE_EXTNAME */
663 660 extern int __posix_getlogin_r(char *, int);
664 661
665 662 #ifdef __lint
666 663
667 664 #define getlogin_r __posix_getlogin_r
668 665
669 666 #else /* !__lint */
670 667
671 668 static int
672 669 getlogin_r(char *__name, int __len)
673 670 {
674 671 return (__posix_getlogin_r(__name, __len));
675 672 }
676 673
677 674 #endif /* !__lint */
678 675 #endif /* __PRAGMA_REDEFINE_EXTNAME */
679 676 #endif /* __USE_LEGACY_LOGNAME__ */
680 677
681 678 #ifdef __PRAGMA_REDEFINE_EXTNAME
682 679 #pragma redefine_extname ttyname_r __posix_ttyname_r
683 680 extern int ttyname_r(int, char *, size_t);
684 681 #else /* __PRAGMA_REDEFINE_EXTNAME */
685 682 extern int __posix_ttyname_r(int, char *, size_t);
686 683
687 684 #ifdef __lint
688 685
689 686 #define ttyname_r __posix_ttyname_r
690 687
691 688 #else /* !__lint */
692 689
693 690 static int
694 691 ttyname_r(int __fildes, char *__buf, size_t __size)
695 692 {
696 693 return (__posix_ttyname_r(__fildes, __buf, __size));
697 694 }
698 695
699 696 #endif /* !__lint */
700 697 #endif /* __PRAGMA_REDEFINE_EXTNAME */
701 698
702 699 #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
703 700
704 701 #ifndef __USE_LEGACY_LOGNAME__
705 702 #ifdef __PRAGMA_REDEFINE_EXTNAME
706 703 #pragma redefine_extname getlogin_r getloginx_r
707 704 #else /* __PRAGMA_REDEFINE_EXTNAME */
708 705 extern char *getloginx_r(char *, int);
709 706 #define getlogin_r getloginx_r
710 707 #endif /* __PRAGMA_REDEFINE_EXTNAME */
711 708 #endif /* __USE_LEGACY_LOGNAME__ */
712 709 extern char *getlogin_r(char *, int);
713 710
714 711 extern char *ttyname_r(int, char *, int);
715 712
716 713 #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */
717 714
718 715 #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */
719 716
720 717 #ifdef __cplusplus
721 718 }
722 719 #endif
723 720
724 721 #endif /* _UNISTD_H */
↓ open down ↓ |
526 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX