diff options
| author | Ben Huntsman <bhuntsman@mail2.cu-portland.edu> | 2021-08-08 11:03:02 -0700 |
|---|---|---|
| committer | Dan Cross <crossd@gmail.com> | 2021-08-30 21:03:41 -0400 |
| commit | 385a6d5877258cee0cac6151e6359c9206006b01 (patch) | |
| tree | 15fa5629dba3a1d7ff4c0d927295b521bcd5e052 /src/lib9p | |
| parent | aa01c23be63787550e64bc1a0f3a8d267cad1fa4 (diff) | |
lib9p: Remove postmountsrv (#505)
Diffstat (limited to 'src/lib9p')
| -rw-r--r-- | src/lib9p/_post.c | 77 | ||||
| -rw-r--r-- | src/lib9p/post.c | 23 | ||||
| -rw-r--r-- | src/lib9p/post.h | 13 |
3 files changed, 0 insertions, 113 deletions
diff --git a/src/lib9p/_post.c b/src/lib9p/_post.c deleted file mode 100644 index 56f614fe..00000000 --- a/src/lib9p/_post.c +++ /dev/null @@ -1,77 +0,0 @@ -#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); -} diff --git a/src/lib9p/post.c b/src/lib9p/post.c deleted file mode 100644 index 4ee99bc8..00000000 --- a/src/lib9p/post.c +++ /dev/null @@ -1,23 +0,0 @@ -#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); - } -} diff --git a/src/lib9p/post.h b/src/lib9p/post.h deleted file mode 100644 index 069a7ce7..00000000 --- a/src/lib9p/post.h +++ /dev/null @@ -1,13 +0,0 @@ -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*); |