Page MenuHomeFreeBSD

D31962.1789741602.diff
No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None

D31962.1789741602.diff

Index: include/Makefile
===================================================================
--- include/Makefile
+++ include/Makefile
@@ -11,8 +11,8 @@
SUBDIR_PARALLEL=
INCS= a.out.h ar.h assert.h bitstring.h complex.h cpio.h _ctype.h ctype.h \
db.h \
- dirent.h dlfcn.h elf.h elf-hints.h err.h fmtmsg.h fnmatch.h fstab.h \
- fts.h ftw.h getopt.h glob.h grp.h \
+ dirent.h dlfcn.h elf.h elf-hints.h endian.h err.h fmtmsg.h fnmatch.h \
+ fstab.h fts.h ftw.h getopt.h glob.h grp.h \
ieeefp.h ifaddrs.h \
inttypes.h iso646.h kenv.h langinfo.h libgen.h limits.h link.h \
locale.h malloc.h malloc_np.h memory.h monetary.h mpool.h mqueue.h \
Index: include/endian.h
===================================================================
--- /dev/null
+++ include/endian.h
@@ -0,0 +1,43 @@
+/*-
+ * Copyright (c) 2021 M Warner Losh <imp@FreeBSD.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+/*
+ * A mostly compatible with Linux/glibc endian.h
+ */
+
+#ifndef _ENDIAN_H_
+#define _ENDIAN_H_
+
+/*
+ * FreeBSD's sys/endian.h is very close to the Linux. Linux doesn't define the
+ * hto* [bl]*toh macros when there's a strict name space. It also defines some
+ * extra *dec and *enc functions, which Linux does not. At the moment, we accept
+ * these differences rather than complicate sys/endian.h further.
+ */
+#include <sys/endian.h>
+
+/*
+ * glibc uses double underscore for these symbols. Define these unconditionally.
+ * The compiler defines __BYTE_ORDER__ these days, so we don't do anything
+ * with that.
+ */
+#define __BIG_ENDIAN _BIG_ENDIAN
+#define __BYTE_ORDER _BYTE_ORDER
+#define __LITTLE_ENDIAN _LITTLE_ENDIAN
+#define __PDP_ENDIAN _PDP_ENDIAN
+
+/*
+ * FreeBSD's sys/endian.h and machine/endian.h doesn't define a separate
+ * byte order for floats. Use the host non-float byte order.
+ */
+#define __FLOAT_WORD_ORDER _BYTE_ORDER
+
+/*
+ * We don't define BIG_ENDI, LITTLE_ENDI, HIGH_HALF and LOW_HALF
+ * since those appear to be internal to internal to glibc
+ */
+
+#endif /* _ENDIAN_H_ */

File Metadata

Mime Type
text/plain
Expires
Fri, Sep 18, 2:26 PM (1 h, 4 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29758083
Default Alt Text
D31962.1789741602.diff (1 KB)

Event Timeline