plan9port

fork of plan9port with libvec, libstr and libsdb
Log | Files | Refs | README | LICENSE

commit 2aa7d3036738bc548cfe6d8d83ff45cb1cb9c8c7
parent b589fce2fbf05ae18a6f015240f87ce2a163521f
Author: rsc <devnull@localhost>
Date:   Fri, 11 Feb 2005 17:00:06 +0000

call srv->start at start

Diffstat:
Msrc/lib9p/srv.c | 3+++
Msrc/lib9p/tpost.c | 26+++++++++++++++++++-------
2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/src/lib9p/srv.c b/src/lib9p/srv.c @@ -705,6 +705,9 @@ srv(Srv *srv) srv->fpool->srv = srv; srv->rpool->srv = srv; + if(srv->start) + srv->start(srv); + while(r = getreq(srv)){ if(r->error){ respond(r, r->error); diff --git a/src/lib9p/tpost.c b/src/lib9p/tpost.c @@ -3,16 +3,28 @@ #include <fcall.h> #include <thread.h> #include <9p.h> -#include "post.h" + +static void +launchsrv(void *v) +{ + srv(v); +} void threadpostmountsrv(Srv *s, char *name, char *mtpt, int flag) { - Postcrud *p; + int fd[2]; - p = _post1(s, name, mtpt, flag); - if(procrfork(_post2, s, 32*1024, RFNAMEG|RFNOTEG) < 0) - sysfatal("procrfork: %r"); - _post3(p); -} + if(mtpt) + sysfatal("mount not supported"); + if(!s->nopipe){ + if(pipe(fd) < 0) + sysfatal("pipe: %r"); + s->infd = s->outfd = fd[1]; + s->srvfd = fd[0]; + } + if(name && post9pservice(s->srvfd, name) < 0) + sysfatal("post9pservice %s: %r", name); + proccreate(launchsrv, s, 32*1024); +}