Skip to content

Instantly share code, notes, and snippets.

@chris-se
Last active January 3, 2017 08:32
Show Gist options
  • Save chris-se/07583f5230578b0791a8514d313b4677 to your computer and use it in GitHub Desktop.
Save chris-se/07583f5230578b0791a8514d313b4677 to your computer and use it in GitHub Desktop.
From 15c5afe4cd174dd067280a8bccc378f6ce58aa6b Mon Sep 17 00:00:00 2001
From: Christian Seiler <[email protected]>
Date: Tue, 3 Jan 2017 09:20:43 +0100
Subject: [PATCH] Add support for musl-libc (endian.h)
musl supports the soon-to-be standardized endian.h, while FreeBSD only
supports sys/endian.h as of now, so check for FreeBSD here, as other
operating systems will likely support endian.h in the future.
Signed-off-by: Christian Seiler <[email protected]>
---
include/libisns/util.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/include/libisns/util.h b/include/libisns/util.h
index 9a2bd13..611bbbb 100644
--- a/include/libisns/util.h
+++ b/include/libisns/util.h
@@ -111,7 +111,11 @@ enum {
# define ntohll(x) __bswap_64(x)
# endif
# else
-# include <sys/endian.h>
+# if defined(__FreeBSD__)
+# include <sys/endian.h>
+# else
+# include <endian.h>
+# endif
# define htonll(x) htobe64(x)
# define ntohll(x) be64toh(x)
# endif
--
2.11.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment