]> git.lizzy.rs Git - plan9front.git/commit
lib9p: expose Srv.forker handler and srvforker(), threadsrvforker() and threadsrv...
authorcinap_lenrek <cinap_lenrek@felloff.net>
Sat, 1 May 2021 14:37:00 +0000 (16:37 +0200)
committercinap_lenrek <cinap_lenrek@felloff.net>
Sat, 1 May 2021 14:37:00 +0000 (16:37 +0200)
commitf6509078ed9d03b71c945b19cdda5c882cb1e78d
treef060fbb137179f248898f62e3b81c882a6f493e8
parent013b4983140cc2fbb7df9e3647e2e7c5d575a9dd
lib9p: expose Srv.forker handler and srvforker(), threadsrvforker() and threadsrv() functions

To use srvrease()/srvaquire() we need to have a way to spawn
new processes to handle the service loop. This functionality
was provided by the internal _forker() function which was
eigther rfork or libthread based implementation depending on
if postmountsrv() or threadpostmountsrv() where called.

For servers who want to use srv() directly, _forker would not
be initialized so srvrelease() could not be used.

To untangle this, we get rid of the global _forker handler
and put the handler in the Srv structure. Which will get
initialized (when nil) to eigther srvforker() or threadsrvforker()
depending on if the thread or non-thread entry points where used.

For symmetry, we provde new threadsrv() and threadpostsrv()
functions which handle the default initialization of Srv.forker.

This also allows a user to provide his own forker function,
maybe to conserve stack space.

To avoid dead code, we put each of these function in their
own object file. Note, this also allows a user to define its
own srvforker() symbol.
15 files changed:
sys/include/9p.h
sys/man/2/9p
sys/src/lib9p/listen.c
sys/src/lib9p/mkfile
sys/src/lib9p/mount.c [new file with mode: 0644]
sys/src/lib9p/post.c
sys/src/lib9p/rfork.c
sys/src/lib9p/share.c [new file with mode: 0644]
sys/src/lib9p/srv.c
sys/src/lib9p/thread.c
sys/src/lib9p/threadlistensrv.c [new file with mode: 0644]
sys/src/lib9p/threadpostmountsrv.c [new file with mode: 0644]
sys/src/lib9p/threadpostsharesrv.c [new file with mode: 0644]
sys/src/lib9p/threadpostsrv.c [new file with mode: 0644]
sys/src/lib9p/threadsrv.c [new file with mode: 0644]