nrelease - fix/improve livecd
[dragonfly.git] / sys / sys / stdint.h
CommitLineData
e2565a42 1/*
6b2b0a8b 2 * Copyright (c) 2019 The DragonFly Project. All rights reserved.
e2565a42 3 *
6b2b0a8b 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
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.
12 *
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
24 * SUCH DAMAGE.
e2565a42
MD
25 */
26
e2565a42 27#ifndef _SYS_STDINT_H_
6b2b0a8b 28#define _SYS_STDINT_H_
e2565a42 29
eaf07fa9 30#ifndef _SYS_CDEFS_H_
fc3e0c02 31#include <sys/cdefs.h>
eaf07fa9 32#endif
fc3e0c02
SW
33#include <machine/stdint.h>
34
6b2b0a8b 35/*
36 * Proxy header for kernel compilation. Do not include outside kernel
37 * headers. Userland should use <stdint.h> instead.
38 *
39 * This header is not a convenient placeholder for non integer types.
40 */
41
42#ifdef _KERNEL
eaf07fa9 43#include <machine/int_limits.h>
44
6b2b0a8b 45typedef __boolean_t boolean_t; /* kernel only */
46
47#if !defined(__bool_true_false_are_defined) && !defined(__cplusplus)
48#define __bool_true_false_are_defined 1
49#define false 0
50#define true 1
541bbbd7 51#if __STDC_VERSION__ < 199901L && !__GNUC_PREREQ__(3, 0)
6b2b0a8b 52typedef int _Bool;
53#endif
54typedef _Bool bool;
55#endif /* !__bool_true_false_are_defined && !__cplusplus */
56
57#define offsetof(type, field) __offsetof(type, field)
58
59#ifndef _PTRDIFF_T_DECLARED
60typedef __ptrdiff_t ptrdiff_t; /* ptr1 - ptr2 for kernel */
61#define _PTRDIFF_T_DECLARED
62#endif
eaf07fa9 63
64typedef __int8_t int8_t;
65typedef __int16_t int16_t;
66typedef __int32_t int32_t;
67typedef __int64_t int64_t;
68
9014ed32 69#ifndef _UINT8_T_DECLARED
eaf07fa9 70typedef __uint8_t uint8_t;
9014ed32
SW
71#define _UINT8_T_DECLARED
72#endif
73#ifndef _UINT16_T_DECLARED
eaf07fa9 74typedef __uint16_t uint16_t;
9014ed32
SW
75#define _UINT16_T_DECLARED
76#endif
77#ifndef _UINT32_T_DECLARED
eaf07fa9 78typedef __uint32_t uint32_t;
9014ed32
SW
79#define _UINT32_T_DECLARED
80#endif
81#ifndef _UINT64_T_DECLARED
eaf07fa9 82typedef __uint64_t uint64_t;
9014ed32
SW
83#define _UINT64_T_DECLARED
84#endif
eaf07fa9 85
86#ifndef _INTPTR_T_DECLARED
87typedef __intptr_t intptr_t; /* VKERNEL uses <unistd.h> */
88#define _INTPTR_T_DECLARED
89#endif
90typedef __uintptr_t uintptr_t;
91
92typedef __intmax_t intmax_t;
93typedef __uintmax_t uintmax_t;
6b2b0a8b 94#endif /* _KERNEL */
95
eaf07fa9 96#ifndef _KERNEL
97#ifndef _STDINT_H_
98#include <stdint.h> /* in case we still need it */
99#endif
100#endif /* !_KERNEL */
101
6b2b0a8b 102#endif /* !_SYS_STDINT_H_ */