17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5eec1faa8Sdamico * Common Development and Distribution License (the "License"). 6eec1faa8Sdamico * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 217c478bd9Sstevel@tonic-gate 227c478bd9Sstevel@tonic-gate /* 23*4870e0a7SRichard PALO * Copyright 2014 PALO, Richard. 24ba3594baSGarrett D'Amore * Copyright 2014 Garrett D'Amore <garrett@damore.org> 250a1278f2SGary Mills * Copyright (c) 2013 Gary Mills 260a1278f2SGary Mills * 27794f0adbSRoger A. Faulkner * Copyright (c) 1989, 2010, Oracle and/or its affiliates. All rights reserved. 287c478bd9Sstevel@tonic-gate */ 297c478bd9Sstevel@tonic-gate 30019c3c43Sraf /* Copyright (c) 1988 AT&T */ 31019c3c43Sraf /* All Rights Reserved */ 32019c3c43Sraf 335dbfd19aSTheo Schlossnagle /* Copyright (c) 2013, OmniTI Computer Consulting, Inc. All rights reserved. */ 345dbfd19aSTheo Schlossnagle 357c478bd9Sstevel@tonic-gate #ifndef _UNISTD_H 367c478bd9Sstevel@tonic-gate #define _UNISTD_H 377c478bd9Sstevel@tonic-gate 387c478bd9Sstevel@tonic-gate #include <sys/feature_tests.h> 397c478bd9Sstevel@tonic-gate 40*4870e0a7SRichard PALO #include <sys/null.h> 417c478bd9Sstevel@tonic-gate #include <sys/types.h> 427c478bd9Sstevel@tonic-gate #include <sys/unistd.h> 437c478bd9Sstevel@tonic-gate 447c478bd9Sstevel@tonic-gate #ifdef __cplusplus 457c478bd9Sstevel@tonic-gate extern "C" { 467c478bd9Sstevel@tonic-gate #endif 477c478bd9Sstevel@tonic-gate 487c478bd9Sstevel@tonic-gate /* Symbolic constants for the "access" routine: */ 497c478bd9Sstevel@tonic-gate #define R_OK 4 /* Test for Read permission */ 507c478bd9Sstevel@tonic-gate #define W_OK 2 /* Test for Write permission */ 517c478bd9Sstevel@tonic-gate #define X_OK 1 /* Test for eXecute permission */ 527c478bd9Sstevel@tonic-gate #define F_OK 0 /* Test for existence of File */ 537c478bd9Sstevel@tonic-gate 547c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 557c478bd9Sstevel@tonic-gate #define F_ULOCK 0 /* Unlock a previously locked region */ 567c478bd9Sstevel@tonic-gate #define F_LOCK 1 /* Lock a region for exclusive use */ 577c478bd9Sstevel@tonic-gate #define F_TLOCK 2 /* Test and lock a region for exclusive use */ 587c478bd9Sstevel@tonic-gate #define F_TEST 3 /* Test a region for other processes locks */ 597c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 607c478bd9Sstevel@tonic-gate 617c478bd9Sstevel@tonic-gate /* Symbolic constants for the "lseek" routine: */ 627c478bd9Sstevel@tonic-gate 637c478bd9Sstevel@tonic-gate #ifndef SEEK_SET 647c478bd9Sstevel@tonic-gate #define SEEK_SET 0 /* Set file pointer to "offset" */ 657c478bd9Sstevel@tonic-gate #endif 667c478bd9Sstevel@tonic-gate 677c478bd9Sstevel@tonic-gate #ifndef SEEK_CUR 687c478bd9Sstevel@tonic-gate #define SEEK_CUR 1 /* Set file pointer to current plus "offset" */ 697c478bd9Sstevel@tonic-gate #endif 707c478bd9Sstevel@tonic-gate 717c478bd9Sstevel@tonic-gate #ifndef SEEK_END 727c478bd9Sstevel@tonic-gate #define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ 737c478bd9Sstevel@tonic-gate #endif 747c478bd9Sstevel@tonic-gate 757c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 767c478bd9Sstevel@tonic-gate #ifndef SEEK_DATA 777c478bd9Sstevel@tonic-gate #define SEEK_DATA 3 /* Set file pointer to next data past offset */ 787c478bd9Sstevel@tonic-gate #endif 797c478bd9Sstevel@tonic-gate 807c478bd9Sstevel@tonic-gate #ifndef SEEK_HOLE 817c478bd9Sstevel@tonic-gate #define SEEK_HOLE 4 /* Set file pointer to next hole past offset */ 827c478bd9Sstevel@tonic-gate #endif 837c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 847c478bd9Sstevel@tonic-gate 857c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 867c478bd9Sstevel@tonic-gate /* Path names: */ 877c478bd9Sstevel@tonic-gate #define GF_PATH "/etc/group" /* Path name of the "group" file */ 887c478bd9Sstevel@tonic-gate #define PF_PATH "/etc/passwd" /* Path name of the "passwd" file */ 897c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 907c478bd9Sstevel@tonic-gate 917c478bd9Sstevel@tonic-gate /* 927c478bd9Sstevel@tonic-gate * compile-time symbolic constants, 937c478bd9Sstevel@tonic-gate * Support does not mean the feature is enabled. 947c478bd9Sstevel@tonic-gate * Use pathconf/sysconf to obtain actual configuration value. 957c478bd9Sstevel@tonic-gate */ 967c478bd9Sstevel@tonic-gate 977c478bd9Sstevel@tonic-gate /* Values unchanged in UNIX 03 */ 987c478bd9Sstevel@tonic-gate #define _POSIX_ASYNC_IO 1 997c478bd9Sstevel@tonic-gate #define _POSIX_JOB_CONTROL 1 1007c478bd9Sstevel@tonic-gate #define _POSIX_SAVED_IDS 1 1017c478bd9Sstevel@tonic-gate #define _POSIX_SYNC_IO 1 1027c478bd9Sstevel@tonic-gate 1037c478bd9Sstevel@tonic-gate /* 1047c478bd9Sstevel@tonic-gate * POSIX.1b compile-time symbolic constants. 1057c478bd9Sstevel@tonic-gate */ 1067c478bd9Sstevel@tonic-gate #if defined(_XPG6) 1077c478bd9Sstevel@tonic-gate #define _POSIX_ASYNCHRONOUS_IO 200112L 1087c478bd9Sstevel@tonic-gate #define _POSIX_FSYNC 200112L 1097c478bd9Sstevel@tonic-gate #define _POSIX_MAPPED_FILES 200112L 1107c478bd9Sstevel@tonic-gate #define _POSIX_MEMLOCK 200112L 1117c478bd9Sstevel@tonic-gate #define _POSIX_MEMLOCK_RANGE 200112L 1127c478bd9Sstevel@tonic-gate #define _POSIX_MEMORY_PROTECTION 200112L 1137c478bd9Sstevel@tonic-gate #define _POSIX_MESSAGE_PASSING 200112L 1147c478bd9Sstevel@tonic-gate #define _POSIX_PRIORITY_SCHEDULING 200112L 1157c478bd9Sstevel@tonic-gate #define _POSIX_REALTIME_SIGNALS 200112L 1167c478bd9Sstevel@tonic-gate #define _POSIX_SEMAPHORES 200112L 1177c478bd9Sstevel@tonic-gate #define _POSIX_SHARED_MEMORY_OBJECTS 200112L 1187c478bd9Sstevel@tonic-gate #define _POSIX_SYNCHRONIZED_IO 200112L 1197c478bd9Sstevel@tonic-gate #else 1207c478bd9Sstevel@tonic-gate #define _POSIX_ASYNCHRONOUS_IO 1 1217c478bd9Sstevel@tonic-gate #define _POSIX_FSYNC 1 1227c478bd9Sstevel@tonic-gate #define _POSIX_MAPPED_FILES 1 1237c478bd9Sstevel@tonic-gate #define _POSIX_MEMLOCK 1 1247c478bd9Sstevel@tonic-gate #define _POSIX_MEMLOCK_RANGE 1 1257c478bd9Sstevel@tonic-gate #define _POSIX_MEMORY_PROTECTION 1 1267c478bd9Sstevel@tonic-gate #define _POSIX_MESSAGE_PASSING 1 1277c478bd9Sstevel@tonic-gate #define _POSIX_PRIORITY_SCHEDULING 1 1287c478bd9Sstevel@tonic-gate #define _POSIX_REALTIME_SIGNALS 1 1297c478bd9Sstevel@tonic-gate #define _POSIX_SEMAPHORES 1 1307c478bd9Sstevel@tonic-gate #define _POSIX_SHARED_MEMORY_OBJECTS 1 1317c478bd9Sstevel@tonic-gate #define _POSIX_SYNCHRONIZED_IO 1 1327c478bd9Sstevel@tonic-gate #endif 1337c478bd9Sstevel@tonic-gate 1347c478bd9Sstevel@tonic-gate /* 1357c478bd9Sstevel@tonic-gate * POSIX.1c compile-time symbolic constants. 1367c478bd9Sstevel@tonic-gate */ 1377c478bd9Sstevel@tonic-gate #if defined(_XPG6) 1387c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_SAFE_FUNCTIONS 200112L 1397c478bd9Sstevel@tonic-gate #define _POSIX_THREADS 200112L 1407c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_ATTR_STACKADDR 200112L 1417c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_ATTR_STACKSIZE 200112L 1427c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_PROCESS_SHARED 200112L 1437c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_PRIORITY_SCHEDULING 200112L 1447c478bd9Sstevel@tonic-gate #define _POSIX_TIMERS 200112L 1457c478bd9Sstevel@tonic-gate #else 1467c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_SAFE_FUNCTIONS 1 1477c478bd9Sstevel@tonic-gate #define _POSIX_THREADS 1 1487c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_ATTR_STACKADDR 1 1497c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_ATTR_STACKSIZE 1 1507c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_PROCESS_SHARED 1 1517c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_PRIORITY_SCHEDULING 1 1527c478bd9Sstevel@tonic-gate #define _POSIX_TIMERS 1 1537c478bd9Sstevel@tonic-gate #endif 1547c478bd9Sstevel@tonic-gate 1557c478bd9Sstevel@tonic-gate /* New in UNIX 03 */ 156019c3c43Sraf #define _POSIX_ADVISORY_INFO 200112L 1577c478bd9Sstevel@tonic-gate #define _POSIX_BARRIERS 200112L 1587c478bd9Sstevel@tonic-gate #define _POSIX_CLOCK_SELECTION 200112L 1597c478bd9Sstevel@tonic-gate #define _POSIX_IPV6 200112L 1607c478bd9Sstevel@tonic-gate #define _POSIX_MONOTONIC_CLOCK 200112L 1617c478bd9Sstevel@tonic-gate #define _POSIX_RAW_SOCKETS 200112L 1627c478bd9Sstevel@tonic-gate #define _POSIX_READER_WRITER_LOCKS 200112L 1637c478bd9Sstevel@tonic-gate #define _POSIX_SPAWN 200112L 1647c478bd9Sstevel@tonic-gate #define _POSIX_SPIN_LOCKS 200112L 1657c478bd9Sstevel@tonic-gate #define _POSIX_TIMEOUTS 200112L 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate /* 1687c478bd9Sstevel@tonic-gate * Support for the POSIX.1 mutex protocol attribute. For realtime applications 1697c478bd9Sstevel@tonic-gate * which need mutexes to support priority inheritance/ceiling. 1707c478bd9Sstevel@tonic-gate */ 1717c478bd9Sstevel@tonic-gate #if defined(_XPG6) 1727c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_PRIO_INHERIT 200112L 1737c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_PRIO_PROTECT 200112L 1747c478bd9Sstevel@tonic-gate #else 1757c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_PRIO_INHERIT 1 1767c478bd9Sstevel@tonic-gate #define _POSIX_THREAD_PRIO_PROTECT 1 1777c478bd9Sstevel@tonic-gate #endif 1787c478bd9Sstevel@tonic-gate 1797c478bd9Sstevel@tonic-gate #ifndef _POSIX_VDISABLE 1807c478bd9Sstevel@tonic-gate #define _POSIX_VDISABLE 0 1817c478bd9Sstevel@tonic-gate #endif 1827c478bd9Sstevel@tonic-gate 1837c478bd9Sstevel@tonic-gate #define STDIN_FILENO 0 1847c478bd9Sstevel@tonic-gate #define STDOUT_FILENO 1 1857c478bd9Sstevel@tonic-gate #define STDERR_FILENO 2 1867c478bd9Sstevel@tonic-gate 1877c478bd9Sstevel@tonic-gate /* 1887c478bd9Sstevel@tonic-gate * Large File Summit-related announcement macros. The system supports both 1897c478bd9Sstevel@tonic-gate * the additional and transitional Large File Summit interfaces. (The final 1907c478bd9Sstevel@tonic-gate * two macros provide a finer granularity breakdown of _LFS64_LARGEFILE.) 1917c478bd9Sstevel@tonic-gate */ 1927c478bd9Sstevel@tonic-gate #define _LFS_LARGEFILE 1 1937c478bd9Sstevel@tonic-gate #define _LFS64_LARGEFILE 1 1947c478bd9Sstevel@tonic-gate #define _LFS64_STDIO 1 1957c478bd9Sstevel@tonic-gate #define _LFS64_ASYNCHRONOUS_IO 1 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate /* large file compilation environment setup */ 1987c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 1997c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 2007c478bd9Sstevel@tonic-gate #pragma redefine_extname ftruncate ftruncate64 2017c478bd9Sstevel@tonic-gate #pragma redefine_extname lseek lseek64 2027c478bd9Sstevel@tonic-gate #pragma redefine_extname pread pread64 2037c478bd9Sstevel@tonic-gate #pragma redefine_extname pwrite pwrite64 2047c478bd9Sstevel@tonic-gate #pragma redefine_extname truncate truncate64 2057c478bd9Sstevel@tonic-gate #pragma redefine_extname lockf lockf64 2067c478bd9Sstevel@tonic-gate #pragma redefine_extname tell tell64 2077c478bd9Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 2087c478bd9Sstevel@tonic-gate #define ftruncate ftruncate64 2097c478bd9Sstevel@tonic-gate #define lseek lseek64 2107c478bd9Sstevel@tonic-gate #define pread pread64 2117c478bd9Sstevel@tonic-gate #define pwrite pwrite64 2127c478bd9Sstevel@tonic-gate #define truncate truncate64 2137c478bd9Sstevel@tonic-gate #define lockf lockf64 2147c478bd9Sstevel@tonic-gate #define tell tell64 2157c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 2167c478bd9Sstevel@tonic-gate #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 2177c478bd9Sstevel@tonic-gate 2187c478bd9Sstevel@tonic-gate /* In the LP64 compilation environment, the APIs are already large file */ 2197c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE) 2207c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 2217c478bd9Sstevel@tonic-gate #pragma redefine_extname ftruncate64 ftruncate 2227c478bd9Sstevel@tonic-gate #pragma redefine_extname lseek64 lseek 2237c478bd9Sstevel@tonic-gate #pragma redefine_extname pread64 pread 2247c478bd9Sstevel@tonic-gate #pragma redefine_extname pwrite64 pwrite 2257c478bd9Sstevel@tonic-gate #pragma redefine_extname truncate64 truncate 2267c478bd9Sstevel@tonic-gate #pragma redefine_extname lockf64 lockf 2277c478bd9Sstevel@tonic-gate #pragma redefine_extname tell64 tell 2287c478bd9Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 2297c478bd9Sstevel@tonic-gate #define ftruncate64 ftruncate 2307c478bd9Sstevel@tonic-gate #define lseek64 lseek 2317c478bd9Sstevel@tonic-gate #define pread64 pread 2327c478bd9Sstevel@tonic-gate #define pwrite64 pwrite 2337c478bd9Sstevel@tonic-gate #define truncate64 truncate 2347c478bd9Sstevel@tonic-gate #define lockf64 lockf 2357c478bd9Sstevel@tonic-gate #define tell64 tell 2367c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 2377c478bd9Sstevel@tonic-gate #endif /* _LP64 && _LARGEFILE64_SOURCE */ 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate extern int access(const char *, int); 2407c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2417c478bd9Sstevel@tonic-gate extern int acct(const char *); 2427c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 2437c478bd9Sstevel@tonic-gate extern unsigned alarm(unsigned); 2447c478bd9Sstevel@tonic-gate /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 2457c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 2467c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 2477c478bd9Sstevel@tonic-gate extern int brk(void *); 2487c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 2497c478bd9Sstevel@tonic-gate extern int chdir(const char *); 2507c478bd9Sstevel@tonic-gate extern int chown(const char *, uid_t, gid_t); 2517c478bd9Sstevel@tonic-gate /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 2527c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || (defined(_XOPEN_SOURCE) && \ 2537c478bd9Sstevel@tonic-gate !defined(_XPG6)) || defined(__EXTENSIONS__) 2547c478bd9Sstevel@tonic-gate extern int chroot(const char *); 2557c478bd9Sstevel@tonic-gate #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE))... */ 2567c478bd9Sstevel@tonic-gate extern int close(int); 2577c478bd9Sstevel@tonic-gate #if defined(_XPG4) || defined(__EXTENSIONS__) 2587c478bd9Sstevel@tonic-gate extern size_t confstr(int, char *, size_t); 2597c478bd9Sstevel@tonic-gate extern char *crypt(const char *, const char *); 2607c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 2617c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 2627c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 2637c478bd9Sstevel@tonic-gate extern char *ctermid(char *); 2647c478bd9Sstevel@tonic-gate #endif /* (!defined(_POSIX_C_SOURCE) ... */ 26535ba209eSdamico #if !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) || defined(__EXTENSIONS__) 2667c478bd9Sstevel@tonic-gate extern char *ctermid_r(char *); 2677c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_REENTRANT) ... */ 2687c478bd9Sstevel@tonic-gate /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 2697c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 2707c478bd9Sstevel@tonic-gate extern char *cuserid(char *); 2717c478bd9Sstevel@tonic-gate #endif 2727c478bd9Sstevel@tonic-gate extern int dup(int); 2737c478bd9Sstevel@tonic-gate extern int dup2(int, int); 2745dbfd19aSTheo Schlossnagle extern int dup3(int, int, int); 2757c478bd9Sstevel@tonic-gate #if defined(_XPG4) || defined(__EXTENSIONS__) 2767c478bd9Sstevel@tonic-gate extern void encrypt(char *, int); 2777c478bd9Sstevel@tonic-gate #endif /* defined(XPG4) || defined(__EXTENSIONS__) */ 2787c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2797c478bd9Sstevel@tonic-gate extern void endusershell(void); 2807c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 2817c478bd9Sstevel@tonic-gate extern int execl(const char *, const char *, ...); 2827c478bd9Sstevel@tonic-gate extern int execle(const char *, const char *, ...); 2837c478bd9Sstevel@tonic-gate extern int execlp(const char *, const char *, ...); 2847c478bd9Sstevel@tonic-gate extern int execv(const char *, char *const *); 2857c478bd9Sstevel@tonic-gate extern int execve(const char *, char *const *, char *const *); 2867c478bd9Sstevel@tonic-gate extern int execvp(const char *, char *const *); 2877c478bd9Sstevel@tonic-gate extern void _exit(int) 2887c478bd9Sstevel@tonic-gate __NORETURN; 2897c478bd9Sstevel@tonic-gate /* 2907c478bd9Sstevel@tonic-gate * The following fattach prototype is duplicated in <stropts.h>. The 2917c478bd9Sstevel@tonic-gate * duplication is necessitated by XPG4.2 which requires the prototype 2927c478bd9Sstevel@tonic-gate * be defined in <stropts.h>. 2937c478bd9Sstevel@tonic-gate */ 2947c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 2957c478bd9Sstevel@tonic-gate extern int fattach(int, const char *); 2967c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 2977c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 2987c478bd9Sstevel@tonic-gate extern int fchdir(int); 2997c478bd9Sstevel@tonic-gate extern int fchown(int, uid_t, gid_t); 3007c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 3017c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3027c478bd9Sstevel@tonic-gate extern int fchroot(int); 3037c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 3047c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || \ 3057c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 3067c478bd9Sstevel@tonic-gate extern int fdatasync(int); 3077c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 3087c478bd9Sstevel@tonic-gate /* 3097c478bd9Sstevel@tonic-gate * The following fdetach prototype is duplicated in <stropts.h>. The 3107c478bd9Sstevel@tonic-gate * duplication is necessitated by XPG4.2 which requires the prototype 3117c478bd9Sstevel@tonic-gate * be defined in <stropts.h>. 3127c478bd9Sstevel@tonic-gate */ 3137c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3147c478bd9Sstevel@tonic-gate extern int fdetach(const char *); 3157c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX)... */ 3167c478bd9Sstevel@tonic-gate extern pid_t fork(void); 3177c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3187c478bd9Sstevel@tonic-gate extern pid_t fork1(void); 3197c478bd9Sstevel@tonic-gate extern pid_t forkall(void); 3207c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX)... */ 3217c478bd9Sstevel@tonic-gate extern long fpathconf(int, int); 3227c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2) || \ 3237c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 3247c478bd9Sstevel@tonic-gate extern int fsync(int); 3257c478bd9Sstevel@tonic-gate #endif /* !defined(_POSIX_C_SOURCE) || (_POSIX_C_SOURCE > 2)... */ 3267c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2) || defined(_XPG4_2) || \ 3277c478bd9Sstevel@tonic-gate (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 3287c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 3297c478bd9Sstevel@tonic-gate extern int ftruncate(int, off_t); 3307c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE > 2)... */ 3317c478bd9Sstevel@tonic-gate extern char *getcwd(char *, size_t); 3327c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 3337c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 3347c478bd9Sstevel@tonic-gate extern int getdtablesize(void); 3357c478bd9Sstevel@tonic-gate #endif 3367c478bd9Sstevel@tonic-gate extern gid_t getegid(void); 3377c478bd9Sstevel@tonic-gate extern uid_t geteuid(void); 3387c478bd9Sstevel@tonic-gate extern gid_t getgid(void); 3397c478bd9Sstevel@tonic-gate extern int getgroups(int, gid_t *); 3407c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 3417c478bd9Sstevel@tonic-gate extern long gethostid(void); 3427c478bd9Sstevel@tonic-gate #endif 3437c478bd9Sstevel@tonic-gate #if defined(_XPG4_2) 3447c478bd9Sstevel@tonic-gate extern int gethostname(char *, size_t); 3457c478bd9Sstevel@tonic-gate #elif !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3467c478bd9Sstevel@tonic-gate extern int gethostname(char *, int); 3477c478bd9Sstevel@tonic-gate #endif 3480a1278f2SGary Mills 3490a1278f2SGary Mills #ifndef __GETLOGIN_DEFINED /* Avoid duplicate in stdlib.h */ 3500a1278f2SGary Mills #define __GETLOGIN_DEFINED 3510a1278f2SGary Mills #ifndef __USE_LEGACY_LOGNAME__ 3520a1278f2SGary Mills #ifdef __PRAGMA_REDEFINE_EXTNAME 3530a1278f2SGary Mills #pragma redefine_extname getlogin getloginx 3540a1278f2SGary Mills #else /* __PRAGMA_REDEFINE_EXTNAME */ 3550a1278f2SGary Mills extern char *getloginx(void); 3560a1278f2SGary Mills #define getlogin getloginx 3570a1278f2SGary Mills #endif /* __PRAGMA_REDEFINE_EXTNAME */ 3580a1278f2SGary Mills #endif /* __USE_LEGACY_LOGNAME__ */ 3597c478bd9Sstevel@tonic-gate extern char *getlogin(void); 3600a1278f2SGary Mills #endif /* __GETLOGIN_DEFINED */ 3610a1278f2SGary Mills 3627c478bd9Sstevel@tonic-gate #if defined(_XPG4) || defined(__EXTENSIONS__) 3637c478bd9Sstevel@tonic-gate extern int getopt(int, char *const *, const char *); 3647c478bd9Sstevel@tonic-gate extern char *optarg; 3657c478bd9Sstevel@tonic-gate extern int opterr, optind, optopt; 3667c478bd9Sstevel@tonic-gate /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 3677c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 3687c478bd9Sstevel@tonic-gate extern char *getpass(const char *); 3697c478bd9Sstevel@tonic-gate #endif 3707c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4) || defined(__EXTENSIONS__) */ 3717c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 3727c478bd9Sstevel@tonic-gate /* Marked as LEGACY in SUSv2 and removed in SUSv3 */ 3737c478bd9Sstevel@tonic-gate #if !defined(_XPG6) || defined(__EXTENSIONS__) 3747c478bd9Sstevel@tonic-gate extern int getpagesize(void); 3757c478bd9Sstevel@tonic-gate #endif 3767c478bd9Sstevel@tonic-gate extern pid_t getpgid(pid_t); 3777c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 3787c478bd9Sstevel@tonic-gate extern pid_t getpid(void); 3797c478bd9Sstevel@tonic-gate extern pid_t getppid(void); 3807c478bd9Sstevel@tonic-gate extern pid_t getpgrp(void); 3817c478bd9Sstevel@tonic-gate 3827c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3837c478bd9Sstevel@tonic-gate char *gettxt(const char *, const char *); 3847c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 3857c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 3867c478bd9Sstevel@tonic-gate extern pid_t getsid(pid_t); 3877c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 3887c478bd9Sstevel@tonic-gate extern uid_t getuid(void); 3897c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3907c478bd9Sstevel@tonic-gate extern char *getusershell(void); 3917c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 3927c478bd9Sstevel@tonic-gate /* 3937c478bd9Sstevel@tonic-gate * The following ioctl prototype is duplicated in <stropts.h>. The 3947c478bd9Sstevel@tonic-gate * duplication is necessitated by XPG4.2 which requires the prototype 3957c478bd9Sstevel@tonic-gate * be defined in <stropts.h>. 3967c478bd9Sstevel@tonic-gate */ 3977c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 3987c478bd9Sstevel@tonic-gate extern int ioctl(int, int, ...); 3997c478bd9Sstevel@tonic-gate extern int isaexec(const char *, char *const *, char *const *); 4007c478bd9Sstevel@tonic-gate extern int issetugid(void); 4017c478bd9Sstevel@tonic-gate #endif 4027c478bd9Sstevel@tonic-gate extern int isatty(int); 4037c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 4047c478bd9Sstevel@tonic-gate extern int lchown(const char *, uid_t, gid_t); 4057c478bd9Sstevel@tonic-gate #endif 4067c478bd9Sstevel@tonic-gate extern int link(const char *, const char *); 4077c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 4087c478bd9Sstevel@tonic-gate extern offset_t llseek(int, offset_t, int); 4097c478bd9Sstevel@tonic-gate #endif 4107c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 4117c478bd9Sstevel@tonic-gate (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 4127c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 4137c478bd9Sstevel@tonic-gate extern int lockf(int, int, off_t); 4147c478bd9Sstevel@tonic-gate #endif 4157c478bd9Sstevel@tonic-gate extern off_t lseek(int, off_t, int); 4167c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \ 4177c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 4187c478bd9Sstevel@tonic-gate extern int nice(int); 4197c478bd9Sstevel@tonic-gate #endif /* !defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE)... */ 4207c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 4217c478bd9Sstevel@tonic-gate extern int mincore(caddr_t, size_t, char *); 4227c478bd9Sstevel@tonic-gate #endif 4237c478bd9Sstevel@tonic-gate extern long pathconf(const char *, int); 4247c478bd9Sstevel@tonic-gate extern int pause(void); 4257c478bd9Sstevel@tonic-gate extern int pipe(int *); 4265dbfd19aSTheo Schlossnagle extern int pipe2(int *, int); 4277c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ 4287c478bd9Sstevel@tonic-gate (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 4297c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 4307c478bd9Sstevel@tonic-gate extern ssize_t pread(int, void *, size_t, off_t); 4317c478bd9Sstevel@tonic-gate #endif 4327c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 4337c478bd9Sstevel@tonic-gate extern void profil(unsigned short *, size_t, unsigned long, unsigned int); 4347c478bd9Sstevel@tonic-gate #endif 4357c478bd9Sstevel@tonic-gate /* 4367c478bd9Sstevel@tonic-gate * pthread_atfork() is also declared in <pthread.h> as per SUSv3. The 4377c478bd9Sstevel@tonic-gate * declarations are identical. A change to either one may also require 4387c478bd9Sstevel@tonic-gate * appropriate namespace updates in order to avoid redeclaration 4397c478bd9Sstevel@tonic-gate * warnings in the case where both prototypes are exposed via inclusion 4407c478bd9Sstevel@tonic-gate * of both <pthread.h> and <unistd.h>. 4417c478bd9Sstevel@tonic-gate */ 4427c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || \ 4437c478bd9Sstevel@tonic-gate ((_POSIX_C_SOURCE > 2) && !defined(_XPG6)) || \ 4447c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 4457c478bd9Sstevel@tonic-gate extern int pthread_atfork(void (*) (void), void (*) (void), void (*) (void)); 4467c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || ((_POSIX_C_SOURCE > 2) ... */ 4477c478bd9Sstevel@tonic-gate #if !defined(_LP64) && \ 4487c478bd9Sstevel@tonic-gate (!defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__)) 4497c478bd9Sstevel@tonic-gate extern int ptrace(int, pid_t, int, int); 4507c478bd9Sstevel@tonic-gate #endif 4517c478bd9Sstevel@tonic-gate #if !defined(_POSIX_C_SOURCE) || defined(_XPG5) || \ 4527c478bd9Sstevel@tonic-gate (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 4537c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 4547c478bd9Sstevel@tonic-gate extern ssize_t pwrite(int, const void *, size_t, off_t); 4557c478bd9Sstevel@tonic-gate #endif 4567c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 4577c478bd9Sstevel@tonic-gate /* per RFC 3542; This is also defined in netdb.h */ 4587c478bd9Sstevel@tonic-gate extern int rcmd_af(char **, unsigned short, const char *, const char *, 4597c478bd9Sstevel@tonic-gate const char *, int *, int); 4607c478bd9Sstevel@tonic-gate #endif 4617c478bd9Sstevel@tonic-gate extern ssize_t read(int, void *, size_t); 4627c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || \ 4637c478bd9Sstevel@tonic-gate defined(_XPG4_2) || defined(__EXTENSIONS__) 4647c478bd9Sstevel@tonic-gate extern ssize_t readlink(const char *_RESTRICT_KYWD, char *_RESTRICT_KYWD, 4657c478bd9Sstevel@tonic-gate size_t); 4667c478bd9Sstevel@tonic-gate #endif 4677c478bd9Sstevel@tonic-gate #if (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3) && !defined(_XPG4))) || \ 4687c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 4695bc7ce93SAlexander Pyhalov #if __cplusplus >= 199711L 4705bc7ce93SAlexander Pyhalov namespace std { 4715bc7ce93SAlexander Pyhalov #endif 4727c478bd9Sstevel@tonic-gate extern int rename(const char *, const char *); 4735bc7ce93SAlexander Pyhalov #if __cplusplus >= 199711L 4745bc7ce93SAlexander Pyhalov } /* end of namespace std */ 4755bc7ce93SAlexander Pyhalov 4765bc7ce93SAlexander Pyhalov using std::rename; 4775bc7ce93SAlexander Pyhalov #endif /* __cplusplus >= 199711L */ 4787c478bd9Sstevel@tonic-gate #endif /* (!defined(__XOPEN_OR_POSIX) || (defined(_XPG3)... */ 4797c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 4807c478bd9Sstevel@tonic-gate extern int resolvepath(const char *, char *, size_t); 4817c478bd9Sstevel@tonic-gate /* per RFC 3542; This is also defined in netdb.h */ 4827c478bd9Sstevel@tonic-gate extern int rexec_af(char **, unsigned short, const char *, const char *, 4837c478bd9Sstevel@tonic-gate const char *, int *, int); 4847c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 4857c478bd9Sstevel@tonic-gate extern int rmdir(const char *); 4867c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 4877c478bd9Sstevel@tonic-gate /* per RFC 3542; This is also defined in netdb.h */ 4887c478bd9Sstevel@tonic-gate extern int rresvport_af(int *, int); 4897c478bd9Sstevel@tonic-gate #endif 4907c478bd9Sstevel@tonic-gate 4917c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2) && !defined(_XPG6)) || \ 4927c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 4937c478bd9Sstevel@tonic-gate extern void *sbrk(intptr_t); 4947c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || (defined(_XPG4_2)... */ 4957c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG6) || defined(__EXTENSIONS__) 4967c478bd9Sstevel@tonic-gate extern int setegid(gid_t); 4977c478bd9Sstevel@tonic-gate extern int seteuid(uid_t); 4987c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG6) ... */ 4997c478bd9Sstevel@tonic-gate extern int setgid(gid_t); 5007c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 5017c478bd9Sstevel@tonic-gate extern int setgroups(int, const gid_t *); 502eec1faa8Sdamico extern int sethostname(char *, int); 5037c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 5047c478bd9Sstevel@tonic-gate extern int setpgid(pid_t, pid_t); 5057c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 5067c478bd9Sstevel@tonic-gate extern pid_t setpgrp(void); 5077c478bd9Sstevel@tonic-gate extern int setregid(gid_t, gid_t); 5087c478bd9Sstevel@tonic-gate extern int setreuid(uid_t, uid_t); 5097c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 5107c478bd9Sstevel@tonic-gate extern pid_t setsid(void); 5117c478bd9Sstevel@tonic-gate extern int setuid(uid_t); 5127c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 5137c478bd9Sstevel@tonic-gate extern void setusershell(void); 5147c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX)|| defined(__EXTENSIONS__) */ 5157c478bd9Sstevel@tonic-gate extern unsigned sleep(unsigned); 5167c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 5177c478bd9Sstevel@tonic-gate extern int stime(const time_t *); 5187c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 5197c478bd9Sstevel@tonic-gate #if defined(_XPG4) 5207c478bd9Sstevel@tonic-gate /* __EXTENSIONS__ makes the SVID Third Edition prototype in stdlib.h visible */ 5217c478bd9Sstevel@tonic-gate extern void swab(const void *_RESTRICT_KYWD, void *_RESTRICT_KYWD, ssize_t); 5227c478bd9Sstevel@tonic-gate #endif /* defined(_XPG4) */ 5237c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || defined(__EXTENSIONS__) 5247c478bd9Sstevel@tonic-gate extern int symlink(const char *, const char *); 5257c478bd9Sstevel@tonic-gate extern void sync(void); 5267c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) */ 5277c478bd9Sstevel@tonic-gate #if defined(_XPG5) && !defined(_XPG6) 5287c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 5297c478bd9Sstevel@tonic-gate #pragma redefine_extname sysconf __sysconf_xpg5 5307c478bd9Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 5317c478bd9Sstevel@tonic-gate #define sysconf __sysconf_xpg5 5327c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 5337c478bd9Sstevel@tonic-gate #endif /* defined(_XPG5) && !defined(_XPG6) */ 5347c478bd9Sstevel@tonic-gate extern long sysconf(int); 5357c478bd9Sstevel@tonic-gate extern pid_t tcgetpgrp(int); 5367c478bd9Sstevel@tonic-gate extern int tcsetpgrp(int, pid_t); 5377c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || \ 5387c478bd9Sstevel@tonic-gate (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 5397c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 5407c478bd9Sstevel@tonic-gate extern off_t tell(int); 5417c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX)... */ 5427c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2) || \ 5437c478bd9Sstevel@tonic-gate (defined(_LARGEFILE_SOURCE) && _FILE_OFFSET_BITS == 64) || \ 5447c478bd9Sstevel@tonic-gate defined(__EXTENSIONS__) 5457c478bd9Sstevel@tonic-gate extern int truncate(const char *, off_t); 5467c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(_XPG4_2)... */ 5477c478bd9Sstevel@tonic-gate extern char *ttyname(int); 54808eb1913SGarrett D'Amore #if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS) 5497c478bd9Sstevel@tonic-gate extern useconds_t ualarm(useconds_t, useconds_t); 55008eb1913SGarrett D'Amore #endif 5517c478bd9Sstevel@tonic-gate extern int unlink(const char *); 55208eb1913SGarrett D'Amore #if (defined(_XPG4_2) && !defined(_XPG7)) || !defined(_STRICT_SYMBOLS) 553aaec9ca2SGarrett D'Amore extern char *getwd(char *); 5547c478bd9Sstevel@tonic-gate extern int usleep(useconds_t); 5556a3e8e86SRichard Lowe extern pid_t vfork(void) __RETURNS_TWICE; 556aaec9ca2SGarrett D'Amore #pragma unknown_control_flow(vfork) 557aaec9ca2SGarrett D'Amore #endif 5587c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 5597c478bd9Sstevel@tonic-gate extern void vhangup(void); 5607c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 5617c478bd9Sstevel@tonic-gate extern ssize_t write(int, const void *, size_t); 5627c478bd9Sstevel@tonic-gate #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 5637c478bd9Sstevel@tonic-gate extern void yield(void); 5647c478bd9Sstevel@tonic-gate #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 565794f0adbSRoger A. Faulkner 566b2b3ca14SSumanth Naropanth #if !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE) || \ 567b2b3ca14SSumanth Naropanth defined(__EXTENSIONS__) 568794f0adbSRoger A. Faulkner /* || defined(_XPG7) */ 569b2b3ca14SSumanth Naropanth extern int faccessat(int, const char *, int, int); 570794f0adbSRoger A. Faulkner extern int fchownat(int, const char *, uid_t, gid_t, int); 571794f0adbSRoger A. Faulkner extern int linkat(int, const char *, int, const char *, int); 572794f0adbSRoger A. Faulkner extern ssize_t readlinkat(int, const char *_RESTRICT_KYWD, 573794f0adbSRoger A. Faulkner char *_RESTRICT_KYWD, size_t); 574794f0adbSRoger A. Faulkner extern int renameat(int, const char *, int, const char *); 575794f0adbSRoger A. Faulkner extern int symlinkat(const char *, int, const char *); 576794f0adbSRoger A. Faulkner extern int unlinkat(int, const char *, int); 577b2b3ca14SSumanth Naropanth #endif /* !defined(__XOPEN_OR_POSIX) || defined(_ATFILE_SOURCE)... */ 57823a1cceaSRoger A. Faulkner #if !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) 57923a1cceaSRoger A. Faulkner extern int get_nprocs(void); 58023a1cceaSRoger A. Faulkner extern int get_nprocs_conf(void); 58123a1cceaSRoger A. Faulkner #endif /* !defined(__XOPEN_OR_POSIX) || defined(__EXTENSIONS__) */ 5827c478bd9Sstevel@tonic-gate 5837c478bd9Sstevel@tonic-gate /* transitional large file interface versions */ 5847c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \ 5857c478bd9Sstevel@tonic-gate !defined(__PRAGMA_REDEFINE_EXTNAME)) 5867c478bd9Sstevel@tonic-gate extern int ftruncate64(int, off64_t); 5877c478bd9Sstevel@tonic-gate extern off64_t lseek64(int, off64_t, int); 5887c478bd9Sstevel@tonic-gate extern ssize_t pread64(int, void *, size_t, off64_t); 5897c478bd9Sstevel@tonic-gate extern ssize_t pwrite64(int, const void *, size_t, off64_t); 5907c478bd9Sstevel@tonic-gate extern off64_t tell64(int); 5917c478bd9Sstevel@tonic-gate extern int truncate64(const char *, off64_t); 5927c478bd9Sstevel@tonic-gate extern int lockf64(int, int, off64_t); 5937c478bd9Sstevel@tonic-gate #endif /* _LARGEFILE64_SOURCE */ 5947c478bd9Sstevel@tonic-gate 5957c478bd9Sstevel@tonic-gate /* 5967c478bd9Sstevel@tonic-gate * getlogin_r() & ttyname_r() prototypes are defined here. 5977c478bd9Sstevel@tonic-gate */ 5987c478bd9Sstevel@tonic-gate 5997c478bd9Sstevel@tonic-gate /* 6007c478bd9Sstevel@tonic-gate * Previous releases of Solaris, starting at 2.3, provided definitions of 6017c478bd9Sstevel@tonic-gate * various functions as specified in POSIX.1c, Draft 6. For some of these 6027c478bd9Sstevel@tonic-gate * functions, the final POSIX 1003.1c standard had a different number of 6037c478bd9Sstevel@tonic-gate * arguments and return values. 6047c478bd9Sstevel@tonic-gate * 6057c478bd9Sstevel@tonic-gate * The following segment of this header provides support for the standard 6067c478bd9Sstevel@tonic-gate * interfaces while supporting applications written under earlier 6077c478bd9Sstevel@tonic-gate * releases. The application defines appropriate values of the feature 6087c478bd9Sstevel@tonic-gate * test macros _POSIX_C_SOURCE and _POSIX_PTHREAD_SEMANTICS to indicate 6097c478bd9Sstevel@tonic-gate * whether it was written to expect the Draft 6 or standard versions of 6107c478bd9Sstevel@tonic-gate * these interfaces, before including this header. This header then 6117c478bd9Sstevel@tonic-gate * provides a mapping from the source version of the interface to an 6127c478bd9Sstevel@tonic-gate * appropriate binary interface. Such mappings permit an application 6137c478bd9Sstevel@tonic-gate * to be built from libraries and objects which have mixed expectations 6147c478bd9Sstevel@tonic-gate * of the definitions of these functions. 6157c478bd9Sstevel@tonic-gate * 6167c478bd9Sstevel@tonic-gate * For applications using the Draft 6 definitions, the binary symbol is the 6177c478bd9Sstevel@tonic-gate * same as the source symbol, and no explicit mapping is needed. For the 6187c478bd9Sstevel@tonic-gate * standard interface, the function func() is mapped to the binary symbol 6197c478bd9Sstevel@tonic-gate * _posix_func(). The preferred mechanism for the remapping is a compiler 6207c478bd9Sstevel@tonic-gate * #pragma. If the compiler does not provide such a #pragma, the header file 6217c478bd9Sstevel@tonic-gate * defines a static function func() which calls the _posix_func() version; 6227c478bd9Sstevel@tonic-gate * this has to be done instead of #define since POSIX specifies that an 6237c478bd9Sstevel@tonic-gate * application can #undef the symbol and still be bound to the correct 6247c478bd9Sstevel@tonic-gate * implementation. Unfortunately, the statics confuse lint so we fallback to 6257c478bd9Sstevel@tonic-gate * #define in that case. 6267c478bd9Sstevel@tonic-gate * 6277c478bd9Sstevel@tonic-gate * NOTE: Support for the Draft 6 definitions is provided for compatibility 6287c478bd9Sstevel@tonic-gate * only. New applications/libraries should use the standard definitions. 6297c478bd9Sstevel@tonic-gate */ 6307c478bd9Sstevel@tonic-gate 6317c478bd9Sstevel@tonic-gate #if defined(__EXTENSIONS__) || defined(_REENTRANT) || \ 6327c478bd9Sstevel@tonic-gate !defined(__XOPEN_OR_POSIX) || (_POSIX_C_SOURCE - 0 >= 199506L) || \ 6337c478bd9Sstevel@tonic-gate defined(_POSIX_PTHREAD_SEMANTICS) 6347c478bd9Sstevel@tonic-gate 6357c478bd9Sstevel@tonic-gate #if (_POSIX_C_SOURCE - 0 >= 199506L) || defined(_POSIX_PTHREAD_SEMANTICS) 6367c478bd9Sstevel@tonic-gate 6370a1278f2SGary Mills #ifndef __USE_LEGACY_LOGNAME__ 6380a1278f2SGary Mills #ifdef __PRAGMA_REDEFINE_EXTNAME 6390a1278f2SGary Mills #pragma redefine_extname getlogin_r __posix_getloginx_r 6400a1278f2SGary Mills extern int getlogin_r(char *, int); 6410a1278f2SGary Mills #else /* __PRAGMA_REDEFINE_EXTNAME */ 6420a1278f2SGary Mills extern int __posix_getloginx_r(char *, int); 6430a1278f2SGary Mills #define getlogin_r __posix_getloginx_r 6440a1278f2SGary Mills #endif /* __PRAGMA_REDEFINE_EXTNAME */ 6450a1278f2SGary Mills #else /* __USE_LEGACY_LOGNAME__ */ 6467c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME 6477c478bd9Sstevel@tonic-gate #pragma redefine_extname getlogin_r __posix_getlogin_r 6487c478bd9Sstevel@tonic-gate extern int getlogin_r(char *, int); 6497c478bd9Sstevel@tonic-gate #else /* __PRAGMA_REDEFINE_EXTNAME */ 6507c478bd9Sstevel@tonic-gate extern int __posix_getlogin_r(char *, int); 6517c478bd9Sstevel@tonic-gate 6527c478bd9Sstevel@tonic-gate #ifdef __lint 6537c478bd9Sstevel@tonic-gate 6547c478bd9Sstevel@tonic-gate #define getlogin_r __posix_getlogin_r 6557c478bd9Sstevel@tonic-gate 6567c478bd9Sstevel@tonic-gate #else /* !__lint */ 6577c478bd9Sstevel@tonic-gate 6587c478bd9Sstevel@tonic-gate static int 6597c478bd9Sstevel@tonic-gate getlogin_r(char *__name, int __len) 6607c478bd9Sstevel@tonic-gate { 6617c478bd9Sstevel@tonic-gate return (__posix_getlogin_r(__name, __len)); 6627c478bd9Sstevel@tonic-gate } 6630a1278f2SGary Mills 6640a1278f2SGary Mills #endif /* !__lint */ 6650a1278f2SGary Mills #endif /* __PRAGMA_REDEFINE_EXTNAME */ 6660a1278f2SGary Mills #endif /* __USE_LEGACY_LOGNAME__ */ 6670a1278f2SGary Mills 6680a1278f2SGary Mills #ifdef __PRAGMA_REDEFINE_EXTNAME 6690a1278f2SGary Mills #pragma redefine_extname ttyname_r __posix_ttyname_r 6700a1278f2SGary Mills extern int ttyname_r(int, char *, size_t); 6710a1278f2SGary Mills #else /* __PRAGMA_REDEFINE_EXTNAME */ 6720a1278f2SGary Mills extern int __posix_ttyname_r(int, char *, size_t); 6730a1278f2SGary Mills 6740a1278f2SGary Mills #ifdef __lint 6750a1278f2SGary Mills 6760a1278f2SGary Mills #define ttyname_r __posix_ttyname_r 6770a1278f2SGary Mills 6780a1278f2SGary Mills #else /* !__lint */ 6790a1278f2SGary Mills 6807c478bd9Sstevel@tonic-gate static int 6817c478bd9Sstevel@tonic-gate ttyname_r(int __fildes, char *__buf, size_t __size) 6827c478bd9Sstevel@tonic-gate { 6837c478bd9Sstevel@tonic-gate return (__posix_ttyname_r(__fildes, __buf, __size)); 6847c478bd9Sstevel@tonic-gate } 6857c478bd9Sstevel@tonic-gate 6867c478bd9Sstevel@tonic-gate #endif /* !__lint */ 6877c478bd9Sstevel@tonic-gate #endif /* __PRAGMA_REDEFINE_EXTNAME */ 6887c478bd9Sstevel@tonic-gate 6897c478bd9Sstevel@tonic-gate #else /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 6907c478bd9Sstevel@tonic-gate 6910a1278f2SGary Mills #ifndef __USE_LEGACY_LOGNAME__ 6920a1278f2SGary Mills #ifdef __PRAGMA_REDEFINE_EXTNAME 6930a1278f2SGary Mills #pragma redefine_extname getlogin_r getloginx_r 6940a1278f2SGary Mills #else /* __PRAGMA_REDEFINE_EXTNAME */ 6950a1278f2SGary Mills extern char *getloginx_r(char *, int); 6960a1278f2SGary Mills #define getlogin_r getloginx_r 6970a1278f2SGary Mills #endif /* __PRAGMA_REDEFINE_EXTNAME */ 6980a1278f2SGary Mills #endif /* __USE_LEGACY_LOGNAME__ */ 6997c478bd9Sstevel@tonic-gate extern char *getlogin_r(char *, int); 7000a1278f2SGary Mills 7017c478bd9Sstevel@tonic-gate extern char *ttyname_r(int, char *, int); 7027c478bd9Sstevel@tonic-gate 7037c478bd9Sstevel@tonic-gate #endif /* (_POSIX_C_SOURCE - 0 >= 199506L) || ... */ 7047c478bd9Sstevel@tonic-gate 7057c478bd9Sstevel@tonic-gate #endif /* defined(__EXTENSIONS__) || defined(_REENTRANT)... */ 7067c478bd9Sstevel@tonic-gate 7079d12795fSRobert Mustacchi #if !defined(_STRICT_SYMBOLS) 7089d12795fSRobert Mustacchi extern int getentropy(void *, size_t); 7099d12795fSRobert Mustacchi #endif /* !_STRICT_SYMBOLS */ 7109d12795fSRobert Mustacchi 7117c478bd9Sstevel@tonic-gate #ifdef __cplusplus 7127c478bd9Sstevel@tonic-gate } 7137c478bd9Sstevel@tonic-gate #endif 7147c478bd9Sstevel@tonic-gate 7157c478bd9Sstevel@tonic-gate #endif /* _UNISTD_H */ 716