aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/9term/Linux.c
blob: 7dd22371be723649b347508f25bcd58ac0b2a4f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#include "9term.h"

int
getchildwd(int pid, char *wdir, int bufn)
{
	char path[256];
	int n;

	snprint(path, sizeof path, "/proc/%d/cwd", pid);
	n = readlink(path, wdir, bufn);
	if(n < 0)
		return -1;
	wdir[n] = '\0';
	return 0;
}

int
getpts(int fd[], char *slave)
{
	openpty(&fd[1], &fd[0], slave, 0, 0);
	return 0;
}