xref: /xnu-8792.41.9/bsd/man/man5/types.5 (revision 5c2921b07a2480ab43ec66f5b9e41cb872bc554f)
1*5c2921b0SApple OSS Distributions.\"	$NetBSD: types.5,v 1.3 1994/11/30 19:31:34 jtc Exp $
2*5c2921b0SApple OSS Distributions.\"
3*5c2921b0SApple OSS Distributions.\" Copyright (c) 1980, 1991, 1993
4*5c2921b0SApple OSS Distributions.\"	The Regents of the University of California.  All rights reserved.
5*5c2921b0SApple OSS Distributions.\"
6*5c2921b0SApple OSS Distributions.\" Redistribution and use in source and binary forms, with or without
7*5c2921b0SApple OSS Distributions.\" modification, are permitted provided that the following conditions
8*5c2921b0SApple OSS Distributions.\" are met:
9*5c2921b0SApple OSS Distributions.\" 1. Redistributions of source code must retain the above copyright
10*5c2921b0SApple OSS Distributions.\"    notice, this list of conditions and the following disclaimer.
11*5c2921b0SApple OSS Distributions.\" 2. Redistributions in binary form must reproduce the above copyright
12*5c2921b0SApple OSS Distributions.\"    notice, this list of conditions and the following disclaimer in the
13*5c2921b0SApple OSS Distributions.\"    documentation and/or other materials provided with the distribution.
14*5c2921b0SApple OSS Distributions.\" 3. All advertising materials mentioning features or use of this software
15*5c2921b0SApple OSS Distributions.\"    must display the following acknowledgement:
16*5c2921b0SApple OSS Distributions.\"	This product includes software developed by the University of
17*5c2921b0SApple OSS Distributions.\"	California, Berkeley and its contributors.
18*5c2921b0SApple OSS Distributions.\" 4. Neither the name of the University nor the names of its contributors
19*5c2921b0SApple OSS Distributions.\"    may be used to endorse or promote products derived from this software
20*5c2921b0SApple OSS Distributions.\"    without specific prior written permission.
21*5c2921b0SApple OSS Distributions.\"
22*5c2921b0SApple OSS Distributions.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23*5c2921b0SApple OSS Distributions.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24*5c2921b0SApple OSS Distributions.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25*5c2921b0SApple OSS Distributions.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26*5c2921b0SApple OSS Distributions.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27*5c2921b0SApple OSS Distributions.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28*5c2921b0SApple OSS Distributions.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29*5c2921b0SApple OSS Distributions.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30*5c2921b0SApple OSS Distributions.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31*5c2921b0SApple OSS Distributions.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32*5c2921b0SApple OSS Distributions.\" SUCH DAMAGE.
33*5c2921b0SApple OSS Distributions.\"
34*5c2921b0SApple OSS Distributions.\"     @(#)types.5	8.1 (Berkeley) 6/5/93
35*5c2921b0SApple OSS Distributions.\"
36*5c2921b0SApple OSS Distributions.Dd May 15, 2008
37*5c2921b0SApple OSS Distributions.Dt TYPES 5
38*5c2921b0SApple OSS Distributions.Os Darwin
39*5c2921b0SApple OSS Distributions.Sh NAME
40*5c2921b0SApple OSS Distributions.Nm types
41*5c2921b0SApple OSS Distributions.Nd system data types
42*5c2921b0SApple OSS Distributions.Sh SYNOPSIS
43*5c2921b0SApple OSS Distributions.Fd #include <sys/types.h>
44*5c2921b0SApple OSS Distributions.Sh DESCRIPTION
45*5c2921b0SApple OSS DistributionsThe file
46*5c2921b0SApple OSS Distributions.Pa sys/types.h
47*5c2921b0SApple OSS Distributionscontains the defined data types used in the kernel (most are
48*5c2921b0SApple OSS Distributionsused through out the system).
49*5c2921b0SApple OSS Distributions.Bd -literal
50*5c2921b0SApple OSS Distributions#ifndef _TYPES_H_
51*5c2921b0SApple OSS Distributions#define	_TYPES_H_
52*5c2921b0SApple OSS Distributions
53*5c2921b0SApple OSS Distributionstypedef	short	dev_t;
54*5c2921b0SApple OSS Distributions#ifndef _POSIX_SOURCE
55*5c2921b0SApple OSS Distributions					/* major part of a device */
56*5c2921b0SApple OSS Distributions#define	major(x)	((int)(((unsigned)(x)>>8)&0377))
57*5c2921b0SApple OSS Distributions					/* minor part of a device */
58*5c2921b0SApple OSS Distributions#define	minor(x)	((int)((x)&0377))
59*5c2921b0SApple OSS Distributions					/* make a device number */
60*5c2921b0SApple OSS Distributions#define	makedev(x,y)	((dev_t)(((x)<<8) | (y)))
61*5c2921b0SApple OSS Distributions#endif
62*5c2921b0SApple OSS Distributions
63*5c2921b0SApple OSS Distributionstypedef	unsigned char	u_char;
64*5c2921b0SApple OSS Distributionstypedef	unsigned short	u_short;
65*5c2921b0SApple OSS Distributionstypedef	unsigned int	u_int;
66*5c2921b0SApple OSS Distributionstypedef	unsigned long	u_long;
67*5c2921b0SApple OSS Distributionstypedef	unsigned short	ushort;		/* Sys V compatibility */
68*5c2921b0SApple OSS Distributions
69*5c2921b0SApple OSS Distributions#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
70*5c2921b0SApple OSS Distributions#include <machine/types.h>
71*5c2921b0SApple OSS Distributions#endif
72*5c2921b0SApple OSS Distributions
73*5c2921b0SApple OSS Distributions#ifdef	_CLOCK_T_
74*5c2921b0SApple OSS Distributionstypedef	_CLOCK_T_	clock_t;
75*5c2921b0SApple OSS Distributions#undef	_CLOCK_T_
76*5c2921b0SApple OSS Distributions#endif
77*5c2921b0SApple OSS Distributions
78*5c2921b0SApple OSS Distributions#ifdef	_SIZE_T_
79*5c2921b0SApple OSS Distributionstypedef	_SIZE_T_	size_t;
80*5c2921b0SApple OSS Distributions#undef	_SIZE_T_
81*5c2921b0SApple OSS Distributions#endif
82*5c2921b0SApple OSS Distributions
83*5c2921b0SApple OSS Distributions#ifdef	_TIME_T_
84*5c2921b0SApple OSS Distributionstypedef	_TIME_T_	time_t;
85*5c2921b0SApple OSS Distributions#undef	_TIME_T_
86*5c2921b0SApple OSS Distributions#endif
87*5c2921b0SApple OSS Distributions
88*5c2921b0SApple OSS Distributionstypedef	u_int64_t	u_quad_t;
89*5c2921b0SApple OSS Distributionstypedef	int64_t		quad_t
90*5c2921b0SApple OSS Distributionstypedef	quad_t *	qaddr_t;	/* should be typedef quad * qaddr_t; */
91*5c2921b0SApple OSS Distributions
92*5c2921b0SApple OSS Distributionstypedef	long	daddr_t;
93*5c2921b0SApple OSS Distributionstypedef	char *	caddr_t;
94*5c2921b0SApple OSS Distributions#ifdef _DARWIN_FEATURE_64_BIT_INODE
95*5c2921b0SApple OSS Distributionstypedef	u_int64_t	ino_t;
96*5c2921b0SApple OSS Distributions#else /* !_DARWIN_FEATURE_64_BIT_INODE */
97*5c2921b0SApple OSS Distributionstypedef	u_int		ino_t;
98*5c2921b0SApple OSS Distributions#endif /* _DARWIN_FEATURE_64_BIT_INODE */
99*5c2921b0SApple OSS Distributionstypedef	long	swblk_t;
100*5c2921b0SApple OSS Distributionstypedef	long	segsz_t;
101*5c2921b0SApple OSS Distributionstypedef	int64_t	off_t;
102*5c2921b0SApple OSS Distributionstypedef	u_int	uid_t;
103*5c2921b0SApple OSS Distributionstypedef	u_int	gid_t;
104*5c2921b0SApple OSS Distributionstypedef	int	pid_t;
105*5c2921b0SApple OSS Distributionstypedef	u_short	nlink_t;
106*5c2921b0SApple OSS Distributionstypedef	u_short	mode_t;
107*5c2921b0SApple OSS Distributionstypedef u_long	fixpt_t;
108*5c2921b0SApple OSS Distributions
109*5c2921b0SApple OSS Distributions#ifndef _POSIX_SOURCE
110*5c2921b0SApple OSS Distributions#define	NBBY	8		/* number of bits in a byte */
111*5c2921b0SApple OSS Distributions
112*5c2921b0SApple OSS Distributions/*
113*5c2921b0SApple OSS Distributions * Select uses bit masks of file descriptors in longs.  These macros
114*5c2921b0SApple OSS Distributions * manipulate such bit fields (the filesystem macros use chars).
115*5c2921b0SApple OSS Distributions * FD_SETSIZE may be defined by the user, but the default here should
116*5c2921b0SApple OSS Distributions * be >= NOFILE (param.h).
117*5c2921b0SApple OSS Distributions */
118*5c2921b0SApple OSS Distributions#ifndef	FD_SETSIZE
119*5c2921b0SApple OSS Distributions#define	FD_SETSIZE	1024
120*5c2921b0SApple OSS Distributions#endif
121*5c2921b0SApple OSS Distributions
122*5c2921b0SApple OSS Distributionstypedef long	fd_mask;
123*5c2921b0SApple OSS Distributions#define NFDBITS	(sizeof(fd_mask) * NBBY)	/* bits per mask */
124*5c2921b0SApple OSS Distributions
125*5c2921b0SApple OSS Distributions#ifndef howmany
126*5c2921b0SApple OSS Distributions#define	howmany(x, y)	(((x)+((y)-1))/(y))
127*5c2921b0SApple OSS Distributions#endif
128*5c2921b0SApple OSS Distributions
129*5c2921b0SApple OSS Distributionstypedef	struct fd_set {
130*5c2921b0SApple OSS Distributions	fd_mask	fds_bits[howmany(FD_SETSIZE, NFDBITS)];
131*5c2921b0SApple OSS Distributions} fd_set;
132*5c2921b0SApple OSS Distributions
133*5c2921b0SApple OSS Distributions#define	FD_SET(n, p)	((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS)))
134*5c2921b0SApple OSS Distributions#define	FD_CLR(n, p)	((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS)))
135*5c2921b0SApple OSS Distributions#define	FD_ISSET(n, p)	((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS)))
136*5c2921b0SApple OSS Distributions#define	FD_COPY(f, t)	bcopy(f, t, sizeof(*(f)))
137*5c2921b0SApple OSS Distributions#define	FD_ZERO(p)	bzero((char *)(p), sizeof(*(p)))
138*5c2921b0SApple OSS Distributions
139*5c2921b0SApple OSS Distributions#endif /* !_POSIX_SOURCE */
140*5c2921b0SApple OSS Distributions#endif /* !_TYPES_H_ */
141*5c2921b0SApple OSS Distributions.Ed
142*5c2921b0SApple OSS Distributions.Sh SEE ALSO
143*5c2921b0SApple OSS Distributions.Xr adb 1 ,
144*5c2921b0SApple OSS Distributions.Xr lseek 2 ,
145*5c2921b0SApple OSS Distributions.Xr time 3 ,
146*5c2921b0SApple OSS Distributions.Xr fs 5
147*5c2921b0SApple OSS Distributions.Sh HISTORY
148*5c2921b0SApple OSS DistributionsA
149*5c2921b0SApple OSS Distributions.Nm
150*5c2921b0SApple OSS Distributionsfile appeared in
151*5c2921b0SApple OSS Distributions.At v7 .
152