]> Git Repo - qemu.git/blobdiff - util/oslib-posix.c
oslib-posix: Use sysctl(2) call to resolve exec_dir on NetBSD
[qemu.git] / util / oslib-posix.c
index 382bd4a23139d46d2ee434d115f6ee401d84beeb..77369c92ce92bb7065f289fffb3286ef75a048ec 100644 (file)
 #include <libutil.h>
 #endif
 
+#ifdef __NetBSD__
+#include <sys/sysctl.h>
+#endif
+
 #include "qemu/mmap-alloc.h"
 
 #ifdef CONFIG_DEBUG_STACK_USAGE
@@ -250,9 +254,14 @@ void qemu_init_exec_dir(const char *argv0)
             p = buf;
         }
     }
-#elif defined(__FreeBSD__)
+#elif defined(__FreeBSD__) \
+      || (defined(__NetBSD__) && defined(KERN_PROC_PATHNAME))
     {
+#if defined(__FreeBSD__)
         static int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
+#else
+        static int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME};
+#endif
         size_t len = sizeof(buf) - 1;
 
         *buf = '\0';
This page took 0.023374 seconds and 4 git commands to generate.