summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-13 15:22:03 +0100
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2017-02-13 15:27:50 +0100
commit8e769c22fb8f772262130bb82f862f377e05f513 (patch)
tree9170a12006828aa6a200ba6f07fd520ede4d8905
parentd26df9b9fd1dd50ed9c26518fcecfe2af7ca4868 (diff)
downloadouroboros-8e769c22fb8f772262130bb82f862f377e05f513.tar.gz
ouroboros-8e769c22fb8f772262130bb82f862f377e05f513.zip
ipcpd: Fix build on FreeBSD
Use labs for absolute value of a long, and defines bswap_64 as the FreeBSD function bswap64.
-rw-r--r--include/ouroboros/endian.h4
-rw-r--r--src/ipcpd/normal/enroll.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/include/ouroboros/endian.h b/include/ouroboros/endian.h
index 745f0c57..a2745595 100644
--- a/include/ouroboros/endian.h
+++ b/include/ouroboros/endian.h
@@ -114,7 +114,9 @@ static inline uint32_t bswap_32(uint32_t x) {
#if defined(__GNUC__) && (__GNUC__ >= 4) && \
(__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
#define bswap_64(x) __builtin_bswap64(x)
-#elif !defined (bswap64)
+#elif defined (bswap64)
+#define bswap_64 bswap64
+#else
#if !defined(__STRICT_ANSI__)
static inline uint64_t bswap_64(uint64_t x) {
union {
diff --git a/src/ipcpd/normal/enroll.c b/src/ipcpd/normal/enroll.c
index 94e171c0..d09a62a9 100644
--- a/src/ipcpd/normal/enroll.c
+++ b/src/ipcpd/normal/enroll.c
@@ -217,7 +217,7 @@ int enroll_boot(char * dst_name)
rtt.tv_sec = ntoh64(((uint64_t *) data)[0]);
rtt.tv_nsec = ntoh64(((uint64_t *) data)[1]);
- if (abs(ts_diff_ms(&t0, &rtt)) - delta_t > ENROLL_WARN_TIME_OFFSET)
+ if (labs(ts_diff_ms(&t0, &rtt)) - delta_t > ENROLL_WARN_TIME_OFFSET)
log_warn("Clock offset above threshold.");
free(data);