]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Add Solaris support for <isc/endian.h>
authorOndřej Surý <ondrej@sury.org>
Mon, 3 Jun 2019 12:13:23 +0000 (14:13 +0200)
committerMichał Kępień <michal@isc.org>
Mon, 3 Jun 2019 12:13:23 +0000 (14:13 +0200)
While Solaris does not support the nonstandard hto[bl]e{16,32,64}() and
[bl]e{16,32,64}toh() conversion functions, it does have some
byte-swapping macros available in <sys/byteorder.h>.  Ensure these
macros are used in the fallback definitions of the aforementioned
nonstandard functions.

lib/isc/include/isc/endian.h

index 1e4433e4acc9636f83d9c9900a89498d002c5042..98a26dafac18c9bc2d8e28d6b559141ea6987a9e 100644 (file)
 # define __LITTLE_ENDIAN LITTLE_ENDIAN
 # define __PDP_ENDIAN    PDP_ENDIAN
 
+#elif defined(sun) || defined(__sun) || defined(__SVR4)
+
+/*
+ * For Solaris, rely on the fallback definitions below, though use
+ * Solaris-specific versions of bswap_{16,32,64}().
+ */
+
+# include <sys/byteorder.h>
+
+# define bswap_16(x) BSWAP_16(x)
+# define bswap_32(x) BSWAP_32(x)
+# define bswap_64(x) BSWAP_64(x)
+
 #else
 
 #endif /* Specific platform support */