Linux build broken
diff --git a/unix/fsatrace.c b/unix/fsatrace.c
index 1aa98dc..502aaa5 100644
--- a/unix/fsatrace.c
+++ b/unix/fsatrace.c
@@ -9,7 +9,9 @@
#include <stdarg.h>
#include <fcntl.h>
#include <limits.h>
+#if !defined __linux__
#include <libproc.h>
+#endif
#include "fsatrace.h"
extern char **environ;
@@ -77,14 +79,19 @@
r = ftruncate(fd, LOGSZ);
assert(!r);
buf = mmap(0, LOGSZ, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+#if defined __linux__
+ {
+ char exepath [64];
+ snprintf(exepath, sizeof(exepath), "/proc/%d/exe", getpid());
+ readlink(exepath, fullpath, sizeof(fullpath));
+ snprintf(so, sizeof(so), "%s.so", fullpath);
+ setenv("LD_PRELOAD", so, 1);
+ }
+#else
proc_pidpath(getpid(), fullpath, sizeof(fullpath));
-#ifdef __APPLE__
snprintf(so, sizeof(so), "%s.dylib", fullpath);
setenv("DYLD_INSERT_LIBRARIES", so, 1);
setenv("DYLD_FORCE_FLAT_NAMESPACE", "1", 1);
-#else
- snprintf(so, sizeof(so), "%s.so", fullpath);
- setenv("LD_PRELOAD", so, 1);
#endif
setenv(ENVOUT, shname, 1);
child = fork();