Home | History | Annotate | Download | only in ucbhead
      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 1997 Sun Microsystems, Inc.  All rights reserved.
     24  * Use is subject to license terms.
     25  */
     26 
     27 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
     28 /*	  All Rights Reserved  	*/
     29 
     30 /*
     31  * University Copyright- Copyright (c) 1982, 1986, 1988
     32  * The Regents of the University of California
     33  * All Rights Reserved
     34  *
     35  * University Acknowledgment- Portions of this document are derived from
     36  * software developed by the University of California, Berkeley, and its
     37  * contributors.
     38  */
     39 
     40 #ifndef _UNISTD_H
     41 #define	_UNISTD_H
     42 
     43 #pragma ident	"%Z%%M%	%I%	%E% SMI"
     44 
     45 #include <sys/fcntl.h>
     46 
     47 #ifdef __cplusplus
     48 extern "C" {
     49 #endif
     50 
     51 /* Symbolic constants for the "access" routine: */
     52 #define	R_OK	4	/* Test for Read permission */
     53 #define	W_OK	2	/* Test for Write permission */
     54 #define	X_OK	1	/* Test for eXecute permission */
     55 #define	F_OK	0	/* Test for existence of File */
     56 
     57 #define	F_ULOCK	0	/* Unlock a previously locked region */
     58 #define	F_LOCK	1	/* Lock a region for exclusive use */
     59 #define	F_TLOCK	2	/* Test and lock a region for exclusive use */
     60 #define	F_TEST	3	/* Test a region for other processes locks */
     61 
     62 
     63 /* Symbolic constants for the "lseek" routine: */
     64 #define	SEEK_SET	0	/* Set file pointer to "offset" */
     65 #define	SEEK_CUR	1	/* Set file pointer to current plus "offset" */
     66 #define	SEEK_END	2	/* Set file pointer to EOF plus "offset" */
     67 
     68 /* Path names: */
     69 #define	GF_PATH	"/etc/group"	/* Path name of the "group" file */
     70 #define	PF_PATH	"/etc/passwd"	/* Path name of the "passwd" file */
     71 
     72 
     73 /* command names for POSIX sysconf */
     74 #define	_SC_ARG_MAX	1
     75 #define	_SC_CHILD_MAX	2
     76 #define	_SC_CLK_TCK	3
     77 #define	_SC_NGROUPS_MAX 4
     78 #define	_SC_OPEN_MAX	5
     79 #define	_SC_JOB_CONTROL	6
     80 #define	_SC_SAVED_IDS	7
     81 #define	_SC_VERSION	8
     82 #define	_SC_PASS_MAX	9
     83 #define	_SC_LOGNAME_MAX	10
     84 #define	_SC_PAGESIZE	11
     85 #define	_SC_XOPEN_VERSION	12
     86 /* 13 reserved for SVr4-ES/MP _SC_NACLS_MAX */
     87 /* 14 reserved for SVr4-ES/MP _SC_NPROC_CONF */
     88 /* 15 reserved for SVr4-ES/MP _SC_NPROC_ONLN */
     89 #define	_SC_STREAM_MAX	16
     90 #define	_SC_TZNAME_MAX	17
     91 
     92 /* command names for POSIX pathconf */
     93 
     94 #define	_PC_LINK_MAX	1
     95 #define	_PC_MAX_CANON	2
     96 #define	_PC_MAX_INPUT	3
     97 #define	_PC_NAME_MAX	4
     98 #define	_PC_PATH_MAX	5
     99 #define	_PC_PIPE_BUF	6
    100 #define	_PC_NO_TRUNC	7
    101 #define	_PC_VDISABLE	8
    102 #define	_PC_CHOWN_RESTRICTED	9
    103 #define	_PC_LAST	9
    104 
    105 /*
    106  * compile-time symbolic constants,
    107  * Support does not mean the feature is enabled.
    108  * Use pathconf/sysconf to obtain actual configuration value.
    109  */
    110 
    111 #define	_POSIX_JOB_CONTROL	1
    112 #define	_POSIX_SAVED_IDS	1
    113 
    114 #ifndef _POSIX_VDISABLE
    115 #define	_POSIX_VDISABLE		0
    116 #endif
    117 
    118 #define	STDIN_FILENO	0
    119 #define	STDOUT_FILENO	1
    120 #define	STDERR_FILENO	2
    121 
    122 /* Current version of POSIX */
    123 #define	_POSIX_VERSION		199009L
    124 
    125 /* large file compilation environment setup */
    126 #if !defined(_LP64) && _FILE_OFFSET_BITS == 64
    127 #ifdef __PRAGMA_REDEFINE_EXTNAME
    128 #pragma	redefine_extname	lseek	lseek64
    129 #else
    130 #define	lseek			lseek64
    131 #endif
    132 #endif  /* !_LP64 && _FILE_OFFSET_BITS == 64 */
    133 
    134 #if defined(_LP64) && defined(_LARGEFILE64_SOURCE)
    135 #ifdef __PRAGMA_REDEFINE_EXTNAME
    136 #pragma	redefine_extname	lseek64	lseek
    137 #else
    138 #define	lseek64			lseek
    139 #endif
    140 #endif  /* _LP64 && _LARGEFILE64_SOURCE */
    141 
    142 #if defined(__STDC__)
    143 extern pid_t getpid(void);
    144 extern pid_t getppid(void);
    145 extern pid_t getpgrp(void);
    146 extern uid_t getuid(void);
    147 extern int setpgid(pid_t, pid_t);
    148 extern int setpgrp(pid_t, pid_t);	/* BSD */
    149 
    150 extern int stime(const time_t *);
    151 
    152 extern long pathconf(const char *, int);
    153 extern long sysconf(int);
    154 
    155 extern char *getwd(char *);
    156 extern long gethostid(void);
    157 
    158 extern ssize_t read(int, void *, size_t);
    159 extern ssize_t write(int, const void *, size_t);
    160 extern int ioctl(int, int, ...);
    161 extern int close(int);
    162 extern off_t lseek(int, off_t, int);
    163 #else
    164 extern off_t lseek();
    165 #endif
    166 
    167 #if defined(_LARGEFILE64_SOURCE) && !((_FILE_OFFSET_BITS == 64) && \
    168 	!defined(__PRAGMA_REDEFINE_EXTNAME))
    169 #if defined(__STDC__)
    170 extern off64_t lseek64(int, off64_t, int);
    171 #else
    172 extern off64_t lseek64();
    173 #endif
    174 #endif  /* _LARGEFILE64_SOURCE... */
    175 
    176 #ifdef __cplusplus
    177 }
    178 #endif
    179 
    180 #endif	/* _UNISTD_H */
    181