diff options
author | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-02-24 12:23:05 +0100 |
---|---|---|
committer | Justus Winter <4winter@informatik.uni-hamburg.de> | 2014-02-25 11:16:16 +0100 |
commit | 6d38ec6d31e295b60bd5c84cc89229484afed56a (patch) | |
tree | 7aa2250a3a4de932f7be91863d99a907fce44825 /libpager | |
parent | f2640263468aced5c91ac5fc1f15bb5691f7eb20 (diff) |
libpager: improve the pager_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.
* libpager/demuxer.c (pager_demuxer): Improve the demuxer function.
Diffstat (limited to 'libpager')
-rw-r--r-- | libpager/demuxer.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libpager/demuxer.c b/libpager/demuxer.c index 79c0ddc5..b4d40541 100644 --- a/libpager/demuxer.c +++ b/libpager/demuxer.c @@ -25,16 +25,16 @@ int pager_demuxer (mach_msg_header_t *inp, mach_msg_header_t *outp) { - extern int _pager_seqnos_memory_object_server (mach_msg_header_t *inp, - mach_msg_header_t *outp); - extern int _pager_seqnos_notify_server (mach_msg_header_t *inp, - mach_msg_header_t *outp); + mig_routine_t routine; + if ((routine = _pager_seqnos_memory_object_server_routine (inp)) || + (routine = _pager_seqnos_notify_server_routine (inp))) + { + (*routine) (inp, outp); + return TRUE; + } - int result = _pager_seqnos_memory_object_server (inp, outp) - || _pager_seqnos_notify_server (inp, outp); - if (!result) - /* Synchronize our bookkeeping of the port's seqno with the one consumed by - this bogus message. */ - _pager_update_seqno (inp->msgh_local_port, inp->msgh_seqno); - return result; + /* Synchronize our bookkeeping of the port's seqno with the one + consumed by this bogus message. */ + _pager_update_seqno (inp->msgh_local_port, inp->msgh_seqno); + return FALSE; } |