2003-11-23 18:02:15 +00:00
|
|
|
#include "9term.h"
|
|
|
|
|
|
2003-11-25 02:54:24 +00:00
|
|
|
int
|
|
|
|
|
getchildwd(int pid, char *wdir, int bufn)
|
2003-11-23 18:02:15 +00:00
|
|
|
{
|
|
|
|
|
char path[256];
|
|
|
|
|
int n;
|
|
|
|
|
|
|
|
|
|
snprint(path, sizeof path, "/proc/%d/cwd", pid);
|
|
|
|
|
n = readlink(path, wdir, bufn);
|
|
|
|
|
if(n < 0)
|
2003-11-25 02:54:24 +00:00
|
|
|
return -1;
|
2003-11-23 18:02:15 +00:00
|
|
|
wdir[n] = '\0';
|
2003-11-25 02:54:24 +00:00
|
|
|
return 0;
|
2003-11-23 18:02:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
getpts(int fd[], char *slave)
|
|
|
|
|
{
|
|
|
|
|
openpty(&fd[1], &fd[0], slave, 0, 0);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|