xref: /illumos-gate/usr/src/ucbhead/unistd.h (revision 4870e0a7)
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
57c478bd9Sstevel@tonic-gate  * Common Development and Distribution License, Version 1.0 only
67c478bd9Sstevel@tonic-gate  * (the "License").  You may not use this file except in compliance
77c478bd9Sstevel@tonic-gate  * with the License.
87c478bd9Sstevel@tonic-gate  *
97c478bd9Sstevel@tonic-gate  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
107c478bd9Sstevel@tonic-gate  * or http://www.opensolaris.org/os/licensing.
117c478bd9Sstevel@tonic-gate  * See the License for the specific language governing permissions
127c478bd9Sstevel@tonic-gate  * and limitations under the License.
137c478bd9Sstevel@tonic-gate  *
147c478bd9Sstevel@tonic-gate  * When distributing Covered Code, include this CDDL HEADER in each
157c478bd9Sstevel@tonic-gate  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
167c478bd9Sstevel@tonic-gate  * If applicable, add the following below this CDDL HEADER, with the
177c478bd9Sstevel@tonic-gate  * fields enclosed by brackets "[]" replaced with your own identifying
187c478bd9Sstevel@tonic-gate  * information: Portions Copyright [yyyy] [name of copyright owner]
197c478bd9Sstevel@tonic-gate  *
207c478bd9Sstevel@tonic-gate  * CDDL HEADER END
217c478bd9Sstevel@tonic-gate  */
227c478bd9Sstevel@tonic-gate /*
237c478bd9Sstevel@tonic-gate  * Copyright 1997 Sun Microsystems, Inc.  All rights reserved.
247c478bd9Sstevel@tonic-gate  * Use is subject to license terms.
257c478bd9Sstevel@tonic-gate  */
267c478bd9Sstevel@tonic-gate 
277c478bd9Sstevel@tonic-gate /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
287c478bd9Sstevel@tonic-gate /*	  All Rights Reserved  	*/
297c478bd9Sstevel@tonic-gate 
307c478bd9Sstevel@tonic-gate /*
317c478bd9Sstevel@tonic-gate  * University Copyright- Copyright (c) 1982, 1986, 1988
327c478bd9Sstevel@tonic-gate  * The Regents of the University of California
337c478bd9Sstevel@tonic-gate  * All Rights Reserved
347c478bd9Sstevel@tonic-gate  *
357c478bd9Sstevel@tonic-gate  * University Acknowledgment- Portions of this document are derived from
367c478bd9Sstevel@tonic-gate  * software developed by the University of California, Berkeley, and its
377c478bd9Sstevel@tonic-gate  * contributors.
387c478bd9Sstevel@tonic-gate  */
397c478bd9Sstevel@tonic-gate 
407c478bd9Sstevel@tonic-gate #ifndef _UNISTD_H
417c478bd9Sstevel@tonic-gate #define	_UNISTD_H
427c478bd9Sstevel@tonic-gate 
437c478bd9Sstevel@tonic-gate #include <sys/fcntl.h>
44*4870e0a7SRichard PALO #include <sys/null.h>
457c478bd9Sstevel@tonic-gate 
467c478bd9Sstevel@tonic-gate #ifdef __cplusplus
477c478bd9Sstevel@tonic-gate extern "C" {
487c478bd9Sstevel@tonic-gate #endif
497c478bd9Sstevel@tonic-gate 
507c478bd9Sstevel@tonic-gate /* Symbolic constants for the "access" routine: */
517c478bd9Sstevel@tonic-gate #define	R_OK	4	/* Test for Read permission */
527c478bd9Sstevel@tonic-gate #define	W_OK	2	/* Test for Write permission */
537c478bd9Sstevel@tonic-gate #define	X_OK	1	/* Test for eXecute permission */
547c478bd9Sstevel@tonic-gate #define	F_OK	0	/* Test for existence of File */
557c478bd9Sstevel@tonic-gate 
567c478bd9Sstevel@tonic-gate #define	F_ULOCK	0	/* Unlock a previously locked region */
577c478bd9Sstevel@tonic-gate #define	F_LOCK	1	/* Lock a region for exclusive use */
587c478bd9Sstevel@tonic-gate #define	F_TLOCK	2	/* Test and lock a region for exclusive use */
597c478bd9Sstevel@tonic-gate #define	F_TEST	3	/* Test a region for other processes locks */
607c478bd9Sstevel@tonic-gate 
617c478bd9Sstevel@tonic-gate 
627c478bd9Sstevel@tonic-gate /* Symbolic constants for the "lseek" routine: */
637c478bd9Sstevel@tonic-gate #define	SEEK_SET	0	/* Set file pointer to "offset" */
647c478bd9Sstevel@tonic-gate #define	SEEK_CUR	1	/* Set file pointer to current plus "offset" */
657c478bd9Sstevel@tonic-gate #define	SEEK_END	2	/* Set file pointer to EOF plus "offset" */
667c478bd9Sstevel@tonic-gate 
677c478bd9Sstevel@tonic-gate /* Path names: */
687c478bd9Sstevel@tonic-gate #define	GF_PATH	"/etc/group"	/* Path name of the "group" file */
697c478bd9Sstevel@tonic-gate #define	PF_PATH	"/etc/passwd"	/* Path name of the "passwd" file */
707c478bd9Sstevel@tonic-gate 
717c478bd9Sstevel@tonic-gate 
727c478bd9Sstevel@tonic-gate /* command names for POSIX sysconf */
737c478bd9Sstevel@tonic-gate #define	_SC_ARG_MAX	1
747c478bd9Sstevel@tonic-gate #define	_SC_CHILD_MAX	2
757c478bd9Sstevel@tonic-gate #define	_SC_CLK_TCK	3
767c478bd9Sstevel@tonic-gate #define	_SC_NGROUPS_MAX 4
777c478bd9Sstevel@tonic-gate #define	_SC_OPEN_MAX	5
787c478bd9Sstevel@tonic-gate #define	_SC_JOB_CONTROL	6
797c478bd9Sstevel@tonic-gate #define	_SC_SAVED_IDS	7
807c478bd9Sstevel@tonic-gate #define	_SC_VERSION	8
817c478bd9Sstevel@tonic-gate #define	_SC_PASS_MAX	9
827c478bd9Sstevel@tonic-gate #define	_SC_LOGNAME_MAX	10
837c478bd9Sstevel@tonic-gate #define	_SC_PAGESIZE	11
847c478bd9Sstevel@tonic-gate #define	_SC_XOPEN_VERSION	12
857c478bd9Sstevel@tonic-gate /* 13 reserved for SVr4-ES/MP _SC_NACLS_MAX */
867c478bd9Sstevel@tonic-gate /* 14 reserved for SVr4-ES/MP _SC_NPROC_CONF */
877c478bd9Sstevel@tonic-gate /* 15 reserved for SVr4-ES/MP _SC_NPROC_ONLN */
887c478bd9Sstevel@tonic-gate #define	_SC_STREAM_MAX	16
897c478bd9Sstevel@tonic-gate #define	_SC_TZNAME_MAX	17
907c478bd9Sstevel@tonic-gate 
917c478bd9Sstevel@tonic-gate /* command names for POSIX pathconf */
927c478bd9Sstevel@tonic-gate 
937c478bd9Sstevel@tonic-gate #define	_PC_LINK_MAX	1
947c478bd9Sstevel@tonic-gate #define	_PC_MAX_CANON	2
957c478bd9Sstevel@tonic-gate #define	_PC_MAX_INPUT	3
967c478bd9Sstevel@tonic-gate #define	_PC_NAME_MAX	4
977c478bd9Sstevel@tonic-gate #define	_PC_PATH_MAX	5
987c478bd9Sstevel@tonic-gate #define	_PC_PIPE_BUF	6
997c478bd9Sstevel@tonic-gate #define	_PC_NO_TRUNC	7
1007c478bd9Sstevel@tonic-gate #define	_PC_VDISABLE	8
1017c478bd9Sstevel@tonic-gate #define	_PC_CHOWN_RESTRICTED	9
1027c478bd9Sstevel@tonic-gate #define	_PC_LAST	9
1037c478bd9Sstevel@tonic-gate 
1047c478bd9Sstevel@tonic-gate /*
1057c478bd9Sstevel@tonic-gate  * compile-time symbolic constants,
1067c478bd9Sstevel@tonic-gate  * Support does not mean the feature is enabled.
1077c478bd9Sstevel@tonic-gate  * Use pathconf/sysconf to obtain actual configuration value.
1087c478bd9Sstevel@tonic-gate  */
1097c478bd9Sstevel@tonic-gate 
1107c478bd9Sstevel@tonic-gate #define	_POSIX_JOB_CONTROL	1
1117c478bd9Sstevel@tonic-gate #define	_POSIX_SAVED_IDS	1
1127c478bd9Sstevel@tonic-gate 
1137c478bd9Sstevel@tonic-gate #ifndef _POSIX_VDISABLE
1147c478bd9Sstevel@tonic-gate #define	_POSIX_VDISABLE		0
1157c478bd9Sstevel@tonic-gate #endif
1167c478bd9Sstevel@tonic-gate 
1177c478bd9Sstevel@tonic-gate #define	STDIN_FILENO	0
1187c478bd9Sstevel@tonic-gate #define	STDOUT_FILENO	1
1197c478bd9Sstevel@tonic-gate #define	STDERR_FILENO	2
1207c478bd9Sstevel@tonic-gate 
1217c478bd9Sstevel@tonic-gate /* Current version of POSIX */
1227c478bd9Sstevel@tonic-gate #define	_POSIX_VERSION		199009L
1237c478bd9Sstevel@tonic-gate 
1247c478bd9Sstevel@tonic-gate /* large file compilation environment setup */
1257c478bd9Sstevel@tonic-gate #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
1267c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
1277c478bd9Sstevel@tonic-gate #pragma	redefine_extname	lseek	lseek64
1287c478bd9Sstevel@tonic-gate #else
1297c478bd9Sstevel@tonic-gate #define	lseek			lseek64
1307c478bd9Sstevel@tonic-gate #endif
1317c478bd9Sstevel@tonic-gate #endif  /* !_LP64 && _FILE_OFFSET_BITS == 64 */
1327c478bd9Sstevel@tonic-gate 
1337c478bd9Sstevel@tonic-gate #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
1347c478bd9Sstevel@tonic-gate #ifdef __PRAGMA_REDEFINE_EXTNAME
1357c478bd9Sstevel@tonic-gate #pragma	redefine_extname	lseek64	lseek
1367c478bd9Sstevel@tonic-gate #else
1377c478bd9Sstevel@tonic-gate #define	lseek64			lseek
1387c478bd9Sstevel@tonic-gate #endif
1397c478bd9Sstevel@tonic-gate #endif  /* _LP64 && _LARGEFILE64_SOURCE */
1407c478bd9Sstevel@tonic-gate 
1417c478bd9Sstevel@tonic-gate #if defined(__STDC__)
1427c478bd9Sstevel@tonic-gate extern pid_t getpid(void);
1437c478bd9Sstevel@tonic-gate extern pid_t getppid(void);
1447c478bd9Sstevel@tonic-gate extern pid_t getpgrp(void);
1457c478bd9Sstevel@tonic-gate extern uid_t getuid(void);
1467c478bd9Sstevel@tonic-gate extern int setpgid(pid_t, pid_t);
1477c478bd9Sstevel@tonic-gate extern int setpgrp(pid_t, pid_t);	/* BSD */
1487c478bd9Sstevel@tonic-gate 
1497c478bd9Sstevel@tonic-gate extern int stime(const time_t *);
1507c478bd9Sstevel@tonic-gate 
1517c478bd9Sstevel@tonic-gate extern long pathconf(const char *, int);
1527c478bd9Sstevel@tonic-gate extern long sysconf(int);
1537c478bd9Sstevel@tonic-gate 
1547c478bd9Sstevel@tonic-gate extern char *getwd(char *);
1557c478bd9Sstevel@tonic-gate extern long gethostid(void);
1567c478bd9Sstevel@tonic-gate 
1577c478bd9Sstevel@tonic-gate extern ssize_t read(int, void *, size_t);
1587c478bd9Sstevel@tonic-gate extern ssize_t write(int, const void *, size_t);
1597c478bd9Sstevel@tonic-gate extern int ioctl(int, int, ...);
1607c478bd9Sstevel@tonic-gate extern int close(int);
1617c478bd9Sstevel@tonic-gate extern off_t lseek(int, off_t, int);
1627c478bd9Sstevel@tonic-gate #else
1637c478bd9Sstevel@tonic-gate extern off_t lseek();
1647c478bd9Sstevel@tonic-gate #endif
1657c478bd9Sstevel@tonic-gate 
1667c478bd9Sstevel@tonic-gate #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
1677c478bd9Sstevel@tonic-gate 	!defined(__PRAGMA_REDEFINE_EXTNAME))
1687c478bd9Sstevel@tonic-gate #if defined(__STDC__)
1697c478bd9Sstevel@tonic-gate extern off64_t lseek64(int, off64_t, int);
1707c478bd9Sstevel@tonic-gate #else
1717c478bd9Sstevel@tonic-gate extern off64_t lseek64();
1727c478bd9Sstevel@tonic-gate #endif
1737c478bd9Sstevel@tonic-gate #endif  /* _LARGEFILE64_SOURCE... */
1747c478bd9Sstevel@tonic-gate 
1757c478bd9Sstevel@tonic-gate #ifdef __cplusplus
1767c478bd9Sstevel@tonic-gate }
1777c478bd9Sstevel@tonic-gate #endif
1787c478bd9Sstevel@tonic-gate 
1797c478bd9Sstevel@tonic-gate #endif	/* _UNISTD_H */
180