summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorng0 <ng0@n0.is>2019-11-19 17:30:32 +0000
committerng0 <ng0@n0.is>2019-11-19 17:30:32 +0000
commit7c14b80a011e9e99b1cef0bfd96bae364edd5663 (patch)
tree9b4d0714c179b434117aad6fe6a65bc023ba04f9 /src
parent1b296cf77a90930e29bd60c0aef70b8efbb1bd24 (diff)
On *BSD the header file sys/param.h defines BSD. Drop unnecessary
BSD defines in the build-system. Furthermore add detection for FreeBSD using the additional defines by FreeBSD. Use !Linux where previously a list of BSDs was.
Diffstat (limited to 'src')
-rw-r--r--src/include/platform.h8
-rw-r--r--src/nat/gnunet-helper-nat-client.c5
-rw-r--r--src/nse/gnunet-service-nse.c2
-rw-r--r--src/testbed/gnunet-service-testbed_cpustatus.c2
-rw-r--r--src/util/disk.c2
5 files changed, 10 insertions, 9 deletions
diff --git a/src/include/platform.h b/src/include/platform.h
index 0dddd9741..976c9eac7 100644
--- a/src/include/platform.h
+++ b/src/include/platform.h
@@ -115,11 +115,10 @@
#include <time.h>
#endif
#endif
-
-#ifdef SOMEBSD
+#ifdef BSD
#include <net/if.h>
#endif
-#ifdef FREEBSD
+#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__)
#include <semaphore.h>
#endif
#ifdef DARWIN
@@ -188,7 +187,8 @@
#include <sys/mman.h>
-#ifdef FREEBSD
+/* FreeBSD_kernel is not defined on the now discontinued kFreeBSD */
+#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__)
#define __BYTE_ORDER BYTE_ORDER
#define __BIG_ENDIAN BIG_ENDIAN
#endif
diff --git a/src/nat/gnunet-helper-nat-client.c b/src/nat/gnunet-helper-nat-client.c
index 12abfd2df..0271d6e0f 100644
--- a/src/nat/gnunet-helper-nat-client.c
+++ b/src/nat/gnunet-helper-nat-client.c
@@ -249,7 +249,8 @@ send_icmp_udp (const struct in_addr *my_ip, const struct in_addr *other)
off = 0;
ip_pkt.vers_ihl = 0x45;
ip_pkt.tos = 0;
-#ifdef FREEBSD
+ /* should this be BSD only? */
+#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__)
ip_pkt.pkt_len = sizeof(packet); /* Workaround PR kern/21737 */
#else
ip_pkt.pkt_len = htons (sizeof(packet));
@@ -360,7 +361,7 @@ send_icmp (const struct in_addr *my_ip, const struct in_addr *other)
off = 0;
ip_pkt.vers_ihl = 0x45;
ip_pkt.tos = 0;
-#ifdef FREEBSD
+#if defined(BSD) && defined(__FreeBSD__) && defined(__FreeBSD_kernel__)
ip_pkt.pkt_len = sizeof(packet); /* Workaround PR kern/21737 */
#else
ip_pkt.pkt_len = htons (sizeof(packet));
diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c
index e31b07d14..d16abed71 100644
--- a/src/nse/gnunet-service-nse.c
+++ b/src/nse/gnunet-service-nse.c
@@ -75,7 +75,7 @@
(GNUNET_MQ_PRIO_BACKGROUND | GNUNET_MQ_PREF_UNRELIABLE \
| GNUNET_MQ_PREF_CORK_ALLOWED)
-#if FREEBSD
+#if BSD
#define log2(a) (log (a) / log (2))
#endif
diff --git a/src/testbed/gnunet-service-testbed_cpustatus.c b/src/testbed/gnunet-service-testbed_cpustatus.c
index f38b9aee6..5eaeaf952 100644
--- a/src/testbed/gnunet-service-testbed_cpustatus.c
+++ b/src/testbed/gnunet-service-testbed_cpustatus.c
@@ -43,7 +43,7 @@
#include <kvm.h>
#endif
#endif
-#if SOMEBSD
+#if BSD
#if HAVE_KVM_H
#include <kvm.h>
#endif
diff --git a/src/util/disk.c b/src/util/disk.c
index 47a0ed5c9..866dbc301 100644
--- a/src/util/disk.c
+++ b/src/util/disk.c
@@ -1505,7 +1505,7 @@ GNUNET_DISK_file_sync (const struct GNUNET_DISK_FileHandle *h)
return GNUNET_SYSERR;
}
-#if defined(FREEBSD) || defined(OPENBSD) || defined(DARWIN)
+#if ! defined(LINUX) || ! defined(GNU)
return fsync (h->fd) == -1 ? GNUNET_SYSERR : GNUNET_OK;
#else
return fdatasync (h->fd) == -1 ? GNUNET_SYSERR : GNUNET_OK;