/* 4m v2.15 (select.h)
 * (C) Copyright 1990 by Carrick Sean Casey
 * (C) Copyright 1993 by Scott Chasin and Michaeljon Miller
 *
 * 3-22-93 See file COPYING for copyright information.
 *
 * FD definitions for select()
 *
 */

#include <sys/param.h>
#ifdef ESIX
# undef MAXHOSTNAMELEN
#endif

#ifndef NBBY
#define NBBY 8
#endif

#ifndef	FD_SETSIZE
#define	FD_SETSIZE	(sizeof(fd_set) * NBBY)
#endif

#ifndef NFDBITS

typedef long fd_mask;

#define	NFDBITS	(sizeof(fd_mask) * NBBY)  /* bits per mask */
#endif
#ifndef howmany
#define howmany(x, y)   (((x)+((y)-1))/(y))
#endif


#ifndef FD_SET
#define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
#define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
#define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
#define	FD_ZERO(p)	bzero((char *)(p), sizeof(*(p)))
#endif


#ifndef FD_SET_SZ
#define	FD_SET_SZ(n)	(howmany((n), NFDBITS) * sizeof(fd_mask))
#endif
