From 8b16b9b246eb4b03c231285037adc99e1b2e86f7 Mon Sep 17 00:00:00 2001
From: Charlotte Koch <dressupgeekout@gmail.com>
Date: Tue, 7 Mar 2023 06:40:58 -0800
Subject: [PATCH 1/2] Need to enable __BSD_VISIBLE on DragonFly in conjunction
 with -std=c99

---
 src/core/features.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/core/features.h b/src/core/features.h
index da8c248d..0adb136a 100644
--- a/src/core/features.h
+++ b/src/core/features.h
@@ -61,4 +61,9 @@
 #define _NETBSD_SOURCE
 #endif
 
+/* Needed for several things when building with -std=c99. */
+#if !__BSD_VISIBLE && defined(__DragonFly__)
+#define __BSD_VISIBLE 1
+#endif
+
 #endif

From 575af763f636e90bf4f45284086ab4a531f07896 Mon Sep 17 00:00:00 2001
From: Charlotte Koch <dressupgeekout@gmail.com>
Date: Tue, 7 Mar 2023 06:45:31 -0800
Subject: [PATCH 2/2] os/which can return :dragonfly

While here, document that :bsd is another possible return value.
---
 src/core/os.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/core/os.c b/src/core/os.c
index 0708e7d1..89b79c8d 100644
--- a/src/core/os.c
+++ b/src/core/os.c
@@ -126,6 +126,8 @@ JANET_CORE_FN(os_which,
               "* :freebsd\n\n"
               "* :openbsd\n\n"
               "* :netbsd\n\n"
+              "* :dragonfly\n\n"
+              "* :bsd\n\n"
               "* :posix - A POSIX compatible system (default)\n\n"
               "May also return a custom keyword specified at build time.") {
     janet_fixarity(argc, 0);
@@ -150,6 +152,8 @@ JANET_CORE_FN(os_which,
     return janet_ckeywordv("netbsd");
 #elif defined(__OpenBSD__)
     return janet_ckeywordv("openbsd");
+#elif defined(__DragonFly__)
+    return janet_ckeywordv("dragonfly");
 #elif defined(JANET_BSD)
     return janet_ckeywordv("bsd");
 #else