xref: /f-stack/tools/compat/include/sys/_types.h (revision d4a07e70)
1 /*-
2  * Copyright (c) 2002 Mike Barcroft <[email protected]>
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24  * SUCH DAMAGE.
25  *
26  * $FreeBSD$
27  */
28 
29 #ifndef _COMPAT_SYS__TYPES_H_
30 #define _COMPAT_SYS__TYPES_H_
31 
32 #include <sys/cdefs.h>
33 #include <sys/types.h>
34 #include <stdint.h>
35 
36 /*
37  * Standard type definitions.
38  */
39 typedef	__int64_t	__blkcnt_t;	/* file block count */
40 typedef	__int32_t	__clockid_t;	/* clock_gettime()... */
41 typedef	__uint32_t	__fflags_t;	/* file flags */
42 typedef	__uint64_t	__fsblkcnt_t;
43 typedef	__uint64_t	__fsfilcnt_t;
44 typedef	__uint32_t	__gid_t;
45 typedef	__int32_t	__lwpid_t;	/* Thread ID (a.k.a. LWP) */
46 typedef	int		__accmode_t;	/* access permissions */
47 typedef	int		__nl_item;
48 typedef	__int64_t	__off_t;	/* file offset */
49 typedef	__int64_t	__off64_t;	/* file offset (alias) */
50 typedef	__int32_t	__pid_t;	/* process [group] */
51 typedef	__uint8_t	__sa_family_t;
52 typedef	__uint32_t	__socklen_t;
53 typedef	long		__suseconds_t;	/* microseconds (signed) */
54 typedef	struct __mq	*__mqd_t;	/* mq_open()... */
55 typedef	__uint32_t	__uid_t;
56 typedef	unsigned int	__useconds_t;	/* microseconds (unsigned) */
57 typedef	int		__cpuwhich_t;	/* which parameter for cpuset. */
58 typedef	int		__cpulevel_t;	/* level parameter for cpuset. */
59 typedef int		__cpusetid_t;	/* cpuset identifier. */
60 
61 /*
62  * Unusual type definitions.
63  */
64 /*
65  * rune_t is declared to be an ``int'' instead of the more natural
66  * ``unsigned long'' or ``long''.  Two things are happening here.  It is not
67  * unsigned so that EOF (-1) can be naturally assigned to it and used.  Also,
68  * it looks like 10646 will be a 31 bit standard.  This means that if your
69  * ints cannot hold 32 bits, you will be in trouble.  The reason an int was
70  * chosen over a long is that the is*() and to*() routines take ints (says
71  * ANSI C), but they use __ct_rune_t instead of int.
72  *
73  * NOTE: rune_t is not covered by ANSI nor other standards, and should not
74  * be instantiated outside of lib/libc/locale.  Use wchar_t.  wint_t and
75  * rune_t must be the same type.  Also, wint_t should be able to hold all
76  * members of the largest character set plus one extra value (WEOF), and
77  * must be at least 16 bits.
78  */
79 typedef	int		__ct_rune_t;	/* arg type for ctype funcs */
80 typedef	__ct_rune_t	__rune_t;	/* rune_t (see above) */
81 typedef	__ct_rune_t	__wint_t;	/* wint_t (see above) */
82 
83 typedef	__uint32_t	__fixpt_t;	/* fixed point number */
84 
85 typedef	__int64_t	sbintime_t;
86 
87 typedef	__uint64_t	__vm_offset_t;
88 typedef	__int64_t	__vm_ooffset_t;
89 typedef	__uint64_t	__vm_paddr_t;
90 typedef	__uint64_t	__vm_pindex_t;
91 typedef	__uint64_t	__vm_size_t;
92 
93 typedef	__vm_offset_t	vm_offset_t;
94 typedef	__vm_ooffset_t	vm_ooffset_t;
95 typedef	__vm_paddr_t	vm_paddr_t;
96 typedef	__vm_pindex_t	vm_pindex_t;
97 typedef	__vm_size_t	vm_size_t;
98 
99 typedef	__cpuwhich_t	cpuwhich_t;
100 typedef	__cpulevel_t	cpulevel_t;
101 typedef	__cpusetid_t	cpusetid_t;
102 
103 #ifndef _UID_T_DECLARED
104 typedef	__uid_t		uid_t;		/* user id */
105 #define	_UID_T_DECLARED
106 #endif
107 
108 typedef	__int64_t	__segsz_t;		/* segment size (in pages) */
109 typedef	__segsz_t	segsz_t;	/* segment size (in pages) */
110 
111 typedef	__uint32_t	__fixpt_t;	/* fixed point number */
112 typedef	__fixpt_t	fixpt_t;	/* fixed point number */
113 
114 typedef	__int32_t	__lwpid_t;	/* Thread ID (a.k.a. LWP) */
115 #ifndef _LWPID_T_DECLARED
116 typedef	__lwpid_t	lwpid_t;	/* Thread ID (a.k.a. LWP) */
117 #define	_LWPID_T_DECLARED
118 #endif
119 
120 typedef	__uint64_t	kpaddr_t;
121 typedef	__uint64_t	kvaddr_t;
122 typedef	__uint64_t	ksize_t;
123 typedef	__int64_t	kssize_t;
124 
125 #endif /* !_COMPAT_SYS__TYPES_H_ */
126