xref: /titanic_50/usr/src/lib/libbc/inc/include/sys/types.h (revision 5d54f3d8999eac1762fe0a8c7177d20f1f201fae)
1 /*
2  * Copyright 1989 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 
6 /*
7  * Copyright (c) 1982, 1986 Regents of the University of California.
8  * All rights reserved.  The Berkeley software License Agreement
9  * specifies the terms and conditions for redistribution.
10  */
11 
12 #ifndef	__sys_types_h
13 #define	__sys_types_h
14 
15 #pragma ident	"%Z%%M%	%I%	%E% SMI"
16 
17 /*
18  * Basic system types.
19  */
20 
21 #include <sys/stdtypes.h>		/* ANSI & POSIX types */
22 
23 #ifndef	_POSIX_SOURCE
24 #include <sys/sysmacros.h>
25 
26 #define	physadr		physadr_t
27 #define	quad		quad_t
28 
29 typedef	unsigned char	u_char;
30 typedef	unsigned short	u_short;
31 typedef	unsigned int	u_int;
32 typedef	unsigned long	u_long;
33 typedef	unsigned short	ushort;		/* System V compatibility */
34 typedef	unsigned int	uint;		/* System V compatibility */
35 #endif	/* !_POSIX_SOURCE */
36 
37 typedef	struct  _physadr_t { int r[1]; } *physadr_t;
38 typedef	struct label_t {
39 	int	val[2];
40 } label_t;
41 typedef	struct	_quad_t { long val[2]; } quad_t;
42 typedef	long	daddr_t;
43 typedef	char *	caddr_t;
44 typedef	unsigned long	ino_t;
45 typedef	short	dev_t;
46 typedef	long	off_t;
47 typedef	unsigned short	uid_t;
48 typedef	unsigned short	gid_t;
49 typedef	long	key_t;
50 typedef	char *	addr_t;
51 
52 #ifndef	_POSIX_SOURCE
53 
54 #define	NBBY	8		/* number of bits in a byte */
55 /*
56  * Select uses bit masks of file descriptors in longs.
57  * These macros manipulate such bit fields (the filesystem macros use chars).
58  * FD_SETSIZE may be defined by the user, but the default here
59  * should be >= NOFILE (param.h).
60  */
61 #ifndef	FD_SETSIZE
62 #define	FD_SETSIZE	256
63 #endif
64 
65 typedef	long	fd_mask;
66 #define	NFDBITS	(sizeof (fd_mask) * NBBY)	/* bits per mask */
67 #ifndef	howmany
68 #define	howmany(x, y)	(((x)+((y)-1))/(y))
69 #endif
70 
71 typedef	struct fd_set {
72 	fd_mask	fds_bits[howmany(FD_SETSIZE, NFDBITS)];
73 } fd_set;
74 
75 
76 #define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
77 #define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
78 #define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
79 #define	FD_ZERO(p)	bzero((char *)(p), sizeof (*(p)))
80 
81 #endif	/* !_POSIX_SOURCE */
82 #endif	/* !__sys_types_h */
83