3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-07 09:55:20 +00:00

Tweak the FreeBSD version of proc_self_dirname() to work on NetBSD use it.

This commit is contained in:
Jason Thorpe 2024-03-03 07:54:39 -08:00
parent 91fbd58980
commit a02d4e7853

View file

@ -55,7 +55,7 @@
# include <glob.h> # include <glob.h>
#endif #endif
#ifdef __FreeBSD__ #if defined(__FreeBSD__) || defined(__NetBSD__)
# include <sys/sysctl.h> # include <sys/sysctl.h>
#endif #endif
@ -901,10 +901,14 @@ std::string proc_self_dirname()
buflen--; buflen--;
return std::string(path, buflen); return std::string(path, buflen);
} }
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__) || defined(__NetBSD__)
std::string proc_self_dirname() std::string proc_self_dirname()
{ {
#ifdef __NetBSD__
int mib[4] = {CTL_KERN, KERN_PROC_ARGS, getpid(), KERN_PROC_PATHNAME};
#else
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1}; int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
#endif
size_t buflen; size_t buflen;
char *buffer; char *buffer;
std::string path; std::string path;