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;
16 mib
[2] = KERN_PROC_PATHNAME
;
18 if (sysctl(mib
, 4, &path
, &len
, NULL
, 0) != 0)
24 size
= readlink("/proc/curproc/file", path
, sizeof(path
) - 1);
30 if(strcmp(path
, "unknown") == 0)
33 return safe_strdup(path
);