xref: /titanic_50/usr/src/lib/libbc/inc/include/unistd.h (revision 554ff184129088135ad2643c1c9832174a17be88)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright (c) 2001 by Sun Microsystems, Inc.
24  * All rights reserved.
25  */
26 
27 /*      Copyright (c) 1984 AT&T */
28 /*        All Rights Reserved   */
29 
30 /*	from S5R3 1.5 */
31 
32 #ifndef	_BC_SYS_UNISTD_H
33 #define	_BC_SYS_UNISTD_H
34 
35 #pragma ident	"%Z%%M%	%I%	%E% SMI"
36 
37 #ifdef	__cplusplus
38 extern "C" {
39 #endif
40 
41 /* WARNING: _SC_CLK_TCK and sysconf() are also defined/declared in <time.h>. */
42 #define	_SC_ARG_MAX		1	/* space for argv & envp */
43 #define	_SC_CHILD_MAX		2	/* maximum children per process??? */
44 #define	_SC_CLK_TCK		3	/* clock ticks/sec */
45 #define	_SC_NGROUPS_MAX		4	/* number of groups if multple supp. */
46 #define	_SC_OPEN_MAX		5	/* max open files per process */
47 #define	_SC_JOB_CONTROL		6	/* do we have job control */
48 #define	_SC_SAVED_IDS		7	/* do we have saved uid/gids */
49 #define	_SC_VERSION		8	/* POSIX version supported */
50 
51 #define	_POSIX_JOB_CONTROL	1
52 #define	_POSIX_SAVED_IDS	1
53 #define	_POSIX_VERSION		198808
54 
55 #define	_PC_LINK_MAX		1	/* max links to file/dir */
56 #define	_PC_MAX_CANON		2	/* max line length */
57 #define	_PC_MAX_INPUT		3	/* max "packet" to a tty device */
58 #define	_PC_NAME_MAX		4	/* max pathname component length */
59 #define	_PC_PATH_MAX		5	/* max pathname length */
60 #define	_PC_PIPE_BUF		6	/* size of a pipe */
61 #define	_PC_CHOWN_RESTRICTED	7	/* can we give away files */
62 #define	_PC_NO_TRUNC		8	/* trunc or error on >NAME_MAX */
63 #define	_PC_VDISABLE		9	/* best char to shut off tty c_cc */
64 #define	_PC_LAST		9	/* highest value of any _PC_* */
65 
66 #define	STDIN_FILENO	0
67 #define	STDOUT_FILENO	1
68 #define	STDERR_FILENO	2
69 
70 #ifndef NULL
71 #define	NULL	0
72 #endif
73 
74 #ifndef	_POSIX_SOURCE
75 /*
76  * SVID lockf() requests
77  */
78 #define	F_ULOCK		0	/* Unlock a previously locked region */
79 #define	F_LOCK		1	/* Lock a region for exclusive use */
80 #define	F_TLOCK		2	/* Test and lock a region for exclusive use */
81 #define	F_TEST		3	/* Test a region for other processes locks */
82 
83 /* Path names: */
84 #define	GF_PATH			"/etc/group"
85 #define	PF_PATH			"/etc/passwd"
86 
87 #endif	/* !_POSIX_SOURCE */
88 
89 /*
90  * lseek & access args
91  *
92  * SEEK_* have to track L_* in sys/file.h & SEEK_* in 5include/stdio.h
93  * ?_OK have to track ?_OK in sys/file.h
94  */
95 #ifndef SEEK_SET
96 #define	SEEK_SET	0	/* Set file pointer to "offset" */
97 #define	SEEK_CUR	1	/* Set file pointer to current plus "offset" */
98 #define	SEEK_END	2	/* Set file pointer to EOF plus "offset" */
99 #endif
100 
101 #define	F_OK		0	/* does file exist */
102 #define	X_OK		1	/* is it executable by caller */
103 #define	W_OK		2	/* is it writable by caller */
104 #define	R_OK		4	/* is it readable by caller */
105 
106 #if	!defined(KERNEL)
107 #include <sys/types.h>
108 
109 extern void	_exit(/* int status */);
110 extern int	access(/* char *path, int amode */);
111 extern unsigned	alarm(/* unsigned secs */);
112 extern int	chdir(/* char *path */);
113 extern int	chmod(/* char *path, mode_t mode */);
114 extern int	chown(/* char *path, uid_t owner, gid_t group */);
115 extern int	close(/* int fildes */);
116 extern char	*ctermid(/* char *s */);
117 extern char	*cuserid(/* char *s */);
118 extern int	dup(/* int fildes */);
119 extern int	dup2(/* int fildes, int fildes2 */);
120 extern int	execl(/* char *path, ... */);
121 extern int	execle(/* char *path, ... */);
122 extern int	execlp(/* char *file, ... */);
123 extern int	execv(/* char *path, char *argv[] */);
124 extern int	execve(/* char *path, char *argv[], char *envp[] */);
125 extern int	execvp(/* char *file, char *argv[] */);
126 extern pid_t	fork(/* void */);
127 extern long	fpathconf(/* int fd, int name */);
128 extern char	*getcwd(/* char *buf, int size */);
129 extern gid_t	getegid(/* void */);
130 extern uid_t	geteuid(/* void */);
131 extern gid_t	getgid(/* void */);
132 extern int	getgroups(/* int gidsetsize, gid_t grouplist[] */);
133 extern char	*getlogin(/* void */);
134 extern pid_t	getpgrp(/* void */);
135 extern pid_t	getpid(/* void */);
136 extern pid_t	getppid(/* void */);
137 extern uid_t	getuid(/* void */);
138 extern int	isatty(/* int fildes */);
139 extern int	link(/* char *path1, char *path2 */);
140 extern off_t	lseek(/* int fildes, off_t offset, int whence */);
141 extern long	pathconf(/* char *path, int name */);
142 extern int	pause(/* void */);
143 extern int	pipe(/* int fildes[2] */);
144 extern int	read(/* int fildes, char *buf, unsigned int nbyte */);
145 extern int	rmdir(/* char *path */);
146 extern int	setgid(/* gid_t gid */);
147 extern int	setpgid(/* pid_t pid, pid_t pgid */);
148 extern pid_t	setsid(/* void */);
149 extern int	setuid(/* uid_t uid */);
150 extern unsigned	sleep(/* unsigned int seconds */);
151 extern long	sysconf(/* int name */);
152 extern pid_t	tcgetpgrp(/* int fildes */);
153 extern int	tcsetpgrp(/* int fildes, pid_t pgrp_id */);
154 extern char	*ttyname(/* int fildes */);
155 extern int	unlink(/* char *path */);
156 extern int	write(/* int fildes, char *buf, unsigned int nbyte */);
157 
158 #endif	/* !KERNEL */
159 
160 #ifdef	__cplusplus
161 }
162 #endif
163 
164 #endif	/* _BC_SYS_UNISTD_H */
165