History

more work on 9pfile interface

John (EBo) David committed 15 years ago

Commit b352aa61 parent c41ff912 files · +15 −11Browse files

Unified · Split

2 files
  1. sys/src/cmd/uem/exec2fs.c +8 −2
  2. sys/src/cmd/uem/tests/exec2fs.rc +7 −9
sys/src/cmd/uem/exec2fs.c+8−2
@@ -185,8 +185,13 @@ kickit(void) · 184 unmodified lines
185 // create a execcmd shadow directory185 // create a execcmd shadow directory
186 spid = smprint("%ld", pid);186 spid = smprint("%ld", pid);
187 fdir = createfile(fs.tree->root, spid, "exec2fs", DMDIR|0777, (void *)Xpid);187 fdir = createfile(fs.tree->root, spid, "exec2fs", DMDIR|0777, (void *)Xpid);
188 free(spid);
189 closefile(createfile(fdir, "ctl", "exec2fs", 0666, (void *)Xpctl));188 closefile(createfile(fdir, "ctl", "exec2fs", 0666, (void *)Xpctl));
189
190 closefile(createfile(fdir, "stdin", "exec2fs", 0666, (void *)Xpctl));
191 closefile(createfile(fdir, "stdout", "exec2fs", 0666, (void *)Xpctl));
192 closefile(createfile(fdir, "stderr", "exec2fs", 0666, (void *)Xpctl));
193
194 free(spid);
190 closefile(fdir);195 closefile(fdir);
191 196
192 chanfree(pidc);197 chanfree(pidc);
@@ -260,10 +265,11 @@ fsopen(Req *r) · 67 unmodified lines
260 }265 }
261 DPRINT(DFID, "\tctlfd=(%d)\n", e->rctlfd);266 DPRINT(DFID, "\tctlfd=(%d)\n", e->rctlfd);
262 267
268
263 n = snprint(fname, STRMAX, "%s/%d", procpath, e->pid);269 n = snprint(fname, STRMAX, "%s/%d", procpath, e->pid);
264 assert(n > 0);270 assert(n > 0);
265 271
266 /* asserts are heavy handed, but help with debug */272 // asserts are heavy handed, but help with debug
267 n = mpipe(fname, "stdin");273 n = mpipe(fname, "stdin");
268 assert(n > 0);274 assert(n > 0);
269 n = mpipe(fname, "stdout");275 n = mpipe(fname, "stdout");
sys/src/cmd/uem/tests/exec2fs.rc+7−9
@@ -13,7 +13,7 @@ EXECLOG=$TESTDIR/exec2fs.log · 12 unmodified lines
13MPIPELOG=$TESTDIR/mpipefs.log13MPIPELOG=$TESTDIR/mpipefs.log
14ERRORLOG=$TESTDIR/error.log14ERRORLOG=$TESTDIR/error.log
15 15
16E_MNTPATH=/tmp/testbed/E16E_MNTPATH=$TESTDIR/E
17 17
18#18#
19# Cleanup Previous Instances19# Cleanup Previous Instances
@@ -46,13 +46,12 @@ fn startup { · 26 unmodified lines
46 echo Starting mpipefs....46 echo Starting mpipefs....
47 47
48 mkdir -p $E_MNTPATH48 mkdir -p $E_MNTPATH
49 mkdir -p $TESTDIR
50 49
51 if(~ $#* 0) {50 if(~ $#* 0) {
52 ../$O.mpipefs >[2] $MPIPELOG 51 ../$O.mpipefs >[2] $MPIPELOG
53 }52 }
54 if not {53 if not {
55 ../$O.mpipefs -D -v $1 >[2] $MPIPELOG # CHATTY54 ../$O.mpipefs -v $1 >[2] $MPIPELOG # CHATTY
56 }55 }
57 56
58 mount /srv/mpipe /n/mpipetest test57 mount /srv/mpipe /n/mpipetest test
@@ -62,7 +61,7 @@ fn startup { · 3 unmodified lines
62 ../$O.exec2fs -s exec2fs -E ../$O.execcmd -m $E_MNTPATH >[2] $EXECLOG 61 ../$O.exec2fs -s exec2fs -E ../$O.execcmd -m $E_MNTPATH >[2] $EXECLOG
63 }62 }
64 if not {63 if not {
65 ../$O.exec2fs -D -v $1 -s exec2fs -E ../$O.execcmd -m $E_MNTPATH >[2] $EXECLOG # CHATTY64 ../$O.exec2fs -v $1 -s exec2fs -E ../$O.execcmd -m $E_MNTPATH >[2] $EXECLOG # CHATTY
66 }65 }
67 bind -bc '#p' $E_MNTPATH66 bind -bc '#p' $E_MNTPATH
68 67
@@ -109,8 +108,6 @@ fn stdout { · 40 unmodified lines
109 }108 }
110 109
111 echo Success!110 echo Success!
112 # cleanup
113 rm -rf $TESTDIR/*
114}111}
115 112
116fn stdin {113fn stdin {
@@ -130,17 +127,18 @@ fn stdin { · 13 unmodified lines
130 }127 }
131 128
132 echo Success!129 echo Success!
133 # cleanup
134 rm -rf $TESTDIR/*
135}130}
136 131
137# Setup132# Setup
138rfork133rfork
139 134
140cleanup135cleanup
141startup $1136shutdown
137
142testdir138testdir
143 139
140startup $1
141
144# Note: the current tests die on the 4'th run of either stdout or142# Note: the current tests die on the 4'th run of either stdout or
145# stdin. If I run cleanup**startup between each it runs fine. For143# stdin. If I run cleanup**startup between each it runs fine. For
146# now I am leaving it at two tests and will look into it later.144# now I am leaving it at two tests and will look into it later.