[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 53/98: proc: improve the message_demuxer function
From: |
Samuel Thibault |
Subject: |
[hurd] 53/98: proc: improve the message_demuxer function |
Date: |
Tue, 14 Jan 2014 02:00:02 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 89c0598d4c1c414c7c567995fd1d0e569fee3d08
Author: Justus Winter <address@hidden>
Date: Sat Nov 30 17:29:04 2013 +0100
proc: improve the message_demuxer function
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.
* proc/main.c (message_demuxer): Improve the demuxer function.
---
proc/main.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
diff --git a/proc/main.c b/proc/main.c
index aaaa5a7..5d6dc21 100644
--- a/proc/main.c
+++ b/proc/main.c
@@ -38,18 +38,24 @@ int
message_demuxer (mach_msg_header_t *inp,
mach_msg_header_t *outp)
{
- extern int process_server (mach_msg_header_t *, mach_msg_header_t *);
- extern int notify_server (mach_msg_header_t *, mach_msg_header_t *);
- extern int proc_exc_server (mach_msg_header_t *, mach_msg_header_t *);
- int status;
-
- pthread_mutex_lock (&global_lock);
- status = (process_server (inp, outp)
- || notify_server (inp, outp)
- || ports_interrupt_server (inp, outp)
- || proc_exc_server (inp, outp));
- pthread_mutex_unlock (&global_lock);
- return status;
+ mig_routine_t process_server_routine (mach_msg_header_t *);
+ mig_routine_t notify_server_routine (mach_msg_header_t *);
+ mig_routine_t ports_interrupt_server_routine (mach_msg_header_t *);
+ mig_routine_t proc_exc_server_routine (mach_msg_header_t *);
+
+ mig_routine_t routine;
+ if ((routine = process_server_routine (inp)) ||
+ (routine = notify_server_routine (inp)) ||
+ (routine = ports_interrupt_server_routine (inp)) ||
+ (routine = proc_exc_server_routine (inp)))
+ {
+ pthread_mutex_lock (&global_lock);
+ (*routine) (inp, outp);
+ pthread_mutex_unlock (&global_lock);
+ return TRUE;
+ }
+ else
+ return FALSE;
}
pthread_mutex_t global_lock = PTHREAD_MUTEX_INITIALIZER;
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 68/98: trans: fix locking issue in fakeroot, (continued)
- [hurd] 68/98: trans: fix locking issue in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 55/98: pflocal: improve the demuxer functions, Samuel Thibault, 2014/01/13
- [hurd] 57/98: utils: improve the auth_demuxer function in fakeauth.c, Samuel Thibault, 2014/01/13
- [hurd] 66/98: trans: improve the performance of dir_lookup in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 41/98: libports: improve error handling in ports_reallocate_from_external, Samuel Thibault, 2014/01/13
- [hurd] 40/98: libports: improve error handling in ports_reallocate_port, Samuel Thibault, 2014/01/13
- [hurd] 58/98: trans: remove unused declaration from fakeroot.c, Samuel Thibault, 2014/01/13
- [hurd] 72/98: trans: fix reference counting bug in fakeroot, Samuel Thibault, 2014/01/13
- [hurd] 39/98: proc: update comments, Samuel Thibault, 2014/01/13
- [hurd] 26/98: Make sure created netfs nodes have stat validated, Samuel Thibault, 2014/01/13
- [hurd] 53/98: proc: improve the message_demuxer function,
Samuel Thibault <=
- [hurd] 04/98: utils: implement settrans --pid-file, Samuel Thibault, 2014/01/13
- [hurd] 59/98: trans: improve the netfs_demuxer function in fakeroot.c, Samuel Thibault, 2014/01/13
- [hurd] 48/98: libports: another right leak fix, Samuel Thibault, 2014/01/13
- [hurd] 73/98: trans: improve the error handling in fakeauth, Samuel Thibault, 2014/01/13
- [hurd] 06/98: proc: fix the declaraton of genpid, Samuel Thibault, 2014/01/13
- [hurd] 71/98: trans: fix locking in fakeroot's netfs_S_dir_lookup, Samuel Thibault, 2014/01/13
- [hurd] 70/98: trans: fix reference counting and destruction of fake nodes, Samuel Thibault, 2014/01/13
- [hurd] 77/98: trans/fakeroot: fix ownership of newly created files, Samuel Thibault, 2014/01/13
- [hurd] 64/98: libihash: remove dead code, Samuel Thibault, 2014/01/13
- [hurd] 74/98: trans: unlock nodes with faked attributes in fakeroot, Samuel Thibault, 2014/01/13