Import CSRG 4.4BSD-Lite2 includes onto vendor branch

This commit is contained in:
peter 1997-03-11 11:11:37 +00:00
parent d23e059e3b
commit 1c9bc538cc
7 changed files with 254 additions and 55 deletions

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)dirent.h 8.1 (Berkeley) 6/8/93
* @(#)dirent.h 8.2 (Berkeley) 7/28/94
*/
#ifndef _DIRENT_H_
@ -60,10 +60,17 @@ typedef struct _dirdesc {
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
@ -80,6 +87,7 @@ 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 ***,

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)fts.h 8.1 (Berkeley) 6/2/93
* @(#)fts.h 8.3 (Berkeley) 8/14/94
*/
#ifndef _FTS_H_
@ -54,10 +54,11 @@ typedef struct {
#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_OPTIONMASK 0x07f /* valid user option mask */
#define FTS_WHITEOUT 0x080 /* return whiteout information */
#define FTS_OPTIONMASK 0x0ff /* valid user option mask */
#define FTS_NAMEONLY 0x080 /* (private) child names only */
#define FTS_STOP 0x100 /* (private) unrecoverable error */
#define FTS_NAMEONLY 0x100 /* (private) child names only */
#define FTS_STOP 0x200 /* (private) unrecoverable error */
int fts_options; /* fts_open options, global flags */
} FTS;
@ -95,10 +96,12 @@ typedef struct _ftsent {
#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 */

View File

@ -1,5 +1,5 @@
/*-
* Copyright (c) 1991, 1993, 1994
* 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
@ -30,62 +30,98 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)mpool.h 8.2 (Berkeley) 7/14/94
* @(#)mpool.h 8.1 (Berkeley) 6/2/93
*/
#include <sys/queue.h>
/*
* The memory pool scheme is a simple one. Each in-memory page is referenced
* by a bucket which is threaded in up to two of three ways. All active pages
* are threaded on a hash chain (hashed by page number) and an lru chain.
* Inactive pages are threaded on a free chain. Each reference to a memory
* pool is handed an opaque MPOOL cookie which stores all of this information.
* 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 queues. */
typedef struct _bkt {
CIRCLEQ_ENTRY(_bkt) hq; /* hash queue */
CIRCLEQ_ENTRY(_bkt) q; /* lru queue */
void *page; /* page */
pgno_t pgno; /* page number */
/* 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 */
u_int8_t flags; /* flags */
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 {
CIRCLEQ_HEAD(_lqh, _bkt) lqh; /* lru queue head */
/* hash queue array */
CIRCLEQ_HEAD(_hqh, _bkt) hqh[HASHSIZE];
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 */
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 */
/* Page out conversion routine. */
void (*pgout) __P((void *, pgno_t, void *));
void *pgcookie; /* cookie for page in/out routines */
void *pgcookie; /* Cookie for page in/out routines. */
#ifdef STATISTICS
u_long cachehit;
u_long cachemiss;
u_long pagealloc;
u_long pageflush;
u_long pageget;
u_long pagenew;
u_long pageput;
u_long pageread;
u_long pagewrite;
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((void *, int, pgno_t, pgno_t));
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 *));

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdio.h 8.4 (Berkeley) 1/4/94
* @(#)stdio.h 8.5 (Berkeley) 4/29/95
*/
#ifndef _STDIO_H_
@ -234,7 +234,7 @@ 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((const FILE *));
long ftell __P((FILE *));
size_t fwrite __P((const void *, size_t, size_t, FILE *));
int getc __P((FILE *));
int getchar __P((void));

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)stdlib.h 8.3 (Berkeley) 2/16/94
* @(#)stdlib.h 8.5 (Berkeley) 5/19/95
*/
#ifndef _STDLIB_H_
@ -140,17 +140,10 @@ int daemon __P((int, int));
char *devname __P((int, int));
int getloadavg __P((double [], int));
extern char *optarg; /* getopt(3) external variables */
extern int opterr, optind, optopt;
int getopt __P((int, char * const *, const char *));
extern char *suboptarg; /* getsubopt(3) external variable */
int getsubopt __P((char **, char * const *, char **));
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, char *, int));
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 *,
@ -160,7 +153,7 @@ int sradixsort __P((const unsigned char **, int, const unsigned char *,
long random __P((void));
char *realpath __P((const char *, char resolved_path[]));
char *setstate __P((char *));
void srandom __P((unsigned));
void srandom __P((unsigned long));
char *user_from_uid __P((unsigned long, int));
#ifndef __STRICT_ANSI__
long long

151
include/tzfile.h Normal file
View File

@ -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_ */

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* @(#)unistd.h 8.10 (Berkeley) 4/16/94
* @(#)unistd.h 8.12 (Berkeley) 4/27/95
*/
#ifndef _UNISTD_H_
@ -97,6 +97,10 @@ 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) */
@ -166,9 +170,13 @@ 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