3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-06-06 06:03:23 +00:00

Revert "Add "#ifdef __FreeBSD__""

This reverts commit e3575a86c5.
This commit is contained in:
Clifford Wolf 2018-05-13 13:06:36 +02:00
parent 7d076f071e
commit 1167538d26
5 changed files with 9 additions and 52 deletions

View file

@ -46,15 +46,10 @@
# include <unistd.h>
# include <dirent.h>
# include <sys/types.h>
# include <sys/wait.h>
# include <sys/stat.h>
# include <glob.h>
#endif
#ifdef __FreeBSD__
# include <sys/sysctl.h>
#endif
#include <limits.h>
#include <errno.h>
@ -77,7 +72,7 @@ std::vector<void*> memhasher_store;
void memhasher_on()
{
#if defined(__linux__) || defined(__FreeBSD__)
#ifdef __linux__
memhasher_rng += time(NULL) << 16 ^ getpid();
#endif
memhasher_store.resize(0x10000);
@ -672,26 +667,6 @@ std::string proc_self_dirname()
buflen--;
return std::string(path, buflen);
}
#elif defined(__FreeBSD__)
std::string proc_self_dirname()
{
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, -1};
size_t buflen;
char *buffer;
std::string path;
if (sysctl(mib, 4, NULL, &buflen, NULL, 0) != 0)
log_error("sysctl failed: %s\n", strerror(errno));
buffer = (char*)malloc(buflen);
if (buffer == NULL)
log_error("malloc failed: %s\n", strerror(errno));
if (sysctl(mib, 4, buffer, &buflen, NULL, 0) != 0)
log_error("sysctl failed: %s\n", strerror(errno));
while (buflen > 0 && buffer[buflen-1] != '/')
buflen--;
path.assign(buffer, buflen);
free(buffer);
return path;
}
#elif defined(__APPLE__)
std::string proc_self_dirname()
{