From 2f801f30de646e2dbe66f3661535a7cb7e797041 Mon Sep 17 00:00:00 2001
From: Davide Beatrici <git@davidebeatrici.dev>
Date: Mon, 3 May 2021 19:58:12 +0200
Subject: [PATCH] Fix compile errors on OpenBSD

- <pthread.h> included for the "pthread_t" type definition.
- <net/ethernet.h> include removed as the header doesn't exist.
- AI_ALL and AI_V4MAPPED defined to 0 as the options don't exist.
---
 src/Cedar/BridgeUnix.c | 5 ++++-
 src/Mayaqua/DNS.c      | 8 ++++++++
 src/Mayaqua/Network.h  | 4 ++++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/Cedar/BridgeUnix.c b/src/Cedar/BridgeUnix.c
index b883bb47..87287d7c 100644
--- a/src/Cedar/BridgeUnix.c
+++ b/src/Cedar/BridgeUnix.c
@@ -25,11 +25,14 @@
 #include <errno.h>
 #include <fcntl.h>
 
-#include <net/ethernet.h>
 #include <net/if.h>
 #include <sys/ioctl.h>
 #include <sys/stat.h>
 
+#ifndef UNIX_OPENBSD
+#include <net/ethernet.h>
+#endif
+
 #ifdef UNIX_SOLARIS
 #include <sys/sockio.h>
 #endif
diff --git a/src/Mayaqua/DNS.c b/src/Mayaqua/DNS.c
index b5152ee5..c2617e87 100644
--- a/src/Mayaqua/DNS.c
+++ b/src/Mayaqua/DNS.c
@@ -13,6 +13,14 @@
 #include <sys/socket.h>
 #endif
 
+#ifndef AI_ALL
+#define AI_ALL 0
+#endif
+
+#ifndef AI_V4MAPPED
+#define AI_V4MAPPED 0
+#endif
+
 static bool cache_enabled;
 
 static LIST *cache;
diff --git a/src/Mayaqua/Network.h b/src/Mayaqua/Network.h
index b8faee9c..25ce9360 100644
--- a/src/Mayaqua/Network.h
+++ b/src/Mayaqua/Network.h
@@ -13,6 +13,10 @@
 
 #ifdef OS_UNIX
 #include <netinet/in.h>
+
+#ifdef UNIX_OPENBSD
+#include <pthread.h>
+#endif
 #endif
 
 // Dynamic Value