]> gitweb.factorcode.org Git - factor.git/blob - vm/os-linux.c
Initial import
[factor.git] / vm / os-linux.c
1 #include "master.h"
2
3 /* Snarfed from SBCL linux-so.c. You must free() this yourself. */
4 const char *vm_executable_path(void)
5 {
6         char *path = safe_malloc(PATH_MAX + 1);
7
8         int size = readlink("/proc/self/exe", path, PATH_MAX);
9         if (size < 0)
10         {
11                 fatal_error("Cannot read /proc/self/exe",0);
12                 return NULL;
13         }
14         else
15         {
16                 path[size] = '\0';
17                 return safe_strdup(path);
18         }
19 }