diff options
| author | Peter Wemm <peter@FreeBSD.org> | 1997-03-11 11:11:37 +0000 | 
|---|---|---|
| committer | Peter Wemm <peter@FreeBSD.org> | 1997-03-11 11:11:37 +0000 | 
| commit | dee7a427ff9a7698892f2627df934be0b0d0432c (patch) | |
| tree | ab5fe7271de813c0c70b40d4203685150503fe44 | |
| parent | 92e2d9bed536c5164d2d359adb7bd710d725d343 (diff) | |
Notes
| -rw-r--r-- | include/dirent.h | 102 | ||||
| -rw-r--r-- | include/fts.h | 128 | ||||
| -rw-r--r-- | include/mpool.h | 135 | ||||
| -rw-r--r-- | include/stdio.h | 378 | ||||
| -rw-r--r-- | include/stdlib.h | 168 | ||||
| -rw-r--r-- | include/tzfile.h | 151 | ||||
| -rw-r--r-- | include/unistd.h | 183 | 
7 files changed, 1245 insertions, 0 deletions
| diff --git a/include/dirent.h b/include/dirent.h new file mode 100644 index 000000000000..fa0fbc92ebda --- /dev/null +++ b/include/dirent.h @@ -0,0 +1,102 @@ +/*- + * Copyright (c) 1989, 1993 + *	The Regents of the University of California.  All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *    must display the following acknowledgement: + *	This product includes software developed by the University of + *	California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + *	@(#)dirent.h	8.2 (Berkeley) 7/28/94 + */ + +#ifndef _DIRENT_H_ +#define _DIRENT_H_ + +/* + * The kernel defines the format of directory entries returned by  + * the getdirentries(2) system call. + */ +#include <sys/dirent.h> + +#ifdef _POSIX_SOURCE +typedef void *	DIR; +#else + +#define	d_ino		d_fileno	/* backward compatibility */ + +/* definitions for library routines operating on directories. */ +#define	DIRBLKSIZ	1024 + +/* structure describing an open directory. */ +typedef struct _dirdesc { +	int	dd_fd;		/* file descriptor associated with directory */ +	long	dd_loc;		/* offset in current buffer */ +	long	dd_size;	/* amount of data returned by getdirentries */ +	char	*dd_buf;	/* data buffer */ +	int	dd_len;		/* size of data buffer */ +	long	dd_seek;	/* magic cookie returned by getdirentries */ +	long	dd_rewind;	/* magic cookie for rewinding */ +	int	dd_flags;	/* flags for readdir */ +} DIR; + +#define	dirfd(dirp)	((dirp)->dd_fd) + +/* flags for opendir2 */ +#define DTF_HIDEW	0x0001	/* hide whiteout entries */ +#define DTF_NODUP	0x0002	/* don't return duplicate names */ +#define DTF_REWIND	0x0004	/* rewind after reading union stack */ +#define __DTF_READALL	0x0008	/* everything has been read */ + +#ifndef NULL +#define	NULL	0 +#endif + +#endif /* _POSIX_SOURCE */ + +#ifndef KERNEL + +#include <sys/cdefs.h> + +__BEGIN_DECLS +DIR *opendir __P((const char *)); +struct dirent *readdir __P((DIR *)); +void rewinddir __P((DIR *)); +int closedir __P((DIR *)); +#ifndef _POSIX_SOURCE +DIR *__opendir2 __P((const char *, int)); +long telldir __P((const DIR *)); +void seekdir __P((DIR *, long)); +int scandir __P((const char *, struct dirent ***, +    int (*)(struct dirent *), int (*)(const void *, const void *))); +int alphasort __P((const void *, const void *)); +int getdirentries __P((int, char *, int, long *)); +#endif /* not POSIX */ +__END_DECLS + +#endif /* !KERNEL */ + +#endif /* !_DIRENT_H_ */ diff --git a/include/fts.h b/include/fts.h new file mode 100644 index 000000000000..4fa4a3aa0ded --- /dev/null +++ b/include/fts.h @@ -0,0 +1,128 @@ +/* + * Copyright (c) 1989, 1993 + *	The Regents of the University of California.  All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *    must display the following acknowledgement: + *	This product includes software developed by the University of + *	California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + *	@(#)fts.h	8.3 (Berkeley) 8/14/94 + */ + +#ifndef	_FTS_H_ +#define	_FTS_H_ + +typedef struct { +	struct _ftsent *fts_cur;	/* current node */ +	struct _ftsent *fts_child;	/* linked list of children */ +	struct _ftsent **fts_array;	/* sort array */ +	dev_t fts_dev;			/* starting device # */ +	char *fts_path;			/* path for this descent */ +	int fts_rfd;			/* fd for root */ +	int fts_pathlen;		/* sizeof(path) */ +	int fts_nitems;			/* elements in the sort array */ +	int (*fts_compar)();		/* compare function */ + +#define	FTS_COMFOLLOW	0x001		/* follow command line symlinks */ +#define	FTS_LOGICAL	0x002		/* logical walk */ +#define	FTS_NOCHDIR	0x004		/* don't change directories */ +#define	FTS_NOSTAT	0x008		/* don't get stat info */ +#define	FTS_PHYSICAL	0x010		/* physical walk */ +#define	FTS_SEEDOT	0x020		/* return dot and dot-dot */ +#define	FTS_XDEV	0x040		/* don't cross devices */ +#define	FTS_WHITEOUT	0x080		/* return whiteout information */ +#define	FTS_OPTIONMASK	0x0ff		/* valid user option mask */ + +#define	FTS_NAMEONLY	0x100		/* (private) child names only */ +#define	FTS_STOP	0x200		/* (private) unrecoverable error */ +	int fts_options;		/* fts_open options, global flags */ +} FTS; + +typedef struct _ftsent { +	struct _ftsent *fts_cycle;	/* cycle node */ +	struct _ftsent *fts_parent;	/* parent directory */ +	struct _ftsent *fts_link;	/* next file in directory */ +	long fts_number;	        /* local numeric value */ +	void *fts_pointer;	        /* local address value */ +	char *fts_accpath;		/* access path */ +	char *fts_path;			/* root path */ +	int fts_errno;			/* errno for this node */ +	int fts_symfd;			/* fd for symlink */ +	u_short fts_pathlen;		/* strlen(fts_path) */ +	u_short fts_namelen;		/* strlen(fts_name) */ + +	ino_t fts_ino;			/* inode */ +	dev_t fts_dev;			/* device */ +	nlink_t fts_nlink;		/* link count */ + +#define	FTS_ROOTPARENTLEVEL	-1 +#define	FTS_ROOTLEVEL		 0 +	short fts_level;		/* depth (-1 to N) */ + +#define	FTS_D		 1		/* preorder directory */ +#define	FTS_DC		 2		/* directory that causes cycles */ +#define	FTS_DEFAULT	 3		/* none of the above */ +#define	FTS_DNR		 4		/* unreadable directory */ +#define	FTS_DOT		 5		/* dot or dot-dot */ +#define	FTS_DP		 6		/* postorder directory */ +#define	FTS_ERR		 7		/* error; errno is set */ +#define	FTS_F		 8		/* regular file */ +#define	FTS_INIT	 9		/* initialized only */ +#define	FTS_NS		10		/* stat(2) failed */ +#define	FTS_NSOK	11		/* no stat(2) requested */ +#define	FTS_SL		12		/* symbolic link */ +#define	FTS_SLNONE	13		/* symbolic link without target */ +#define	FTS_W		14		/* whiteout object */ +	u_short fts_info;		/* user flags for FTSENT structure */ + +#define	FTS_DONTCHDIR	 0x01		/* don't chdir .. to the parent */ +#define	FTS_SYMFOLLOW	 0x02		/* followed a symlink to get here */ +#define	FTS_ISW		 0x04		/* this is a whiteout object */ +	u_short fts_flags;		/* private flags for FTSENT structure */ + +#define	FTS_AGAIN	 1		/* read node again */ +#define	FTS_FOLLOW	 2		/* follow symbolic link */ +#define	FTS_NOINSTR	 3		/* no instructions */ +#define	FTS_SKIP	 4		/* discard node */ +	u_short fts_instr;		/* fts_set() instructions */ + +	struct stat *fts_statp;		/* stat(2) information */ +	char fts_name[1];		/* file name */ +} FTSENT; + +#include <sys/cdefs.h> + +__BEGIN_DECLS +FTSENT	*fts_children __P((FTS *, int)); +int	 fts_close __P((FTS *)); +FTS	*fts_open __P((char * const *, int, +	    int (*)(const FTSENT **, const FTSENT **))); +FTSENT	*fts_read __P((FTS *)); +int	 fts_set __P((FTS *, FTSENT *, int)); +__END_DECLS + +#endif /* !_FTS_H_ */ diff --git a/include/mpool.h b/include/mpool.h new file mode 100644 index 000000000000..910e0782aa9d --- /dev/null +++ b/include/mpool.h @@ -0,0 +1,135 @@ +/*- + * Copyright (c) 1991, 1993 + *	The Regents of the University of California.  All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *    must display the following acknowledgement: + *	This product includes software developed by the University of + *	California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + *	@(#)mpool.h	8.1 (Berkeley) 6/2/93 + */ + +/* + * The memory pool scheme is a simple one.  Each in memory page is referenced + * by a bucket which is threaded in three ways.  All active pages are threaded + * on a hash chain (hashed by the page number) and an lru chain.  Inactive + * pages are threaded on a free chain.  Each reference to a memory pool is + * handed an MPOOL which is the opaque cookie passed to all of the memory + * routines. + */ +#define	HASHSIZE	128 +#define	HASHKEY(pgno)	((pgno - 1) % HASHSIZE) + +/* The BKT structures are the elements of the lists. */ +typedef struct BKT { +	struct BKT	*hnext;		/* next hash bucket */ +	struct BKT	*hprev;		/* previous hash bucket */ +	struct BKT	*cnext;		/* next free/lru bucket */ +	struct BKT	*cprev;		/* previous free/lru bucket */ +	void		*page;		/* page */ +	pgno_t		pgno;		/* page number */ + +#define	MPOOL_DIRTY	0x01		/* page needs to be written */ +#define	MPOOL_PINNED	0x02		/* page is pinned into memory */ +	unsigned long	flags;		/* flags */ +} BKT; + +/* The BKTHDR structures are the heads of the lists. */ +typedef struct BKTHDR { +	struct BKT	*hnext;		/* next hash bucket */ +	struct BKT	*hprev;		/* previous hash bucket */ +	struct BKT	*cnext;		/* next free/lru bucket */ +	struct BKT	*cprev;		/* previous free/lru bucket */ +} BKTHDR; + +typedef struct MPOOL { +	BKTHDR	free;			/* The free list. */ +	BKTHDR	lru;			/* The LRU list. */ +	BKTHDR	hashtable[HASHSIZE];	/* Hashed list by page number. */ +	pgno_t	curcache;		/* Current number of cached pages. */ +	pgno_t	maxcache;		/* Max number of cached pages. */ +	pgno_t	npages;			/* Number of pages in the file. */ +	u_long	pagesize;		/* File page size. */ +	int	fd;			/* File descriptor. */ +					/* Page in conversion routine. */ +	void    (*pgin) __P((void *, pgno_t, void *)); +					/* Page out conversion routine. */ +	void    (*pgout) __P((void *, pgno_t, void *)); +	void	*pgcookie;		/* Cookie for page in/out routines. */ +#ifdef STATISTICS +	unsigned long	cachehit; +	unsigned long	cachemiss; +	unsigned long	pagealloc; +	unsigned long	pageflush; +	unsigned long	pageget; +	unsigned long	pagenew; +	unsigned long	pageput; +	unsigned long	pageread; +	unsigned long	pagewrite; +#endif +} MPOOL; + +#ifdef __MPOOLINTERFACE_PRIVATE +/* Macros to insert/delete into/from hash chain. */ +#define rmhash(bp) { \ +        (bp)->hprev->hnext = (bp)->hnext; \ +        (bp)->hnext->hprev = (bp)->hprev; \ +} +#define inshash(bp, pg) { \ +	hp = &mp->hashtable[HASHKEY(pg)]; \ +        (bp)->hnext = hp->hnext; \ +        (bp)->hprev = (struct BKT *)hp; \ +        hp->hnext->hprev = (bp); \ +        hp->hnext = (bp); \ +} + +/* Macros to insert/delete into/from lru and free chains. */ +#define	rmchain(bp) { \ +        (bp)->cprev->cnext = (bp)->cnext; \ +        (bp)->cnext->cprev = (bp)->cprev; \ +} +#define inschain(bp, dp) { \ +        (bp)->cnext = (dp)->cnext; \ +        (bp)->cprev = (struct BKT *)(dp); \ +        (dp)->cnext->cprev = (bp); \ +        (dp)->cnext = (bp); \ +} +#endif + +__BEGIN_DECLS +MPOOL	*mpool_open __P((DBT *, int, pgno_t, pgno_t)); +void	 mpool_filter __P((MPOOL *, void (*)(void *, pgno_t, void *), +	    void (*)(void *, pgno_t, void *), void *)); +void	*mpool_new __P((MPOOL *, pgno_t *)); +void	*mpool_get __P((MPOOL *, pgno_t, u_int)); +int	 mpool_put __P((MPOOL *, void *, u_int)); +int	 mpool_sync __P((MPOOL *)); +int	 mpool_close __P((MPOOL *)); +#ifdef STATISTICS +void	 mpool_stat __P((MPOOL *)); +#endif +__END_DECLS diff --git a/include/stdio.h b/include/stdio.h new file mode 100644 index 000000000000..b85af433dbb9 --- /dev/null +++ b/include/stdio.h @@ -0,0 +1,378 @@ +/*- + * Copyright (c) 1990, 1993 + *	The Regents of the University of California.  All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *    must display the following acknowledgement: + *	This product includes software developed by the University of + *	California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + *	@(#)stdio.h	8.5 (Berkeley) 4/29/95 + */ + +#ifndef	_STDIO_H_ +#define	_STDIO_H_ + +#if !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__) +#include <sys/types.h> +#endif + +#include <sys/cdefs.h> + +#include <machine/ansi.h> +#ifdef	_BSD_SIZE_T_ +typedef	_BSD_SIZE_T_	size_t; +#undef	_BSD_SIZE_T_ +#endif + +#ifndef NULL +#define	NULL	0 +#endif + +/* + * This is fairly grotesque, but pure ANSI code must not inspect the + * innards of an fpos_t anyway.  The library internally uses off_t, + * which we assume is exactly as big as eight chars.  (When we switch + * to gcc 2.4 we will use __attribute__ here.) + * + * WARNING: the alignment constraints on an off_t and the struct below + * differ on (e.g.) the SPARC.  Hence, the placement of an fpos_t object + * in a structure will change if fpos_t's are not aligned on 8-byte + * boundaries.  THIS IS A CROCK, but for now there is no way around it. + */ +#if !defined(_ANSI_SOURCE) && !defined(__STRICT_ANSI__) +typedef off_t fpos_t; +#else +typedef struct __sfpos { +	char	_pos[8]; +} fpos_t; +#endif + +#define	_FSTDIO			/* Define for new stdio with functions. */ + +/* + * NB: to fit things in six character monocase externals, the stdio + * code uses the prefix `__s' for stdio objects, typically followed + * by a three-character attempt at a mnemonic. + */ + +/* stdio buffers */ +struct __sbuf { +	unsigned char *_base; +	int	_size; +}; + +/* + * stdio state variables. + * + * The following always hold: + * + *	if (_flags&(__SLBF|__SWR)) == (__SLBF|__SWR), + *		_lbfsize is -_bf._size, else _lbfsize is 0 + *	if _flags&__SRD, _w is 0 + *	if _flags&__SWR, _r is 0 + * + * This ensures that the getc and putc macros (or inline functions) never + * try to write or read from a file that is in `read' or `write' mode. + * (Moreover, they can, and do, automatically switch from read mode to + * write mode, and back, on "r+" and "w+" files.) + * + * _lbfsize is used only to make the inline line-buffered output stream + * code as compact as possible. + * + * _ub, _up, and _ur are used when ungetc() pushes back more characters + * than fit in the current _bf, or when ungetc() pushes back a character + * that does not match the previous one in _bf.  When this happens, + * _ub._base becomes non-nil (i.e., a stream has ungetc() data iff + * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. + * + * NB: see WARNING above before changing the layout of this structure! + */ +typedef	struct __sFILE { +	unsigned char *_p;	/* current position in (some) buffer */ +	int	_r;		/* read space left for getc() */ +	int	_w;		/* write space left for putc() */ +	short	_flags;		/* flags, below; this FILE is free if 0 */ +	short	_file;		/* fileno, if Unix descriptor, else -1 */ +	struct	__sbuf _bf;	/* the buffer (at least 1 byte, if !NULL) */ +	int	_lbfsize;	/* 0 or -_bf._size, for inline putc */ + +	/* operations */ +	void	*_cookie;	/* cookie passed to io functions */ +	int	(*_close) __P((void *)); +	int	(*_read)  __P((void *, char *, int)); +	fpos_t	(*_seek)  __P((void *, fpos_t, int)); +	int	(*_write) __P((void *, const char *, int)); + +	/* separate buffer for long sequences of ungetc() */ +	struct	__sbuf _ub;	/* ungetc buffer */ +	unsigned char *_up;	/* saved _p when _p is doing ungetc data */ +	int	_ur;		/* saved _r when _r is counting ungetc data */ + +	/* tricks to meet minimum requirements even when malloc() fails */ +	unsigned char _ubuf[3];	/* guarantee an ungetc() buffer */ +	unsigned char _nbuf[1];	/* guarantee a getc() buffer */ + +	/* separate buffer for fgetln() when line crosses buffer boundary */ +	struct	__sbuf _lb;	/* buffer for fgetln() */ + +	/* Unix stdio files get aligned to block boundaries on fseek() */ +	int	_blksize;	/* stat.st_blksize (may be != _bf._size) */ +	fpos_t	_offset;	/* current lseek offset (see WARNING) */ +} FILE; + +__BEGIN_DECLS +extern FILE __sF[]; +__END_DECLS + +#define	__SLBF	0x0001		/* line buffered */ +#define	__SNBF	0x0002		/* unbuffered */ +#define	__SRD	0x0004		/* OK to read */ +#define	__SWR	0x0008		/* OK to write */ +	/* RD and WR are never simultaneously asserted */ +#define	__SRW	0x0010		/* open for reading & writing */ +#define	__SEOF	0x0020		/* found EOF */ +#define	__SERR	0x0040		/* found error */ +#define	__SMBF	0x0080		/* _buf is from malloc */ +#define	__SAPP	0x0100		/* fdopen()ed in append mode */ +#define	__SSTR	0x0200		/* this is an sprintf/snprintf string */ +#define	__SOPT	0x0400		/* do fseek() optimisation */ +#define	__SNPT	0x0800		/* do not do fseek() optimisation */ +#define	__SOFF	0x1000		/* set iff _offset is in fact correct */ +#define	__SMOD	0x2000		/* true => fgetln modified _p text */ + +/* + * The following three definitions are for ANSI C, which took them + * from System V, which brilliantly took internal interface macros and + * made them official arguments to setvbuf(), without renaming them. + * Hence, these ugly _IOxxx names are *supposed* to appear in user code. + * + * Although numbered as their counterparts above, the implementation + * does not rely on this. + */ +#define	_IOFBF	0		/* setvbuf should set fully buffered */ +#define	_IOLBF	1		/* setvbuf should set line buffered */ +#define	_IONBF	2		/* setvbuf should set unbuffered */ + +#define	BUFSIZ	1024		/* size of buffer used by setbuf */ +#define	EOF	(-1) + +/* + * FOPEN_MAX is a minimum maximum, and is the number of streams that + * stdio can provide without attempting to allocate further resources + * (which could fail).  Do not use this for anything. + */ +				/* must be == _POSIX_STREAM_MAX <limits.h> */ +#define	FOPEN_MAX	20	/* must be <= OPEN_MAX <sys/syslimits.h> */ +#define	FILENAME_MAX	1024	/* must be <= PATH_MAX <sys/syslimits.h> */ + +/* System V/ANSI C; this is the wrong way to do this, do *not* use these. */ +#ifndef _ANSI_SOURCE +#define	P_tmpdir	"/var/tmp/" +#endif +#define	L_tmpnam	1024	/* XXX must be == PATH_MAX */ +#define	TMP_MAX		308915776 + +#ifndef SEEK_SET +#define	SEEK_SET	0	/* set file offset to offset */ +#endif +#ifndef SEEK_CUR +#define	SEEK_CUR	1	/* set file offset to current plus offset */ +#endif +#ifndef SEEK_END +#define	SEEK_END	2	/* set file offset to EOF plus offset */ +#endif + +#define	stdin	(&__sF[0]) +#define	stdout	(&__sF[1]) +#define	stderr	(&__sF[2]) + +/* + * Functions defined in ANSI C standard. + */ +__BEGIN_DECLS +void	 clearerr __P((FILE *)); +int	 fclose __P((FILE *)); +int	 feof __P((FILE *)); +int	 ferror __P((FILE *)); +int	 fflush __P((FILE *)); +int	 fgetc __P((FILE *)); +int	 fgetpos __P((FILE *, fpos_t *)); +char	*fgets __P((char *, size_t, FILE *)); +FILE	*fopen __P((const char *, const char *)); +int	 fprintf __P((FILE *, const char *, ...)); +int	 fputc __P((int, FILE *)); +int	 fputs __P((const char *, FILE *)); +size_t	 fread __P((void *, size_t, size_t, FILE *)); +FILE	*freopen __P((const char *, const char *, FILE *)); +int	 fscanf __P((FILE *, const char *, ...)); +int	 fseek __P((FILE *, long, int)); +int	 fsetpos __P((FILE *, const fpos_t *)); +long	 ftell __P((FILE *)); +size_t	 fwrite __P((const void *, size_t, size_t, FILE *)); +int	 getc __P((FILE *)); +int	 getchar __P((void)); +char	*gets __P((char *)); +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +extern int sys_nerr;			/* perror(3) external variables */ +extern __const char *__const sys_errlist[]; +#endif +void	 perror __P((const char *)); +int	 printf __P((const char *, ...)); +int	 putc __P((int, FILE *)); +int	 putchar __P((int)); +int	 puts __P((const char *)); +int	 remove __P((const char *)); +int	 rename  __P((const char *, const char *)); +void	 rewind __P((FILE *)); +int	 scanf __P((const char *, ...)); +void	 setbuf __P((FILE *, char *)); +int	 setvbuf __P((FILE *, char *, int, size_t)); +int	 sprintf __P((char *, const char *, ...)); +int	 sscanf __P((const char *, const char *, ...)); +FILE	*tmpfile __P((void)); +char	*tmpnam __P((char *)); +int	 ungetc __P((int, FILE *)); +int	 vfprintf __P((FILE *, const char *, _BSD_VA_LIST_)); +int	 vprintf __P((const char *, _BSD_VA_LIST_)); +int	 vsprintf __P((char *, const char *, _BSD_VA_LIST_)); +__END_DECLS + +/* + * Functions defined in POSIX 1003.1. + */ +#ifndef _ANSI_SOURCE +#define	L_cuserid	9	/* size for cuserid(); UT_NAMESIZE + 1 */ +#define	L_ctermid	1024	/* size for ctermid(); PATH_MAX */ + +__BEGIN_DECLS +char	*ctermid __P((char *)); +FILE	*fdopen __P((int, const char *)); +int	 fileno __P((FILE *)); +__END_DECLS +#endif /* not ANSI */ + +/* + * Routines that are purely local. + */ +#if !defined (_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +__BEGIN_DECLS +char	*fgetln __P((FILE *, size_t *)); +int	 fpurge __P((FILE *)); +int	 getw __P((FILE *)); +int	 pclose __P((FILE *)); +FILE	*popen __P((const char *, const char *)); +int	 putw __P((int, FILE *)); +void	 setbuffer __P((FILE *, char *, int)); +int	 setlinebuf __P((FILE *)); +char	*tempnam __P((const char *, const char *)); +int	 snprintf __P((char *, size_t, const char *, ...)); +int	 vsnprintf __P((char *, size_t, const char *, _BSD_VA_LIST_)); +int	 vscanf __P((const char *, _BSD_VA_LIST_)); +int	 vsscanf __P((const char *, const char *, _BSD_VA_LIST_)); +FILE	*zopen __P((const char *, const char *, int)); +__END_DECLS + +/* + * This is a #define because the function is used internally and + * (unlike vfscanf) the name __svfscanf is guaranteed not to collide + * with a user function when _ANSI_SOURCE or _POSIX_SOURCE is defined. + */ +#define	 vfscanf	__svfscanf + +/* + * Stdio function-access interface. + */ +__BEGIN_DECLS +FILE	*funopen __P((const void *, +		int (*)(void *, char *, int), +		int (*)(void *, const char *, int), +		fpos_t (*)(void *, fpos_t, int), +		int (*)(void *))); +__END_DECLS +#define	fropen(cookie, fn) funopen(cookie, fn, 0, 0, 0) +#define	fwopen(cookie, fn) funopen(cookie, 0, fn, 0, 0) +#endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ + +/* + * Functions internal to the implementation. + */ +__BEGIN_DECLS +int	__srget __P((FILE *)); +int	__svfscanf __P((FILE *, const char *, _BSD_VA_LIST_)); +int	__swbuf __P((int, FILE *)); +__END_DECLS + +/* + * The __sfoo macros are here so that we can  + * define function versions in the C library. + */ +#define	__sgetc(p) (--(p)->_r < 0 ? __srget(p) : (int)(*(p)->_p++)) +#if defined(__GNUC__) && defined(__STDC__) +static __inline int __sputc(int _c, FILE *_p) { +	if (--_p->_w >= 0 || (_p->_w >= _p->_lbfsize && (char)_c != '\n')) +		return (*_p->_p++ = _c); +	else +		return (__swbuf(_c, _p)); +} +#else +/* + * This has been tuned to generate reasonable code on the vax using pcc. + */ +#define	__sputc(c, p) \ +	(--(p)->_w < 0 ? \ +		(p)->_w >= (p)->_lbfsize ? \ +			(*(p)->_p = (c)), *(p)->_p != '\n' ? \ +				(int)*(p)->_p++ : \ +				__swbuf('\n', p) : \ +			__swbuf((int)(c), p) : \ +		(*(p)->_p = (c), (int)*(p)->_p++)) +#endif + +#define	__sfeof(p)	(((p)->_flags & __SEOF) != 0) +#define	__sferror(p)	(((p)->_flags & __SERR) != 0) +#define	__sclearerr(p)	((void)((p)->_flags &= ~(__SERR|__SEOF))) +#define	__sfileno(p)	((p)->_file) + +#define	feof(p)		__sfeof(p) +#define	ferror(p)	__sferror(p) +#define	clearerr(p)	__sclearerr(p) + +#ifndef _ANSI_SOURCE +#define	fileno(p)	__sfileno(p) +#endif + +#ifndef lint +#define	getc(fp)	__sgetc(fp) +#define putc(x, fp)	__sputc(x, fp) +#endif /* lint */ + +#define	getchar()	getc(stdin) +#define	putchar(x)	putc(x, stdout) +#endif /* _STDIO_H_ */ diff --git a/include/stdlib.h b/include/stdlib.h new file mode 100644 index 000000000000..d93360e07360 --- /dev/null +++ b/include/stdlib.h @@ -0,0 +1,168 @@ +/*- + * Copyright (c) 1990, 1993 + *	The Regents of the University of California.  All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *    must display the following acknowledgement: + *	This product includes software developed by the University of + *	California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + *	@(#)stdlib.h	8.5 (Berkeley) 5/19/95 + */ + +#ifndef _STDLIB_H_ +#define _STDLIB_H_ + +#include <machine/ansi.h> + +#ifdef	_BSD_SIZE_T_ +typedef	_BSD_SIZE_T_	size_t; +#undef	_BSD_SIZE_T_ +#endif + +#ifdef	_BSD_WCHAR_T_ +#ifndef _ANSI_SOURCE +typedef	_BSD_WCHAR_T_	rune_t; +#endif +typedef	_BSD_WCHAR_T_	wchar_t; +#undef	_BSD_WCHAR_T_ +#endif + +typedef struct { +	int quot;		/* quotient */ +	int rem;		/* remainder */ +} div_t; + +typedef struct { +	long quot;		/* quotient */ +	long rem;		/* remainder */ +} ldiv_t; + +#ifndef NULL +#define	NULL	0 +#endif + +#define	EXIT_FAILURE	1 +#define	EXIT_SUCCESS	0 + +#define	RAND_MAX	0x7fffffff + +extern int __mb_cur_max; +#define	MB_CUR_MAX	__mb_cur_max + +#include <sys/cdefs.h> + +__BEGIN_DECLS +__dead void +	 abort __P((void)); +__pure int +	 abs __P((int)); +int	 atexit __P((void (*)(void))); +double	 atof __P((const char *)); +int	 atoi __P((const char *)); +long	 atol __P((const char *)); +void	*bsearch __P((const void *, const void *, size_t, +	    size_t, int (*)(const void *, const void *))); +void	*calloc __P((size_t, size_t)); +__pure div_t +	 div __P((int, int)); +__dead void +	 exit __P((int)); +void	 free __P((void *)); +char	*getenv __P((const char *)); +__pure long +	 labs __P((long)); +__pure ldiv_t +	 ldiv __P((long, long)); +void	*malloc __P((size_t)); +void	 qsort __P((void *, size_t, size_t, +	    int (*)(const void *, const void *))); +int	 rand __P((void)); +void	*realloc __P((void *, size_t)); +void	 srand __P((unsigned)); +double	 strtod __P((const char *, char **)); +long	 strtol __P((const char *, char **, int)); +unsigned long +	 strtoul __P((const char *, char **, int)); +int	 system __P((const char *)); + +/* These are currently just stubs. */ +int	 mblen __P((const char *, size_t)); +size_t	 mbstowcs __P((wchar_t *, const char *, size_t)); +int	 wctomb __P((char *, wchar_t)); +int	 mbtowc __P((wchar_t *, const char *, size_t)); +size_t	 wcstombs __P((char *, const wchar_t *, size_t)); + +#ifndef _ANSI_SOURCE +int	 putenv __P((const char *)); +int	 setenv __P((const char *, const char *, int)); +#endif + +#if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) +void	*alloca __P((size_t));		/* built-in for gcc */ +					/* getcap(3) functions */ +char	*getbsize __P((int *, long *)); +char	*cgetcap __P((char *, char *, int)); +int	 cgetclose __P((void)); +int	 cgetent __P((char **, char **, char *)); +int	 cgetfirst __P((char **, char **)); +int	 cgetmatch __P((char *, char *)); +int	 cgetnext __P((char **, char **)); +int	 cgetnum __P((char *, char *, long *)); +int	 cgetset __P((char *)); +int	 cgetstr __P((char *, char *, char **)); +int	 cgetustr __P((char *, char *, char **)); + +int	 daemon __P((int, int)); +char	*devname __P((int, int)); +int	 getloadavg __P((double [], int)); + +char	*group_from_gid __P((unsigned long, int)); +int	 heapsort __P((void *, size_t, size_t, +	    int (*)(const void *, const void *))); +char	*initstate __P((unsigned long, char *, long)); +int	 mergesort __P((void *, size_t, size_t, +	    int (*)(const void *, const void *))); +int	 radixsort __P((const unsigned char **, int, const unsigned char *, +	    unsigned)); +int	 sradixsort __P((const unsigned char **, int, const unsigned char *, +	    unsigned)); +long	 random __P((void)); +char	*realpath __P((const char *, char resolved_path[])); +char	*setstate __P((char *)); +void	 srandom __P((unsigned long)); +char	*user_from_uid __P((unsigned long, int)); +#ifndef __STRICT_ANSI__ +long long +	 strtoq __P((const char *, char **, int)); +unsigned long long +	 strtouq __P((const char *, char **, int)); +#endif +void	 unsetenv __P((const char *)); +#endif +__END_DECLS + +#endif /* _STDLIB_H_ */ diff --git a/include/tzfile.h b/include/tzfile.h new file mode 100644 index 000000000000..246e6a71ec41 --- /dev/null +++ b/include/tzfile.h @@ -0,0 +1,151 @@ +/* + * Copyright (c) 1988, 1993 + *	The Regents of the University of California.  All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Arthur David Olson of the National Cancer Institute. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *    must display the following acknowledgement: + *	This product includes software developed by the University of + *	California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + *	@(#)tzfile.h	8.1 (Berkeley) 6/2/93 + */ + +#ifndef _TZFILE_H_ +#define	_TZFILE_H_ + +/* + * Information about time zone files. + */ +			/* Time zone object file directory */ +#define TZDIR		"/usr/share/zoneinfo" +#define TZDEFAULT	"/etc/localtime" +#define TZDEFRULES	"posixrules" + +/* +** Each file begins with. . . +*/ + +struct tzhead { +	char	tzh_reserved[24];	/* reserved for future use */ +	char	tzh_ttisstdcnt[4];	/* coded number of trans. time flags */ +	char	tzh_leapcnt[4];		/* coded number of leap seconds */ +	char	tzh_timecnt[4];		/* coded number of transition times */ +	char	tzh_typecnt[4];		/* coded number of local time types */ +	char	tzh_charcnt[4];		/* coded number of abbr. chars */ +}; + +/* +** . . .followed by. . . +** +**	tzh_timecnt (char [4])s		coded transition times a la time(2) +**	tzh_timecnt (unsigned char)s	types of local time starting at above +**	tzh_typecnt repetitions of +**		one (char [4])		coded GMT offset in seconds +**		one (unsigned char)	used to set tm_isdst +**		one (unsigned char)	that's an abbreviation list index +**	tzh_charcnt (char)s		'\0'-terminated zone abbreviations +**	tzh_leapcnt repetitions of +**		one (char [4])		coded leap second transition times +**		one (char [4])		total correction after above +**	tzh_ttisstdcnt (char)s		indexed by type; if TRUE, transition +**					time is standard time, if FALSE, +**					transition time is wall clock time +**					if absent, transition times are +**					assumed to be wall clock time +*/ + +/* +** In the current implementation, "tzset()" refuses to deal with files that +** exceed any of the limits below. +*/ + +/* +** The TZ_MAX_TIMES value below is enough to handle a bit more than a +** year's worth of solar time (corrected daily to the nearest second) or +** 138 years of Pacific Presidential Election time +** (where there are three time zone transitions every fourth year). +*/ +#define TZ_MAX_TIMES	370 + +#define NOSOLAR			/* 4BSD doesn't currently handle solar time */ + +#ifndef NOSOLAR +#define TZ_MAX_TYPES	256	/* Limited by what (unsigned char)'s can hold */ +#else +#define TZ_MAX_TYPES	10	/* Maximum number of local time types */ +#endif + +#define TZ_MAX_CHARS	50	/* Maximum number of abbreviation characters */ + +#define	TZ_MAX_LEAPS	50	/* Maximum number of leap second corrections */ + +#define SECSPERMIN	60 +#define MINSPERHOUR	60 +#define HOURSPERDAY	24 +#define DAYSPERWEEK	7 +#define DAYSPERNYEAR	365 +#define DAYSPERLYEAR	366 +#define SECSPERHOUR	(SECSPERMIN * MINSPERHOUR) +#define SECSPERDAY	((long) SECSPERHOUR * HOURSPERDAY) +#define MONSPERYEAR	12 + +#define TM_SUNDAY	0 +#define TM_MONDAY	1 +#define TM_TUESDAY	2 +#define TM_WEDNESDAY	3 +#define TM_THURSDAY	4 +#define TM_FRIDAY	5 +#define TM_SATURDAY	6 + +#define TM_JANUARY	0 +#define TM_FEBRUARY	1 +#define TM_MARCH	2 +#define TM_APRIL	3 +#define TM_MAY		4 +#define TM_JUNE		5 +#define TM_JULY		6 +#define TM_AUGUST	7 +#define TM_SEPTEMBER	8 +#define TM_OCTOBER	9 +#define TM_NOVEMBER	10 +#define TM_DECEMBER	11 + +#define TM_YEAR_BASE	1900 + +#define EPOCH_YEAR	1970 +#define EPOCH_WDAY	TM_THURSDAY + +/* +** Accurate only for the past couple of centuries; +** that will probably do. +*/ + +#define isleap(y) (((y) % 4) == 0 && ((y) % 100) != 0 || ((y) % 400) == 0) + +#endif /* !_TZFILE_H_ */ diff --git a/include/unistd.h b/include/unistd.h new file mode 100644 index 000000000000..e194500c2bf0 --- /dev/null +++ b/include/unistd.h @@ -0,0 +1,183 @@ +/*- + * Copyright (c) 1991, 1993, 1994 + *	The Regents of the University of California.  All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + *    notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + *    notice, this list of conditions and the following disclaimer in the + *    documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + *    must display the following acknowledgement: + *	This product includes software developed by the University of + *	California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + *    may be used to endorse or promote products derived from this software + *    without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + *	@(#)unistd.h	8.12 (Berkeley) 4/27/95 + */ + +#ifndef _UNISTD_H_ +#define	_UNISTD_H_ + +#include <sys/cdefs.h> +#include <sys/types.h> +#include <sys/unistd.h> + +#define	 STDIN_FILENO	0	/* standard input file descriptor */ +#define	STDOUT_FILENO	1	/* standard output file descriptor */ +#define	STDERR_FILENO	2	/* standard error file descriptor */ + +#ifndef NULL +#define	NULL		0	/* null pointer constant */ +#endif + +__BEGIN_DECLS +__dead void +	 _exit __P((int)); +int	 access __P((const char *, int)); +unsigned int	 alarm __P((unsigned int)); +int	 chdir __P((const char *)); +int	 chown __P((const char *, uid_t, gid_t)); +int	 close __P((int)); +size_t	 confstr __P((int, char *, size_t)); +int	 dup __P((int)); +int	 dup2 __P((int, int)); +int	 execl __P((const char *, const char *, ...)); +int	 execle __P((const char *, const char *, ...)); +int	 execlp __P((const char *, const char *, ...)); +int	 execv __P((const char *, char * const *)); +int	 execve __P((const char *, char * const *, char * const *)); +int	 execvp __P((const char *, char * const *)); +pid_t	 fork __P((void)); +long	 fpathconf __P((int, int)); +char	*getcwd __P((char *, size_t)); +gid_t	 getegid __P((void)); +uid_t	 geteuid __P((void)); +gid_t	 getgid __P((void)); +int	 getgroups __P((int, gid_t [])); +char	*getlogin __P((void)); +pid_t	 getpgrp __P((void)); +pid_t	 getpid __P((void)); +pid_t	 getppid __P((void)); +uid_t	 getuid __P((void)); +int	 isatty __P((int)); +int	 link __P((const char *, const char *)); +off_t	 lseek __P((int, off_t, int)); +long	 pathconf __P((const char *, int)); +int	 pause __P((void)); +int	 pipe __P((int *)); +ssize_t	 read __P((int, void *, size_t)); +int	 rmdir __P((const char *)); +int	 setgid __P((gid_t)); +int	 setpgid __P((pid_t, pid_t)); +pid_t	 setsid __P((void)); +int	 setuid __P((uid_t)); +unsigned int	 sleep __P((unsigned int)); +long	 sysconf __P((int)); +pid_t	 tcgetpgrp __P((int)); +int	 tcsetpgrp __P((int, pid_t)); +char	*ttyname __P((int)); +int	 unlink __P((const char *)); +ssize_t	 write __P((int, const void *, size_t)); + +extern char *optarg;			/* getopt(3) external variables */ +extern int optind, opterr, optopt; +int	 getopt __P((int, char * const [], const char *)); + +#ifndef	_POSIX_SOURCE +#ifdef	__STDC__ +struct timeval;				/* select(2) */ +#endif +int	 acct __P((const char *)); +int	 async_daemon __P((void)); +char	*brk __P((const char *)); +int	 chroot __P((const char *)); +char	*crypt __P((const char *, const char *)); +int	 des_cipher __P((const char *, char *, long, int)); +int	 des_setkey __P((const char *key)); +int	 encrypt __P((char *, int)); +void	 endusershell __P((void)); +int	 exect __P((const char *, char * const *, char * const *)); +int	 fchdir __P((int)); +int	 fchown __P((int, int, int)); +int	 fsync __P((int)); +int	 ftruncate __P((int, off_t)); +int	 getdtablesize __P((void)); +long	 gethostid __P((void)); +int	 gethostname __P((char *, int)); +mode_t	 getmode __P((const void *, mode_t)); +__pure int +	 getpagesize __P((void)); +char	*getpass __P((const char *)); +char	*getusershell __P((void)); +char	*getwd __P((char *));			/* obsoleted by getcwd() */ +int	 initgroups __P((const char *, int)); +int	 iruserok __P((unsigned long, int, const char *, const char *)); +int	 mknod __P((const char *, mode_t, dev_t)); +int	 mkstemp __P((char *)); +char	*mktemp __P((char *)); +int	 nfssvc __P((int, void *)); +int	 nice __P((int)); +void	 psignal __P((unsigned int, const char *)); +extern __const char *__const sys_siglist[]; +int	 profil __P((char *, int, int, int)); +int	 rcmd __P((char **, int, const char *, +		const char *, const char *, int *)); +char	*re_comp __P((const char *)); +int	 re_exec __P((const char *)); +int	 readlink __P((const char *, char *, int)); +int	 reboot __P((int)); +int	 revoke __P((const char *)); +int	 rresvport __P((int *)); +int	 ruserok __P((const char *, int, const char *, const char *)); +char	*sbrk __P((int)); +int	 select __P((int, fd_set *, fd_set *, fd_set *, struct timeval *)); +int	 setegid __P((gid_t)); +int	 seteuid __P((uid_t)); +int	 setgroups __P((int, const gid_t *)); +void	 sethostid __P((long)); +int	 sethostname __P((const char *, int)); +int	 setkey __P((const char *)); +int	 setlogin __P((const char *)); +void	*setmode __P((const char *)); +int	 setpgrp __P((pid_t pid, pid_t pgrp));	/* obsoleted by setpgid() */ +int	 setregid __P((gid_t, gid_t)); +int	 setreuid __P((uid_t, uid_t)); +int	 setrgid __P((gid_t)); +int	 setruid __P((uid_t)); +void	 setusershell __P((void)); +int	 swapon __P((const char *)); +int	 symlink __P((const char *, const char *)); +void	 sync __P((void)); +int	 syscall __P((int, ...)); +int	 truncate __P((const char *, off_t)); +int	 ttyslot __P((void)); +unsigned int	 ualarm __P((unsigned int, unsigned int)); +int	 unwhiteout __P((const char *)); +void	 usleep __P((unsigned int)); +void	*valloc __P((size_t));			/* obsoleted by malloc() */ +pid_t	 vfork __P((void)); + +extern char *suboptarg;			/* getsubopt(3) external variable */ +int	 getsubopt __P((char **, char * const *, char **)); +#endif /* !_POSIX_SOURCE */ +__END_DECLS + +#endif /* !_UNISTD_H_ */ | 
