aboutsummaryrefslogtreecommitdiff
path: root/src/os.cpp
diff options
context:
space:
mode:
authorTse <1@tse.gratis>2019-10-23 01:06:35 +0300
committerAndrew Kelley <andrew@ziglang.org>2019-10-30 21:21:58 -0400
commit33cc2044811e41a74e3112fc0abcc5dc6fd34836 (patch)
tree380b8a0e296e32fae4415035338ec268c1a1beaf /src/os.cpp
parent7c7350345147c61e3e0873c3c4f233e351a3910a (diff)
downloadzig-33cc2044811e41a74e3112fc0abcc5dc6fd34836.tar.gz
zig-33cc2044811e41a74e3112fc0abcc5dc6fd34836.zip
DragonFlyBSD support
Diffstat (limited to 'src/os.cpp')
-rw-r--r--src/os.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/os.cpp b/src/os.cpp
index 6dc3777f8c..908c3b47d9 100644
--- a/src/os.cpp
+++ b/src/os.cpp
@@ -52,7 +52,7 @@ typedef SSIZE_T ssize_t;
#endif
-#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD) || defined(ZIG_OS_DRAGONFLY)
#include <link.h>
#endif
@@ -60,7 +60,7 @@ typedef SSIZE_T ssize_t;
#include <sys/auxv.h>
#endif
-#if defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+#if defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD) || defined(ZIG_OS_DRAGONFLY)
#include <sys/sysctl.h>
#endif
@@ -85,7 +85,7 @@ static clock_serv_t macos_monotonic_clock;
#if defined(__APPLE__) && !defined(environ)
#include <crt_externs.h>
#define environ (*_NSGetEnviron())
-#elif defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+#elif defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD) || defined(ZIG_OS_DRAGONFLY)
extern char **environ;
#endif
@@ -1450,7 +1450,7 @@ Error os_self_exe_path(Buf *out_path) {
}
buf_resize(out_path, amt);
return ErrorNone;
-#elif defined(ZIG_OS_FREEBSD)
+#elif defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_DRAGONFLY)
buf_resize(out_path, PATH_MAX);
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1 };
size_t cb = PATH_MAX;
@@ -1792,7 +1792,7 @@ Error os_get_app_data_dir(Buf *out_path, const char *appname) {
}
-#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD) || defined(ZIG_OS_DRAGONFLY)
static int self_exe_shared_libs_callback(struct dl_phdr_info *info, size_t size, void *data) {
ZigList<Buf *> *libs = reinterpret_cast< ZigList<Buf *> *>(data);
if (info->dlpi_name[0] == '/') {
@@ -1803,7 +1803,7 @@ static int self_exe_shared_libs_callback(struct dl_phdr_info *info, size_t size,
#endif
Error os_self_exe_shared_libs(ZigList<Buf *> &paths) {
-#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD)
+#if defined(ZIG_OS_LINUX) || defined(ZIG_OS_FREEBSD) || defined(ZIG_OS_NETBSD) || defined(ZIG_OS_DRAGONFLY)
paths.resize(0);
dl_iterate_phdr(self_exe_shared_libs_callback, &paths);
return ErrorNone;