NetBSD build few updates.

This commit is contained in:
David Carlier 2020-04-05 16:08:34 +01:00
parent bffca4f812
commit 12afc23e4e
4 changed files with 11 additions and 1 deletions

View File

@ -314,6 +314,9 @@ void reportHardwareStats()
#elif defined(__FreeBSD__)
json.add("os_freebsd", 1);
json.add("os_unix", 1);
#elif defined(__NetBSD__)
json.add("os_netbsd", 1);
json.add("os_unix", 1);
#else
json.add("os_linux", 0);
json.add("os_unix", 0);

View File

@ -422,6 +422,8 @@
char *path = NULL;
#if defined(__linux__)
path = realpath("/proc/self/exe", NULL);
#elif defined(__NetBSD__)
path = realpath("/proc/curproc/exe", NULL);
#elif defined(__APPLE__)
path = (char*)malloc(PATH_MAX+1);
uint32_t len = PATH_MAX;

View File

@ -71,6 +71,9 @@ std::string SeparateProcess::getCurrentExecutableLocation()
return file_manager->getFileSystem()->getAbsolutePath(path).c_str();
}
return "";
#elif defined(__NetBSD__)
return file_manager->getFileSystem()->getAbsolutePath("/proc/curproc/exe")
.c_str();
#else
// Assume Linux
return file_manager->getFileSystem()->getAbsolutePath("/proc/self/exe")

View File

@ -40,7 +40,7 @@
# include <windows.h>
#endif
#if defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)
#if (defined(__linux__) && defined(__GLIBC__) && defined(__GLIBC_MINOR__)) || defined(__NetBSD__)
# include <pthread.h>
#endif
@ -96,6 +96,8 @@ namespace VS
#endif
#elif defined(__FreeBSD__)
pthread_set_name_np(pthread_self(), name);
#elif defined(__NetBSD__)
pthread_setname_np(pthread_self(), "%s", const_cast<char *>(name));
#endif
} // setThreadName
#endif