2 * Copyright (c) 2019 The DragonFly Project. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
14 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
15 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
16 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
17 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
19 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
21 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
23 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 #ifndef _SYS_STDINT_H_
28 #define _SYS_STDINT_H_
31 #include <sys/cdefs.h>
33 #include <machine/stdint.h>
36 * Proxy header for kernel compilation. Do not include outside kernel
37 * headers. Userland should use <stdint.h> instead.
39 * This header is not a convenient placeholder for non integer types.
43 #include <machine/int_limits.h>
45 typedef __boolean_t boolean_t; /* kernel only */
47 #if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
48 #define __bool_true_false_are_defined 1
51 #if __STDC_VERSION__ < 199901L && !__GNUC_PREREQ__(3, 0)
55 #endif /* !__bool_true_false_are_defined && !__cplusplus */
57 #define offsetof(type, field) __offsetof(type, field)
59 #ifndef _PTRDIFF_T_DECLARED
60 typedef __ptrdiff_t ptrdiff_t; /* ptr1 - ptr2 for kernel */
61 #define _PTRDIFF_T_DECLARED
64 typedef __int8_t int8_t;
65 typedef __int16_t int16_t;
66 typedef __int32_t int32_t;
67 typedef __int64_t int64_t;
69 #ifndef _UINT8_T_DECLARED
70 typedef __uint8_t uint8_t;
71 #define _UINT8_T_DECLARED
73 #ifndef _UINT16_T_DECLARED
74 typedef __uint16_t uint16_t;
75 #define _UINT16_T_DECLARED
77 #ifndef _UINT32_T_DECLARED
78 typedef __uint32_t uint32_t;
79 #define _UINT32_T_DECLARED
81 #ifndef _UINT64_T_DECLARED
82 typedef __uint64_t uint64_t;
83 #define _UINT64_T_DECLARED
86 #ifndef _INTPTR_T_DECLARED
87 typedef __intptr_t intptr_t; /* VKERNEL uses <unistd.h> */
88 #define _INTPTR_T_DECLARED
90 typedef __uintptr_t uintptr_t;
92 typedef __intmax_t intmax_t;
93 typedef __uintmax_t uintmax_t;
98 #include <stdint.h> /* in case we still need it */
100 #endif /* !_KERNEL */
102 #endif /* !_SYS_STDINT_H_ */