diff options
Diffstat (limited to 'osdep-sunos.c')
-rw-r--r-- | osdep-sunos.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/osdep-sunos.c b/osdep-sunos.c index 5d1e582e..6ba27691 100644 --- a/osdep-sunos.c +++ b/osdep-sunos.c @@ -64,6 +64,23 @@ osdep_get_name(int fd, char *tty) return (xstrdup(p.pr_fname)); } +char * +osdep_get_cwd(pid_t pid) +{ + static char target[MAXPATHLEN + 1]; + char *path; + ssize_t n; + + xasprintf(&path, "/proc/%u/path/cwd", (u_int) pid); + n = readlink(path, target, MAXPATHLEN); + xfree(path); + if (n > 0) { + target[n] = '\0'; + return (target); + } + return (NULL); +} + struct event_base * osdep_event_init(void) { |