rightclicktoplumb_st.c (363B)
1 #if defined(__OpenBSD__) 2 #include <sys/sysctl.h> 3 #endif 4 5 int 6 subprocwd(char *path) 7 { 8 #if defined(__linux) 9 if (snprintf(path, PATH_MAX, "/proc/%d/cwd", pid) < 0) 10 return -1; 11 return 0; 12 #elif defined(__OpenBSD__) 13 size_t sz = PATH_MAX; 14 int name[3] = {CTL_KERN, KERN_PROC_CWD, pid}; 15 if (sysctl(name, 3, path, &sz, 0, 0) == -1) 16 return -1; 17 return 0; 18 #endif 19 }