Network-aware and auth-aware 9P library. [rsc] --rw-rw-r-- M 84741 glenda sys 15859 Dec 11 16:18 sys/man/2/9p /n/sourcesdump/2005/1211/plan9/sys/man/2/9p:10,15 - /n/sourcesdump/2005/1212/plan9/sys/man/2/9p:10,16 readbuf, readstr, respond, + responderror, threadpostmountsrv, srv \- 9P file service .SH SYNOPSIS /n/sourcesdump/2005/1211/plan9/sys/man/2/9p:61,68 - /n/sourcesdump/2005/1212/plan9/sys/man/2/9p:62,72 int srv(Srv *s) void postmountsrv(Srv *s, char *name, char *mtpt, int flag) void threadpostmountsrv(Srv *s, char *name, char *mtpt, int flag) + void listensrv(Srv *s, char *addr) + void threadlistensrv(Srv *s, char *addr) int postfd(char *srvname, int fd) void respond(Req *r, char *error) + void responderror(Req*) void readstr(Req *r, char *src) void readbuf(Req *r, void *src, long nsrc) typedef int Dirgen(int n, Dir *dir, void *aux) /n/sourcesdump/2005/1211/plan9/sys/man/2/9p:217,222 - /n/sourcesdump/2005/1212/plan9/sys/man/2/9p:221,241 .I sysfatal (see .IR perror (2)). + .PP + .I Listensrv + and + .I threadlistensrv + create a separate process to announce as + .IR addr . + The process listens for incoming connections, + creating a new process to serve each. + Using these functions results in + .I srv + and the service functions + being run in multiple processes simultaneously. + The library locks its own data structures as necessary; + the client may need to lock data it shares between + the multiple connections. .SS Service functions The functions in a .B Srv /n/sourcesdump/2005/1211/plan9/sys/man/2/9p:288,293 - /n/sourcesdump/2005/1212/plan9/sys/man/2/9p:307,319 .B Req* as well as any pointers it once contained must be considered freed and not referenced. + .PP + .I Responderror + calls + .I respond + with the system error string + (see + .IR errstr (2)). .PP If the service loop detects an error in a request (e.g., an attempt to reuse an extant fid, an open of [rsc] --rw-rw-r-- M 84741 glenda sys 4759 Dec 11 16:45 sys/include/9p.h /n/sourcesdump/2005/1211/plan9/sys/include/9p.h:198,203 - /n/sourcesdump/2005/1212/plan9/sys/include/9p.h:198,204 int nopipe; int srvfd; int leavefdsopen; /* magic for acme win */ + char* keyspec; /* below is implementation-specific; don't use */ Fidpool* fpool; /n/sourcesdump/2005/1211/plan9/sys/include/9p.h:208,220 - /n/sourcesdump/2005/1212/plan9/sys/include/9p.h:209,227 QLock rlock; uchar* wbuf; QLock wlock; + + char* addr; }; void srv(Srv*); void postmountsrv(Srv*, char*, char*, int); + void _postmountsrv(Srv*, char*, char*, int); + void listensrv(Srv*, char*); + void _listensrv(Srv*, char*); int postfd(char*, int); int chatty9p; void respond(Req*, char*); + void responderror(Req*); void threadpostmountsrv(Srv*, char*, char*, int); /* /n/sourcesdump/2005/1211/plan9/sys/include/9p.h:230,236 - /n/sourcesdump/2005/1212/plan9/sys/include/9p.h:237,252 OMASK = 3 }; - void readstr(Req*, char*); - void readbuf(Req*, void*, long); - void walkandclone(Req*, char*(*walk1)(Fid*,char*,void*), char*(*clone)(Fid*,Fid*,void*), void*); + void readstr(Req*, char*); + void readbuf(Req*, void*, long); + void walkandclone(Req*, char*(*walk1)(Fid*,char*,void*), + char*(*clone)(Fid*,Fid*,void*), void*); + + void auth9p(Req*); + void authread(Req*); + void authwrite(Req*); + void authdestroy(Fid*); + int authattach(Req*); + + extern void (*_forker)(void (*)(void*), void*, int);