call srv->start at start

This commit is contained in:
rsc 2005-02-11 17:00:06 +00:00
parent b589fce2fb
commit 2aa7d30367
2 changed files with 22 additions and 7 deletions

View file

@ -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);

View file

@ -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);
}