[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/7] exec: improve the exec_demuxer function
From: |
Justus Winter |
Subject: |
[PATCH 4/7] exec: improve the exec_demuxer function |
Date: |
Sat, 30 Nov 2013 20:11:00 +0100 |
Handle multiple request types as recommended by the Mach Server
Writer's Guide section 4, subsection "Handling Multiple Request
Types". This avoids initializing the reply message in every X_server
function. The reply message has already been properly initialized in
libports, so there is no need to call mig_reply_setup.
Furthermore, move the exec_startup_server_routine to the end of the
chain, as the startup related functions are only needed at system
bootstrap time.
* exec/main.c (exec_demuxer): Improve the demuxer function.
---
exec/main.c | 21 +++++++++++++++------
1 file changed, 15 insertions(+), 6 deletions(-)
diff --git a/exec/main.c b/exec/main.c
index d23cc12..41b1db4 100644
--- a/exec/main.c
+++ b/exec/main.c
@@ -1,6 +1,6 @@
/* GNU Hurd standard exec server, main program and server mechanics.
- Copyright (C) 1992,93,94,95,96,97,98,99,2000,01,02
+ Copyright (C) 1992,93,94,95,96,97,98,99,2000,01,02,13
Free Software Foundation, Inc.
Written by Roland McGrath.
This file is part of the GNU Hurd.
@@ -49,11 +49,20 @@ char **save_argv;
static int
exec_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp)
{
- extern int exec_server (mach_msg_header_t *inp, mach_msg_header_t *outp);
- extern int exec_startup_server (mach_msg_header_t *, mach_msg_header_t *);
- return (exec_startup_server (inp, outp) ||
- exec_server (inp, outp) ||
- trivfs_demuxer (inp, outp));
+ mig_routine_t exec_server_routine (mach_msg_header_t *);
+ mig_routine_t exec_startup_server_routine (mach_msg_header_t *);
+
+ mig_routine_t routine;
+ if ((routine = exec_server_routine (inp)) ||
+ (routine = NULL, trivfs_demuxer (inp, outp)) ||
+ (routine = exec_startup_server_routine (inp)))
+ {
+ if (routine)
+ (*routine) (inp, outp);
+ return TRUE;
+ }
+ else
+ return FALSE;
}
--
1.7.10.4
- Improving the demuxer functions, Justus Winter, 2013/11/29
- [PATCH] libdiskfs: improve the diskfs_demuxer function, Justus Winter, 2013/11/29
- [PATCH 1/7] libdiskfs: improve the diskfs_demuxer function, Justus Winter, 2013/11/30
- [PATCH 3/7] libtrivfs: improve the trivfs_demuxer function, Justus Winter, 2013/11/30
- [PATCH 2/7] libnetfs: improve the netfs_demuxer function, Justus Winter, 2013/11/30
- [PATCH 5/7] proc: improve the message_demuxer function, Justus Winter, 2013/11/30
- [PATCH 4/7] exec: improve the exec_demuxer function,
Justus Winter <=
- [PATCH 6/7] pfinet: improve the pfinet_demuxer function, Justus Winter, 2013/11/30
- [PATCH 7/7] pflocal: improve the demuxer functions, Justus Winter, 2013/11/30