diff options
author | Roland McGrath <roland@gnu.org> | 2002-05-12 19:42:49 +0000 |
---|---|---|
committer | Roland McGrath <roland@gnu.org> | 2002-05-12 19:42:49 +0000 |
commit | 778c6e65116f6053283bd9de011dfc629d4373ad (patch) | |
tree | f067d0a954266053c4d5e3c6b1a5912b65a4539c /trans | |
parent | 1c30d23a45ba5d525affb6505194d55d85061423 (diff) |
2002-05-12 Roland McGrath <roland@frob.com>
* fakeroot.c (netfs_demuxer): New function. Reflect unrecognized
messages to the underlying node port.
Diffstat (limited to 'trans')
-rw-r--r-- | trans/fakeroot.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/trans/fakeroot.c b/trans/fakeroot.c index 0ff7492e..51536b34 100644 --- a/trans/fakeroot.c +++ b/trans/fakeroot.c @@ -582,6 +582,56 @@ netfs_S_io_map (struct protid *user, return err; } +/* This overrides the library's definition. */ +int +netfs_demuxer (mach_msg_header_t *inp, + mach_msg_header_t *outp) +{ + int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *); + int netfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *); + + if (netfs_io_server (inp, outp) + || netfs_fs_server (inp, outp) + || ports_notify_server (inp, outp) + || netfs_fsys_server (inp, outp) + /* XXX we should intercept interrupt_operation and do + the ports_S_interrupt_operation work as well as + sending an interrupt_operation to the underlying file. + */ + || ports_interrupt_server (inp, outp)) + return 1; + else + { + /* We didn't recognize the message ID, so pass the message through + unchanged to the underlying file. */ + struct protid *cred = ports_lookup_port (netfs_port_bucket, + inp->msgh_local_port, + netfs_protid_class); + if (cred == 0) + /* This must be an unknown message on our fsys control port. */ + return 0; + else + { + error_t err; + assert (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) + == MACH_MSG_TYPE_MOVE_SEND); + inp->msgh_bits = (inp->msgh_bits & MACH_MSGH_BITS_COMPLEX) + | MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, + MACH_MSGH_BITS_REMOTE (inp->msgh_bits)); + inp->msgh_local_port = inp->msgh_remote_port; /* reply port */ + inp->msgh_remote_port = cred->po->np->nn->file; + err = mach_msg (inp, MACH_SEND_MSG, inp->msgh_size, 0, + MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, + MACH_PORT_NULL); + assert_perror (err); /* XXX should synthesize reply */ + ports_port_deref (cred); + return 1; + } + } +} + int main (int argc, char **argv) |