Date: Fri, 7 Aug 2020 16:03:55 +0000 (UTC) From: Alex Richardson <arichardson@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364022 - in head: cddl/contrib/opensolaris/lib/libctf/common cddl/contrib/opensolaris/tools/ctf/cvt sys/cddl/compat/opensolaris/sys sys/cddl/contrib/opensolaris/uts/common/sys Message-ID: <202008071603.077G3tTv025902@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: arichardson Date: Fri Aug 7 16:03:55 2020 New Revision: 364022 URL: https://svnweb.freebsd.org/changeset/base/364022 Log: Fix cddl tools bootstrapping on macOS and Linux Reviewed By: brooks Differential Revision: https://reviews.freebsd.org/D25979 Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h head/sys/cddl/compat/opensolaris/sys/stat.h head/sys/cddl/compat/opensolaris/sys/time.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Modified: head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Fri Aug 7 16:01:05 2020 (r364021) +++ head/cddl/contrib/opensolaris/lib/libctf/common/ctf_lib.c Fri Aug 7 16:03:55 2020 (r364022) @@ -27,6 +27,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <sys/types.h> +#include <sys/endian.h> #include <sys/stat.h> #include <sys/mman.h> #include <sys/zmod.h> Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h ============================================================================== --- head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Fri Aug 7 16:01:05 2020 (r364021) +++ head/cddl/contrib/opensolaris/tools/ctf/cvt/ctftools.h Fri Aug 7 16:03:55 2020 (r364022) @@ -38,6 +38,7 @@ #include <pthread.h> #include <sys/ccompile.h> +#include <sys/endian.h> #ifdef __cplusplus extern "C" { @@ -63,6 +64,15 @@ extern "C" { #ifndef MIN #define MIN(a, b) ((a) > (b) ? (b) : (a)) +#endif + +/* Sanity check for cross-build bootstrap tools */ +#if !defined(BYTE_ORDER) +#error "Missing BYTE_ORDER defines" +#elif !defined(_LITTLE_ENDIAN) +#error "Missing _LITTLE_ENDIAN defines" +#elif !defined(_BIG_ENDIAN) +#error "Missing _BIG_ENDIAN defines" #endif #define TRUE 1 Modified: head/sys/cddl/compat/opensolaris/sys/stat.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/stat.h Fri Aug 7 16:01:05 2020 (r364021) +++ head/sys/cddl/compat/opensolaris/sys/stat.h Fri Aug 7 16:03:55 2020 (r364022) @@ -32,11 +32,19 @@ #include_next <sys/stat.h> +/* + * When bootstrapping on Linux a stat64/fstat64 functions exists in both + * glibc and musl libc. To avoid compilation errors, use those functions instead + * of redefining them to stat/fstat. + * Similarly, macOS provides (deprecated) stat64 functions that we can use + * for now. + */ +#if !defined(__linux__) && !defined(__APPLE__) #define stat64 stat #define MAXOFFSET_T OFF_MAX -#ifndef _KERNEL +#if !defined(_KERNEL) #include <sys/disk.h> static __inline int @@ -51,6 +59,7 @@ fstat64(int fd, struct stat *sb) } return (ret); } -#endif +#endif /* !defined(_KERNEL) */ +#endif /* !defined(__linux__) && !defined(__APPLE__) */ #endif /* !_COMPAT_OPENSOLARIS_SYS_STAT_H_ */ Modified: head/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- head/sys/cddl/compat/opensolaris/sys/time.h Fri Aug 7 16:01:05 2020 (r364021) +++ head/sys/cddl/compat/opensolaris/sys/time.h Fri Aug 7 16:03:55 2020 (r364022) @@ -29,6 +29,7 @@ #ifndef _OPENSOLARIS_SYS_TIME_H_ #define _OPENSOLARIS_SYS_TIME_H_ +#include <sys/types.h> #include_next <sys/time.h> #define SEC 1 Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Fri Aug 7 16:01:05 2020 (r364021) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h Fri Aug 7 16:03:55 2020 (r364022) @@ -46,8 +46,12 @@ extern "C" { /* * Disk blocks (sectors) and bytes. */ +#ifndef dtob #define dtob(DD) ((DD) << DEV_BSHIFT) +#endif +#ifndef btod #define btod(BB) (((BB) + DEV_BSIZE - 1) >> DEV_BSHIFT) +#endif #define btodt(BB) ((BB) >> DEV_BSHIFT) #define lbtod(BB) (((offset_t)(BB) + DEV_BSIZE - 1) >> DEV_BSHIFT) @@ -220,9 +224,12 @@ extern unsigned char bcd_to_byte[256]; /* * Macros for counting and rounding. */ +#ifndef howmany #define howmany(x, y) (((x)+((y)-1))/(y)) +#endif +#ifndef roundup #define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) - +#endif /* * Macro to determine if value is a power of 2 */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008071603.077G3tTv025902>