summaryrefslogtreecommitdiff
path: root/libports/manage-one-thread.c
diff options
context:
space:
mode:
authorMichael I. Bushnell <mib@gnu.org>1996-03-28 20:17:04 +0000
committerMichael I. Bushnell <mib@gnu.org>1996-03-28 20:17:04 +0000
commit0ecd4e94a722d49b4dafbc995efad2b359b947d5 (patch)
tree48e1bd8390f4784fec22af8e90b2d66da9677cb5 /libports/manage-one-thread.c
parentaa3c3b249840bf50f2c6b3bcc71604b4a3426eb6 (diff)
(ports_manage_port_operations_one_thread): Fill in default reply
before doing work; we might return 0 and mach_msg_server expects us to fill in a reply decently no matter what. (ports_manage_port_operations_multithread): Likewise.
Diffstat (limited to 'libports/manage-one-thread.c')
-rw-r--r--libports/manage-one-thread.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/libports/manage-one-thread.c b/libports/manage-one-thread.c
index b3db18aa..254a3770 100644
--- a/libports/manage-one-thread.c
+++ b/libports/manage-one-thread.c
@@ -29,12 +29,33 @@ ports_manage_port_operations_one_thread (struct port_bucket *bucket,
int
internal_demuxer (mach_msg_header_t *inp,
- mach_msg_header_t *outp)
+ mach_msg_header_t *outheadp)
{
struct port_info *pi;
struct rpc_info link;
int status;
error_t err;
+ register mig_reply_header_t *outp = (mig_reply_header_t *) outheadp;
+ static const mach_msg_type_t RetCodeType = {
+ /* msgt_name = */ MACH_MSG_TYPE_INTEGER_32,
+ /* msgt_size = */ 32,
+ /* msgt_number = */ 1,
+ /* msgt_inline = */ TRUE,
+ /* msgt_longform = */ FALSE,
+ /* msgt_deallocate = */ FALSE,
+ /* msgt_unused = */ 0
+ };
+
+ /* Fill in default response. */
+ outp->Head.msgh_bits
+ = MACH_MSGH_BITS(MACH_MSGH_BITS_REMOTE(inp->msgh_bits), 0);
+ outp->Head.msgh_size = sizeof *outp;
+ outp->Head.msgh_remote_port = inp->msgh_remote_port;
+ outp->Head.msgh_local_port = MACH_PORT_NULL;
+ outp->Head.msgh_seqno = 0;
+ outp->Head.msgh_id = inp->msgh_id + 100;
+ outp->RetCodeType = RetCodeType;
+ outp->RetCode = MIG_BAD_ID;
pi = ports_lookup_port (bucket, inp->msgh_local_port, 0);
if (pi)
@@ -50,7 +71,7 @@ ports_manage_port_operations_one_thread (struct port_bucket *bucket,
/* No need to check cancel threshhold here, because
in a single threaded server the cancel is always
handled in order. */
- status = demuxer (inp, outp);
+ status = demuxer (inp, outheadp);
ports_end_rpc (pi, &link);
}
ports_port_deref (pi);