diff --git a/mysys/my_getexe.c b/mysys/my_getexe.c index 4b4a2c81460..cb843ca7271 100644 --- a/mysys/my_getexe.c +++ b/mysys/my_getexe.c @@ -23,6 +23,9 @@ #include #elif defined(__FreeBSD__) #include +#elif defined(__NetBSD__) +#include +#include #endif /** Fill the buffer with the executable program name @@ -51,6 +54,10 @@ int my_get_exepath(char *buf, size_t size, const char *argv0) if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) { return 0; } +#elif defined(__NetBSD__) + int mib[4] = {CTL_KERN, KERN_PROC_ARGS, -1, KERN_PROC_PATHNAME }; + if (sysctl(mib, 4, buf, &size, NULL, 0) == 0) + return 0; #endif if (argv0)