1 /*- 2 * SPDX-License-Identifier: BSD-2-Clause 3 * 4 * Copyright 2018-2020 Alex Richardson <arichardson@FreeBSD.org> 5 * 6 * This software was developed by SRI International and the University of 7 * Cambridge Computer Laboratory (Department of Computer Science and 8 * Technology) under DARPA contract HR0011-18-C-0016 ("ECATS"), as part of the 9 * DARPA SSITH research programme. 10 * 11 * This software was developed by SRI International and the University of 12 * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) 13 * ("CTSRD"), as part of the DARPA CRASH research programme. 14 * 15 * Redistribution and use in source and binary forms, with or without 16 * modification, are permitted provided that the following conditions 17 * are met: 18 * 1. Redistributions of source code must retain the above copyright 19 * notice, this list of conditions and the following disclaimer. 20 * 2. Redistributions in binary form must reproduce the above copyright 21 * notice, this list of conditions and the following disclaimer in the 22 * documentation and/or other materials provided with the distribution. 23 * 24 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 34 * SUCH DAMAGE. 35 */ 36 #pragma once 37 38 #include <sys/cdefs.h> /* FreeBSD source assumes sys/types.h includes this */ 39 /* 40 * MUSL doesn't define the __intXX_t that FreeBSD does, but many of our headers 41 * assume that will always be present. Define them here. We assume !defined 42 * __GLIBC__ is musl since musl doesn't have a define to key off of. Thesee 43 * typedefs look backwards, but it's not circular because MUSL never defines the 44 * __*int*_t. Also, we don't have to work in the kernel, so it's OK to include 45 * stdint.h here. 46 */ 47 #ifndef __GLIBC__ 48 #include <stdint.h> 49 typedef int64_t __int64_t; 50 typedef int32_t __int32_t; 51 typedef int16_t __int16_t; 52 typedef int8_t __int8_t; 53 typedef uint64_t __uint64_t; 54 typedef uint32_t __uint32_t; 55 typedef uint16_t __uint16_t; 56 typedef uint8_t __uint8_t; 57 #endif 58 59 #include_next <sys/types.h> 60 61 /* 62 * stddef.h for both gcc and clang will define __size_t when size_t has 63 * been defined (except on *BSD where it doesn't touch __size_t). So if 64 * we're building on Linux, we know that if that's not defined, we have 65 * to typedef __size_t for FreeBSD's use of __size_t in places to work 66 * during bootstrapping. 67 */ 68 #ifndef __size_t 69 typedef __SIZE_TYPE__ __size_t; 70 #endif 71