Create the server pipes on the client side and transfer them to the
server on thread creation.
Use a single per-process socket instead of one per thread for
transferring file handles between client and server.
diff --git a/scheduler/sysdeps.c b/scheduler/sysdeps.c
index 1a1a104..86ac9b9 100644
--- a/scheduler/sysdeps.c
+++ b/scheduler/sysdeps.c
@@ -95,7 +95,7 @@
const int flags = CLONE_VM | CLONE_FS | CLONE_FILES | SIGCHLD;
if (clone( (int (*)(void *))SYSDEPS_StartThread, teb->stack_top, flags, teb ) < 0)
return -1;
- if (!(flags & CLONE_FILES)) close( teb->socket ); /* close the child socket in the parent */
+ if (!(flags & CLONE_FILES)) close( teb->request_fd ); /* close the child socket in the parent */
return 0;
#endif
@@ -118,7 +118,7 @@
"addl $8,%%esp" :
: "r" (sp), "g" (SYS_rfork), "g" (flags)
: "eax", "edx");
- if (flags & RFFDG) close( teb->socket ); /* close the child socket in the parent */
+ if (flags & RFFDG) close( teb->request_fd ); /* close the child socket in the parent */
return 0;
#endif
@@ -146,9 +146,9 @@
*/
void SYSDEPS_ExitThread( int status )
{
- int socket = NtCurrentTeb()->socket;
- NtCurrentTeb()->socket = -1;
- close( socket );
+ int fd = NtCurrentTeb()->request_fd;
+ NtCurrentTeb()->request_fd = -1;
+ close( fd );
#ifdef HAVE__LWP_CREATE
_lwp_exit();
#endif