shithub: riscv

Download patch

ref: 5826140ce394025d21ab8d2b2c21c12720e88a59
parent: 59fdb3a12cd1e6ec9f65ca014c23fd27bea45245
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Sun Mar 8 01:52:23 EDT 2020

lib9p: restore previous behaviour of fd group sharing

it appears that too many fileservers rely on the fileserver
process sharing the filedescriptors with children of the
caller to postmntsrv() or threadpostmntsrv().

restoring previous behaviour for now.

--- a/sys/src/lib9p/post.c
+++ b/sys/src/lib9p/post.c
@@ -23,8 +23,11 @@
 
 	if(_forker == nil)
 		sysfatal("no forker");
-	_forker(postproc, s, RFNAMEG|RFFDG|RFNOTEG);
+	_forker(postproc, s, RFNAMEG|RFNOTEG);
 
+	rfork(RFFDG);
+	rendezvous(0, 0);
+
 	close(s->infd);
 	if(s->infd != s->outfd)
 		close(s->outfd);
@@ -52,8 +55,11 @@
 
 	if(_forker == nil)
 		sysfatal("no forker");
-	_forker(postproc, s, RFNAMEG|RFFDG|RFNOTEG);
+	_forker(postproc, s, RFNAMEG|RFNOTEG);
 
+	rfork(RFFDG);
+	rendezvous(0, 0);
+
 	close(s->infd);
 	if(s->infd != s->outfd)
 		close(s->outfd);
@@ -72,6 +78,7 @@
 	Srv *s;
 
 	s = v;
+	rendezvous(0, 0);
 	close(s->srvfd);
 	srv(s);
 }