listensrv,
postfd,
postmountsrv,
+postsharesrv,
readbuf,
readstr,
respond,
responderror,
+srvacquire,
+srvrelease,
threadlistensrv,
threadpostmountsrv,
+threadpostsharesrv,
srv \- 9P file service
.SH SYNOPSIS
.ft L
void (*destroyfid)(Fid *fid);
void (*destroyreq)(Req *r);
+ void (*start)(Srv *s);
void (*end)(Srv *s);
void* aux;
.ta \w'\fLvoid* 'u
int srv(Srv *s)
void postmountsrv(Srv *s, char *name, char *mtpt, int flag)
+void postsharesrv(Srv *s, char *name, char *mtpt, char *desc)
void threadpostmountsrv(Srv *s, char *name, char *mtpt, int flag)
+void threadpostsharesrv(Srv *s, char *name, char *mtpt, char *desc)
void listensrv(Srv *s, char *addr)
void threadlistensrv(Srv *s, char *addr)
int postfd(char *srvname, int fd)
.nf
.ft L
.ta \w'\fLvoid* 'u
+void srvrelease(Srv *s)
+void srvacquire(Srv *s)
+.fi
+.PP
+.fi
+.PP
+.nf
+.ft L
+.ta \w'\fLvoid* 'u
void* emalloc9p(ulong n)
void* erealloc9p(void *v, ulong n)
char* estrdup9p(char *s)
(see
.IR perror (2)).
.PP
+.I Postsharesrv
+is similar to
+.I Postmountsrv
+but instead of mounting the service on a directory, it is
+put in a share (see
+.IR shr (3))
+where
+.IB mtpt
+is the name of the share and
+.IB desc
+is the name of the service channel.
+.PP
.I Listensrv
and
.I threadlistensrv
is single-threaded.
If it is expected that some requests might
block, arranging for alternate processes
-to handle them is suggested.
+to handle them is suggested (see
+.IR 9pqueue (2)).
+.PP
+.I Srvrelease
+temporarily releases the calling process from the server
+loop and if neccesary spawns a new process to handle 9p
+requests. When released, the process can do blocking work
+that would otherwise halt processing of 9p requests.
+.I Srvacquire
+rejoins the calling process with the server loop after
+a srvrelease.
.PP
The constraints on the service functions are as follows.
These constraints are checked while the server executes.
.PP
.IR Destroyfid ,
.IR destroyreq ,
+.IR start ,
and
.I end
are auxiliary functions, not called in direct response to 9P requests.
.IB r -> aux
pointer.
.TP
+.I Start
+This gets called (from the forked service process)
+prior entering the 9P service loop.
+.TP
.I End
Once the 9P service loop has finished
(end of file been reached on the service pipe
and
.B /sys/src/lib9p/ramfs.c
are good examples of simple single-threaded file servers.
-.IR Webfs (4)
-and
-.I sshnet
-(see
-.IR ssh (1))
-are good examples of multithreaded file servers.
.PP
In general, the
.B File
.SH SEE ALSO
.IR 9pfid (2),
.IR 9pfile (2),
+.IR 9pqueue (2),
.IR srv (3),
+.IR shr (3),
.IR intro (5)
.SH BUGS
The switch to 9P2000 was taken as an opportunity to tidy