Comment out alien.remote-control tests for now
[factor/jcg.git] / vm / os-freebsd.c
blob1d43a13001fa6963fc353f04160de19d749a9f68
1 #include "master.h"
3 /* From SBCL */
4 const char *vm_executable_path(void)
6 char path[PATH_MAX + 1];
8 if (getosreldate() >= 600024)
10 /* KERN_PROC_PATHNAME is available */
11 size_t len = PATH_MAX + 1;
12 int mib[4];
14 mib[0] = CTL_KERN;
15 mib[1] = KERN_PROC;
16 mib[2] = KERN_PROC_PATHNAME;
17 mib[3] = -1;
18 if (sysctl(mib, 4, &path, &len, NULL, 0) != 0)
19 return NULL;
21 else
23 int size;
24 size = readlink("/proc/curproc/file", path, sizeof(path) - 1);
25 if (size < 0)
26 return NULL;
27 path[size] = '\0';
30 if(strcmp(path, "unknown") == 0)
31 return NULL;
33 return safe_strdup(path);