Files
haikuports/net-dns/bind_utils/patches/bind_utils-9.16.19.patchset
Alexander von Gluck IV a97e9d4d9c bind_utils: Add initial port work. Not 100% yet
* Provides the standard dig,host,nslookup tools
* While working, it's having trouble finding haiku's
  default resolvers.  Manually passing @8.8.8.8 fixes
  resolution and it works as expected
* Flagged unknown on all platforms for now
2021-08-03 13:48:05 -05:00

76 lines
2.3 KiB
Plaintext

From 63a8d2da718c751d8d4134b8cb9a66c80216fbfe Mon Sep 17 00:00:00 2001
From: Alexander von Gluck IV <kallisti5@unixzen.com>
Date: Tue, 3 Aug 2021 13:10:12 -0500
Subject: [PATCH] haiku: patch in our endian code
* There's likely better ways to do this with
_BSD_SOURCE, but I wasn't able to get the standard
methods working
---
lib/isc/include/isc/endian.h | 49 +++++++++++++++++++++++++++++++++++-
1 file changed, 48 insertions(+), 1 deletion(-)
diff --git a/lib/isc/include/isc/endian.h b/lib/isc/include/isc/endian.h
index dc770f6..e1a3c50 100644
--- a/lib/isc/include/isc/endian.h
+++ b/lib/isc/include/isc/endian.h
@@ -11,7 +11,54 @@
#pragma once
-#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
+#if defined(__HAIKU__)
+
+#include <config/HaikuConfig.h>
+#include <support/ByteOrder.h>
+#include <support/SupportDefs.h>
+
+/*
+ * General byte order swapping functions.
+ */
+#define bswap16(x) __swap_int16(x)
+#define bswap32(x) __swap_int32(x)
+#define bswap64(x) __swap_int64(x)
+
+/*
+ * Host to big endian, host to little endian, big endian to host, and little
+ * endian to host byte order functions as detailed in byteorder(9).
+ */
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define htobe16(x) bswap16((x))
+#define htobe32(x) bswap32((x))
+#define htobe64(x) bswap64((x))
+#define htole16(x) ((uint16_t)(x))
+#define htole32(x) ((uint32_t)(x))
+#define htole64(x) ((uint64_t)(x))
+
+#define be16toh(x) bswap16((x))
+#define be32toh(x) bswap32((x))
+#define be64toh(x) bswap64((x))
+#define le16toh(x) ((uint16_t)(x))
+#define le32toh(x) ((uint32_t)(x))
+#define le64toh(x) ((uint64_t)(x))
+#else /* BYTE_ORDER != LITTLE_ENDIAN */
+#define htobe16(x) ((uint16_t)(x))
+#define htobe32(x) ((uint32_t)(x))
+#define htobe64(x) ((uint64_t)(x))
+#define htole16(x) bswap16((x))
+#define htole32(x) bswap32((x))
+#define htole64(x) bswap64((x))
+
+#define be16toh(x) ((uint16_t)(x))
+#define be32toh(x) ((uint32_t)(x))
+#define be64toh(x) ((uint64_t)(x))
+#define le16toh(x) bswap16((x))
+#define le32toh(x) bswap32((x))
+#define le64toh(x) bswap64((x))
+#endif /* BYTE_ORDER == LITTLE_ENDIAN */
+
+#elif defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(__OpenBSD__) || defined(__bsdi__)
#include <sys/endian.h>
--
2.30.2