|
|
1.1 ! root 1: /* ! 2: * Copyright (c) 1982 Regents of the University of California. ! 3: * All rights reserved. The Berkeley software License Agreement ! 4: * specifies the terms and conditions for redistribution. ! 5: * ! 6: * @(#)types.h 7.3 (Berkeley) 6/20/87 ! 7: */ ! 8: ! 9: #ifndef _TYPES_ ! 10: #define _TYPES_ ! 11: /* ! 12: * Basic system types and major/minor device constructing/busting macros. ! 13: */ ! 14: ! 15: /* major part of a device */ ! 16: #define major(x) ((int)(((unsigned)(x)>>8)&0377)) ! 17: ! 18: /* minor part of a device */ ! 19: #define minor(x) ((int)((x)&0377)) ! 20: ! 21: /* make a device number */ ! 22: #define makedev(x,y) ((dev_t)(((x)<<8) | (y))) ! 23: ! 24: typedef unsigned char u_char; ! 25: typedef unsigned short u_short; ! 26: typedef unsigned int u_int; ! 27: typedef unsigned long u_long; ! 28: typedef unsigned short ushort; /* sys III compat */ ! 29: ! 30: #if defined(vax) || defined(tahoe) ! 31: typedef struct _physadr { int r[1]; } *physadr; ! 32: typedef struct label_t { ! 33: int val[14]; ! 34: } label_t; ! 35: #endif ! 36: typedef struct _quad { long val[2]; } quad; ! 37: typedef long daddr_t; ! 38: typedef char * caddr_t; ! 39: typedef long * qaddr_t; /* should be typedef quad * qaddr_t; */ ! 40: typedef u_long ino_t; ! 41: typedef long swblk_t; ! 42: typedef long size_t; ! 43: typedef long time_t; ! 44: typedef short dev_t; ! 45: typedef long off_t; ! 46: typedef u_short uid_t; ! 47: typedef u_short gid_t; ! 48: ! 49: #define NBBY 8 /* number of bits in a byte */ ! 50: /* ! 51: * Select uses bit masks of file descriptors in longs. ! 52: * These macros manipulate such bit fields (the filesystem macros use chars). ! 53: * FD_SETSIZE may be defined by the user, but the default here ! 54: * should be >= NOFILE (param.h). ! 55: */ ! 56: #ifndef FD_SETSIZE ! 57: #define FD_SETSIZE 256 ! 58: #endif ! 59: ! 60: typedef long fd_mask; ! 61: #define NFDBITS (sizeof(fd_mask) * NBBY) /* bits per mask */ ! 62: #ifndef howmany ! 63: #define howmany(x, y) (((x)+((y)-1))/(y)) ! 64: #endif ! 65: ! 66: typedef struct fd_set { ! 67: fd_mask fds_bits[howmany(FD_SETSIZE, NFDBITS)]; ! 68: } fd_set; ! 69: ! 70: #define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) ! 71: #define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) ! 72: #define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) ! 73: #define FD_ZERO(p) bzero((char *)(p), sizeof(*(p))) ! 74: ! 75: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.