--- osdep-netbsd.c.orig 2017-10-31 21:59:19.000000000 +0000 +++ osdep-netbsd.c 2017-10-31 22:01:05.000000000 +0000 @@ -129,7 +129,23 @@ char * osdep_get_cwd(int fd) { - return (NULL); + static char cwd[MAXPATHLEN + 1]; + char *path; + pid_t pgrp; + ssize_t n; + + if ((pgrp = tcgetpgrp(fd)) == -1) + return (NULL); + + xasprintf(&path, "/proc/%lld/cwd", (long long) pgrp); + n = readlink(path, cwd, MAXPATHLEN); + free(path); + + if (n == -1) + return (NULL); + + cwd[n] = '\0'; + return (cwd); } struct event_base *