shithub: riscv

Download patch

ref: 9c844d90e117c9cb7b7fc16e4b0741a0df88456c
parent: d9f65faf71ff09a3427309f8b69500280c481ac6
author: cinap_lenrek <[email protected]>
date: Fri Mar 30 16:06:33 EDT 2012

lib9p: add Srv.start

--- a/sys/include/9p.h
+++ b/sys/include/9p.h
@@ -195,6 +195,7 @@
 	Tree*	tree;
 	void		(*destroyfid)(Fid*);
 	void		(*destroyreq)(Req*);
+	void		(*start)(Srv*);
 	void		(*end)(Srv*);
 	void*	aux;
 
--- a/sys/man/2/9p
+++ b/sys/man/2/9p
@@ -52,6 +52,7 @@
 
 	void		(*destroyfid)(Fid *fid);
 	void		(*destroyreq)(Req *r);
+	void		(*start)(Srv *s);
 	void		(*end)(Srv *s);
 	void*	aux;
 
@@ -721,6 +722,7 @@
 .PP
 .IR Destroyfid ,
 .IR destroyreq ,
+.IR start ,
 and
 .I end
 are auxiliary functions, not called in direct response to 9P requests.
@@ -750,6 +752,10 @@
 is called to allow the program to dispose of the
 .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
--- a/sys/src/lib9p/srv.c
+++ b/sys/src/lib9p/srv.c
@@ -765,6 +765,9 @@
 	srv->fpool->srv = srv;
 	srv->rpool->srv = srv;
 
+	if(srv->start)
+		srv->start(srv);
+
 	srvwork(srv);
 }