diff options
Diffstat (limited to 'tools/build/cross-build/include/linux')
34 files changed, 110 insertions, 82 deletions
diff --git a/tools/build/cross-build/include/linux/__unused_workaround_end.h b/tools/build/cross-build/include/linux/__unused_workaround_end.h index eaf3d3a8f836..728e25ead9b0 100644 --- a/tools/build/cross-build/include/linux/__unused_workaround_end.h +++ b/tools/build/cross-build/include/linux/__unused_workaround_end.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* Used to workaround system headers with struct members called __unused */ #ifdef __unused_undefd diff --git a/tools/build/cross-build/include/linux/__unused_workaround_start.h b/tools/build/cross-build/include/linux/__unused_workaround_start.h index 2f0ab003ad24..e01d5fc9971d 100644 --- a/tools/build/cross-build/include/linux/__unused_workaround_start.h +++ b/tools/build/cross-build/include/linux/__unused_workaround_start.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* Used to workaround system headers with struct members called __unused */ #ifdef __unused diff --git a/tools/build/cross-build/include/linux/__used_workaround_end.h b/tools/build/cross-build/include/linux/__used_workaround_end.h index 99cc6c16ac26..d38c5711a30d 100644 --- a/tools/build/cross-build/include/linux/__used_workaround_end.h +++ b/tools/build/cross-build/include/linux/__used_workaround_end.h @@ -33,8 +33,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* Used to workaround system headers with struct members called __used */ #ifdef __used_undefd diff --git a/tools/build/cross-build/include/linux/__used_workaround_start.h b/tools/build/cross-build/include/linux/__used_workaround_start.h index ee290ce30169..c81e9c67248e 100644 --- a/tools/build/cross-build/include/linux/__used_workaround_start.h +++ b/tools/build/cross-build/include/linux/__used_workaround_start.h @@ -33,8 +33,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* Used to workaround system headers with struct members called __used */ #ifdef __used diff --git a/tools/build/cross-build/include/linux/ctype.h b/tools/build/cross-build/include/linux/ctype.h index fbd30580d1a9..afacebfbad91 100644 --- a/tools/build/cross-build/include/linux/ctype.h +++ b/tools/build/cross-build/include/linux/ctype.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include_next <ctype.h> diff --git a/tools/build/cross-build/include/linux/endian.h b/tools/build/cross-build/include/linux/endian.h index 92adf095636a..f4fc6855b398 100644 --- a/tools/build/cross-build/include/linux/endian.h +++ b/tools/build/cross-build/include/linux/endian.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include_next <endian.h> diff --git a/tools/build/cross-build/include/linux/errno.h b/tools/build/cross-build/include/linux/errno.h index 37f166aebabf..b05c6bb02aae 100644 --- a/tools/build/cross-build/include/linux/errno.h +++ b/tools/build/cross-build/include/linux/errno.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include_next <errno.h> diff --git a/tools/build/cross-build/include/linux/fcntl.h b/tools/build/cross-build/include/linux/fcntl.h index 4fa169d4ed4c..e5718ce5e3ed 100644 --- a/tools/build/cross-build/include/linux/fcntl.h +++ b/tools/build/cross-build/include/linux/fcntl.h @@ -35,8 +35,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once @@ -46,3 +44,10 @@ #include "__unused_workaround_end.h" #include <sys/file.h> + +/* + * On FreeBSD fcntl.h indirectly brings in cdefs.h. On Linux with musl, it does + * not. It's needed in our fcntl.h for the cross build since we use + * __BEGIN_DECLS and __END_DECLS from it there. + */ +#include <sys/cdefs.h> diff --git a/tools/build/cross-build/include/linux/libutil.h b/tools/build/cross-build/include/linux/libutil.h index 7a448babb9a8..a1d6508be82d 100644 --- a/tools/build/cross-build/include/linux/libutil.h +++ b/tools/build/cross-build/include/linux/libutil.h @@ -32,12 +32,9 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once -#include <sys/cdefs.h> #include <sys/types.h> #include <sys/socket.h> @@ -49,7 +46,7 @@ struct pidfh; __BEGIN_DECLS int humanize_number(char *buf, size_t len, int64_t bytes, const char *suffix, int scale, int flags); -int expand_number(const char *_buf, uint64_t *_num); +int expand_number(const char *_buf, int64_t *_num); int flopen(const char *_path, int _flags, ...); int flopenat(int dirfd, const char *path, int flags, ...); diff --git a/tools/build/cross-build/include/linux/limits.h b/tools/build/cross-build/include/linux/limits.h index 833b49b49348..4631cabb1104 100644 --- a/tools/build/cross-build/include/linux/limits.h +++ b/tools/build/cross-build/include/linux/limits.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #if __has_include_next(<limits.h>) #include_next <limits.h> @@ -47,13 +45,11 @@ #if !defined(_GNU_SOURCE) #warning "Attempting to use limits.h with -std=c89/without _GNU_SOURCE, many macros will be missing" #endif +#endif /* C89 */ -#else /* Not C89 */ -/* Not C89 -> check that all macros that we expect are defined */ #ifndef IOV_MAX #error IOV_MAX should be defined #endif -#endif /* C89 */ #ifndef MAXBSIZE #define MAXBSIZE 65536 /* must be power of 2 */ @@ -85,7 +81,6 @@ #endif #include <sys/types.h> -#include <sys/uio.h> /* For IOV_MAX */ /* Sanity checks for glibc */ #ifndef _GNU_SOURCE diff --git a/tools/build/cross-build/include/linux/nbtool_config.h b/tools/build/cross-build/include/linux/nbtool_config.h index a3c39308a62f..d99b39739a48 100644 --- a/tools/build/cross-build/include/linux/nbtool_config.h +++ b/tools/build/cross-build/include/linux/nbtool_config.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/netdb.h b/tools/build/cross-build/include/linux/netdb.h index e1832cca3efa..2680b4736982 100644 --- a/tools/build/cross-build/include/linux/netdb.h +++ b/tools/build/cross-build/include/linux/netdb.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/regex.h b/tools/build/cross-build/include/linux/regex.h index a27053750c3e..858e26386653 100644 --- a/tools/build/cross-build/include/linux/regex.h +++ b/tools/build/cross-build/include/linux/regex.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include_next <regex.h> diff --git a/tools/build/cross-build/include/linux/resolv.h b/tools/build/cross-build/include/linux/resolv.h index 99652b78825b..4d075a05ffa5 100644 --- a/tools/build/cross-build/include/linux/resolv.h +++ b/tools/build/cross-build/include/linux/resolv.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include_next <resolv.h> diff --git a/tools/build/cross-build/include/linux/signal.h b/tools/build/cross-build/include/linux/signal.h index 5d4cdcd19fab..177c7f6169f0 100644 --- a/tools/build/cross-build/include/linux/signal.h +++ b/tools/build/cross-build/include/linux/signal.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/spawn.h b/tools/build/cross-build/include/linux/spawn.h index 873add3275af..a9b9f8de97a0 100644 --- a/tools/build/cross-build/include/linux/spawn.h +++ b/tools/build/cross-build/include/linux/spawn.h @@ -36,8 +36,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/stdio.h b/tools/build/cross-build/include/linux/stdio.h index c5aa893b320c..202b65508aeb 100644 --- a/tools/build/cross-build/include/linux/stdio.h +++ b/tools/build/cross-build/include/linux/stdio.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* No #pragam once since glibc can include this multiple times */ diff --git a/tools/build/cross-build/include/linux/stdlib.h b/tools/build/cross-build/include/linux/stdlib.h index 1e559ce1158c..66ac46239a41 100644 --- a/tools/build/cross-build/include/linux/stdlib.h +++ b/tools/build/cross-build/include/linux/stdlib.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include <sys/cdefs.h> diff --git a/tools/build/cross-build/include/linux/string.h b/tools/build/cross-build/include/linux/string.h index 1d173974a5bd..b6d2fe488d40 100644 --- a/tools/build/cross-build/include/linux/string.h +++ b/tools/build/cross-build/include/linux/string.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once @@ -46,11 +44,14 @@ */ #include <stdlib.h> -#include <sys/cdefs.h> +#include <sys/types.h> __BEGIN_DECLS +#if !defined(__GLIBC__) || \ + (defined(__GLIBC__) && (!__GLIBC_PREREQ(2, 38) || !defined(_GNU_SOURCE))) size_t strlcpy(char *dst, const char *src, size_t siz); size_t strlcat(char *dst, const char *src, size_t siz); +#endif char *strnstr(const char *str, const char *find, size_t str_len); void strmode(mode_t mode, char *str); diff --git a/tools/build/cross-build/include/linux/strings.h b/tools/build/cross-build/include/linux/strings.h new file mode 100644 index 000000000000..36e451f277eb --- /dev/null +++ b/tools/build/cross-build/include/linux/strings.h @@ -0,0 +1,38 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright 2022 Jessica Clarke <jrtc27@FreeBSD.org> + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ +#pragma once +#include <sys/cdefs.h> + +#include_next <strings.h> + +__BEGIN_DECLS + +int fls(int) __pure2; +int flsl(long) __pure2; +int flsll(long long) __pure2; + +__END_DECLS diff --git a/tools/build/cross-build/include/linux/sys/disk.h b/tools/build/cross-build/include/linux/sys/disk.h index d4dc46768756..b0cd0ef16609 100644 --- a/tools/build/cross-build/include/linux/sys/disk.h +++ b/tools/build/cross-build/include/linux/sys/disk.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include <sys/mount.h> diff --git a/tools/build/cross-build/include/linux/sys/endian.h b/tools/build/cross-build/include/linux/sys/endian.h index 0c068a4793d5..085b3616c742 100644 --- a/tools/build/cross-build/include/linux/sys/endian.h +++ b/tools/build/cross-build/include/linux/sys/endian.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/sys/filio.h b/tools/build/cross-build/include/linux/sys/filio.h index 9433875ca5ec..7f9ffb8f92a2 100644 --- a/tools/build/cross-build/include/linux/sys/filio.h +++ b/tools/build/cross-build/include/linux/sys/filio.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/sys/ioccom.h b/tools/build/cross-build/include/linux/sys/ioccom.h index a70e20312940..021377abe471 100644 --- a/tools/build/cross-build/include/linux/sys/ioccom.h +++ b/tools/build/cross-build/include/linux/sys/ioccom.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include <sys/ioctl.h> diff --git a/tools/build/cross-build/include/linux/sys/mount.h b/tools/build/cross-build/include/linux/sys/mount.h index be66e8ca5b62..edd8e29da91a 100644 --- a/tools/build/cross-build/include/linux/sys/mount.h +++ b/tools/build/cross-build/include/linux/sys/mount.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include_next <sys/mount.h> diff --git a/tools/build/cross-build/include/linux/sys/param.h b/tools/build/cross-build/include/linux/sys/param.h index 305d2767ae7e..3b29b9ef8430 100644 --- a/tools/build/cross-build/include/linux/sys/param.h +++ b/tools/build/cross-build/include/linux/sys/param.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include_next <sys/param.h> @@ -47,3 +45,5 @@ * let's use 32 since that will work across all systems */ #define MAXLOGNAME 33 /* max login name length (incl. NUL) */ + +#include <sys/types.h> diff --git a/tools/build/cross-build/include/linux/sys/stat.h b/tools/build/cross-build/include/linux/sys/stat.h index 72c6bb950ce9..1a69e127c2e1 100644 --- a/tools/build/cross-build/include/linux/sys/stat.h +++ b/tools/build/cross-build/include/linux/sys/stat.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once /* @@ -60,5 +58,33 @@ #define S_ISTXT S_ISVTX #endif +#ifndef DEFFILEMODE +#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) +#endif + +#ifndef ALLPERMS +#define ALLPERMS (S_ISUID | S_ISGID | S_ISTXT | S_IRWXU | S_IRWXG | S_IRWXO) +#endif + +#define UF_SETTABLE 0x0000ffff +#define UF_NODUMP 0x00000001 +#define UF_IMMUTABLE 0x00000002 +#define UF_APPEND 0x00000004 +#define UF_OPAQUE 0x00000008 +#define UF_NOUNLINK 0x00000010 +#define UF_SYSTEM 0x00000080 +#define UF_SPARSE 0x00000100 +#define UF_OFFLINE 0x00000200 +#define UF_REPARSE 0x00000400 +#define UF_ARCHIVE 0x00000800 +#define UF_READONLY 0x00001000 +#define UF_HIDDEN 0x00008000 +#define SF_SETTABLE 0xffff0000 +#define SF_ARCHIVED 0x00010000 +#define SF_IMMUTABLE 0x00020000 +#define SF_APPEND 0x00040000 +#define SF_NOUNLINK 0x00100000 +#define SF_SNAPSHOT 0x00200000 + /* This include is needed for OpenZFS bootstrap */ #include <sys/mount.h> diff --git a/tools/build/cross-build/include/linux/sys/time.h b/tools/build/cross-build/include/linux/sys/time.h index 1c86bb9ba85d..d78dd401545a 100644 --- a/tools/build/cross-build/include/linux/sys/time.h +++ b/tools/build/cross-build/include/linux/sys/time.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/sys/ttycom.h b/tools/build/cross-build/include/linux/sys/ttycom.h index 8a1f7cf7c3d6..8f2cbf121e42 100644 --- a/tools/build/cross-build/include/linux/sys/ttycom.h +++ b/tools/build/cross-build/include/linux/sys/ttycom.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/sys/types.h b/tools/build/cross-build/include/linux/sys/types.h index b3bb61c1f1fd..2e09cbb62271 100644 --- a/tools/build/cross-build/include/linux/sys/types.h +++ b/tools/build/cross-build/include/linux/sys/types.h @@ -32,13 +32,39 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once +#include <sys/cdefs.h> /* FreeBSD source assumes sys/types.h includes this */ +/* + * MUSL doesn't define the __intXX_t that FreeBSD does, but many of our headers + * assume that will always be present. Define them here. We assume !defined + * __GLIBC__ is musl since musl doesn't have a define to key off of. Thesee + * typedefs look backwards, but it's not circular because MUSL never defines the + * __*int*_t. Also, we don't have to work in the kernel, so it's OK to include + * stdint.h here. + */ +#ifndef __GLIBC__ +#include <stdint.h> +typedef int64_t __int64_t; +typedef int32_t __int32_t; +typedef int16_t __int16_t; +typedef int8_t __int8_t; +typedef uint64_t __uint64_t; +typedef uint32_t __uint32_t; +typedef uint16_t __uint16_t; +typedef uint8_t __uint8_t; +#endif + #include_next <sys/types.h> +/* + * stddef.h for both gcc and clang will define __size_t when size_t has + * been defined (except on *BSD where it doesn't touch __size_t). So if + * we're building on Linux, we know that if that's not defined, we have + * to typedef __size_t for FreeBSD's use of __size_t in places to work + * during bootstrapping. + */ #ifndef __size_t typedef __SIZE_TYPE__ __size_t; #endif diff --git a/tools/build/cross-build/include/linux/sys/ucred.h b/tools/build/cross-build/include/linux/sys/ucred.h index 89f09c7c7d27..35b290bd3dbf 100644 --- a/tools/build/cross-build/include/linux/sys/ucred.h +++ b/tools/build/cross-build/include/linux/sys/ucred.h @@ -32,7 +32,5 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once diff --git a/tools/build/cross-build/include/linux/time.h b/tools/build/cross-build/include/linux/time.h index 189f1f266916..bc3c4c81021b 100644 --- a/tools/build/cross-build/include/linux/time.h +++ b/tools/build/cross-build/include/linux/time.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ /* We can't use #pragma once here since at least the version of time.h * shipped with glibc must be included more than once with different diff --git a/tools/build/cross-build/include/linux/unistd.h b/tools/build/cross-build/include/linux/unistd.h index f518df2ac9ae..ce179724e17b 100644 --- a/tools/build/cross-build/include/linux/unistd.h +++ b/tools/build/cross-build/include/linux/unistd.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once @@ -41,17 +39,9 @@ /* Ensure that unistd.h pulls in getopt */ #define __USE_POSIX2 #endif -/* - * Before version 2.25, glibc's unistd.h would define the POSIX subset of - * getopt.h by defining __need_getopt, including getopt.h (which would - * disable the header guard) and then undefining it so later including - * getopt.h explicitly would define the extensions. However, we wrap getopt, - * and so the wrapper's #pragma once breaks that. Thus getopt.h must be - * included before the real unistd.h to ensure we get all the extensions. - */ -#include <getopt.h> #include_next <unistd.h> #include <fcntl.h> +#include <getopt.h> #include <stdlib.h> #include <string.h> #include <sys/syscall.h> diff --git a/tools/build/cross-build/include/linux/wctype.h b/tools/build/cross-build/include/linux/wctype.h index 8c4a44d8bbe3..044a34fbd16b 100644 --- a/tools/build/cross-build/include/linux/wctype.h +++ b/tools/build/cross-build/include/linux/wctype.h @@ -32,8 +32,6 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * $FreeBSD$ */ #pragma once #include_next <wctype.h> |