commit - aa01c23be63787550e64bc1a0f3a8d267cad1fa4
commit + 385a6d5877258cee0cac6151e6359c9206006b01
blob - 57caac28f5fbc7b9abbe8f29e31505b5bd268a3c
blob + 586c59ccb24647ec74b82813f3eda505bbf40a1f
--- include/9p.h
+++ include/9p.h
};
void srv(Srv*);
-void postmountsrv(Srv*, char*, char*, int);
int postfd(char*, int);
extern int chatty9p;
void respond(Req*, char*);
blob - 56aabc53c0764e6a3486d47a5fbec89992d2068e
blob + 56f12227bcd647aa7218d9207e6c16f690ce30cc
--- man/lookman.index
+++ man/lookman.index
posted /usr/local/plan9/man/man9/0intro.9p
postfd /usr/local/plan9/man/man3/9p.3
postmark /usr/local/plan9/man/man1/bundle.1
-postmountsrv /usr/local/plan9/man/man3/9p.3
postnote /usr/local/plan9/man/man3/notify.3
postnote /usr/local/plan9/man/man3/postnote.3
postnote /usr/local/plan9/man/man3/rfork.3
blob - adf10269110a5147d3e9e47d72eb1d8832c9a9cc
blob + 86b37fafe1ec65a3d4c9eef3e8fc6627bd042769
--- man/man3/9p.3
+++ man/man3/9p.3
erealloc9p,
estrdup9p,
postfd,
-postmountsrv,
readbuf,
readstr,
respond,
.ft L
.ta \w'\fLvoid* 'u
int srv(Srv *s)
-void postmountsrv(Srv *s, char *name, char *mtpt, int flag)
void threadpostmountsrv(Srv *s, char *name, char *mtpt, int flag)
int postfd(char *srvname, int fd)
void respond(Req *r, char *error)
writing the responses to
.BR s->outfd .
(Typically,
-.I postmountsrv
-or
.I threadpostmountsrv
initializes the
.B infd
If alternate behavior is desired, clients can link against
alternate implementations of these functions.
.PP
-.I Postmountsrv
-and
.I threadpostmountsrv
-are wrappers that create a separate process in which to run
+is a wrapper that creates a separate process in which to run
.IR srv .
-They do the following:
+It does the following:
.IP
If
.IB s -> nopipe
The service loop provided by
.I srv
(and indirectly by
-.I postmountsrv
-and
-.IR threadpostmountsrv )
+.I threadpostmountsrv )
is single-threaded.
If it is expected that some requests might
block, arranging for alternate processes
blob - 6654ea7c2209304d515e9dce888cb10bb4b6ed9b
blob + 39e10b41aaa6a3ce17ec94d1338d95ca26d666e9
--- man/man3/INDEX
+++ man/man3/INDEX
erealloc9p 9p.3
estrdup9p 9p.3
postfd 9p.3
-postmountsrv 9p.3
readbuf 9p.3
readstr 9p.3
respond 9p.3
blob - 56f614fe61e3161d7ea0014891a93e3de136629b (mode 644)
blob + /dev/null
--- src/lib9p/_post.c
+++ /dev/null
-#include <u.h>
-#include <libc.h>
-#include <fcall.h>
-#include <thread.h>
-#include <9p.h>
-#include "post.h"
-
-Postcrud*
-_post1(Srv *s, char *name, char *mtpt, int flag)
-{
- Postcrud *p;
-
- p = emalloc9p(sizeof *p);
- if(!s->nopipe){
- if(pipe(p->fd) < 0)
- sysfatal("pipe: %r");
- s->infd = s->outfd = p->fd[1];
- s->srvfd = p->fd[0];
- }
- if(name)
- if(postfd(name, s->srvfd) < 0)
- sysfatal("postfd %s: %r", name);
- p->s = s;
- p->mtpt = mtpt;
- p->flag = flag;
- return p;
-}
-
-void
-_post2(void *v)
-{
- Srv *s;
-
- s = v;
- if(!s->leavefdsopen){
- rfork(RFNOTEG);
- rendezvous((ulong)s, 0);
- close(s->srvfd);
- }
- srv(s);
-}
-
-void
-_post3(Postcrud *p)
-{
- /*
- * Normally the server is posting as the last thing it does
- * before exiting, so the correct thing to do is drop into
- * a different fd space and close the 9P server half of the
- * pipe before trying to mount the kernel half. This way,
- * if the file server dies, we don't have a ref to the 9P server
- * half of the pipe. Then killing the other procs will drop
- * all the refs on the 9P server half, and the mount will fail.
- * Otherwise the mount hangs forever.
- *
- * Libthread in general and acme win in particular make
- * it hard to make this fd bookkeeping work out properly,
- * so leaveinfdopen is a flag that win sets to opt out of this
- * safety net.
- */
- if(!p->s->leavefdsopen){
- rfork(RFFDG);
- rendezvous((ulong)p->s, 0);
- close(p->s->infd);
- if(p->s->infd != p->s->outfd)
- close(p->s->outfd);
- }
-
-#if 0
- if(p->mtpt){
- if(amount(p->s->srvfd, p->mtpt, p->flag, "") == -1)
- sysfatal("mount %s: %r", p->mtpt);
- }else
-#endif
- close(p->s->srvfd);
- free(p);
-}
blob - 4ee99bc8df69deb2f6179dbe1f3dc8ddfce7e697 (mode 644)
blob + /dev/null
--- src/lib9p/post.c
+++ /dev/null
-#include <u.h>
-#include <libc.h>
-#include <fcall.h>
-#include <thread.h>
-#include <9p.h>
-#include "post.h"
-
-void
-postmountsrv(Srv *s, char *name, char *mtpt, int flag)
-{
- Postcrud *p;
-
- p = _post1(s, name, mtpt, flag);
- switch(rfork(RFPROC|RFNOTEG|RFNAMEG|RFMEM)){
- case -1:
- sysfatal("rfork: %r");
- case 0:
- _post2(s);
- exits(nil);
- default:
- _post3(p);
- }
-}
blob - 069a7ce7b9a0ec446e76ee293d47a02168ca7481 (mode 644)
blob + /dev/null
--- src/lib9p/post.h
+++ /dev/null
-typedef struct Postcrud Postcrud;
-struct Postcrud
-{
- int fd[2];
- Srv *s;
- char *name;
- char *mtpt;
- int flag;
-};
-
-Postcrud *_post1(Srv*, char*, char*, int);
-void _post2(void*);
-void _post3(Postcrud*);