vx32

Local 9vx git repository for patches.
git clone git://r-36.net/vx32
Log | Files | Refs

commit 45a30ac43ae73561addccadd3dcf24b2556f63ee
parent cee74110d2165b89ab27886dba2bb07cded7b4d9
Author: Jesus Galan Lopez (yiyus) <yiyu.jgl@gmail.com>
Date:   Mon, 31 May 2010 21:42:24 +0200

merge

Diffstat:
src/9vx/ratrace/ratrace.c | 17+++++++++++++++++
1 file changed, 17 insertions(+), 0 deletions(-)

diff --git a/src/9vx/ratrace/ratrace.c b/src/9vx/ratrace/ratrace.c @@ -29,6 +29,22 @@ cwrite(int fd, char *path, char *cmd, int len) threadexits(nil); } } + +void +hang(int pid) +{ + char *ctl; + int cfd; + ctl = smprint("/proc/%d/ctl", pid); + if ((cfd = open(ctl, OWRITE)) < 0) + die(smprint("%s: %r", ctl)); + if (write(cfd, "hang", 4) < 4) { + print("%s: %r\n", ctl); + exits("can't hang child"); + } + +} + void reader(void *v) { @@ -154,6 +170,7 @@ threadmain(int argc, char **argv) exits("fork failed"); } if(pid == 0) { + hang(getpid()); exec(cmd, args); fprint(2, "Bad exec: %s: %r\n", cmd); exits("Bad exec");