582 |
return err; |
return err; |
583 |
} |
} |
584 |
|
|
585 |
|
/* This overrides the library's definition. */ |
586 |
|
int |
587 |
|
netfs_demuxer (mach_msg_header_t *inp, |
588 |
|
mach_msg_header_t *outp) |
589 |
|
{ |
590 |
|
int netfs_fs_server (mach_msg_header_t *, mach_msg_header_t *); |
591 |
|
int netfs_io_server (mach_msg_header_t *, mach_msg_header_t *); |
592 |
|
int netfs_fsys_server (mach_msg_header_t *, mach_msg_header_t *); |
593 |
|
int netfs_ifsock_server (mach_msg_header_t *, mach_msg_header_t *); |
594 |
|
|
595 |
|
if (netfs_io_server (inp, outp) |
596 |
|
|| netfs_fs_server (inp, outp) |
597 |
|
|| ports_notify_server (inp, outp) |
598 |
|
|| netfs_fsys_server (inp, outp) |
599 |
|
/* XXX we should intercept interrupt_operation and do |
600 |
|
the ports_S_interrupt_operation work as well as |
601 |
|
sending an interrupt_operation to the underlying file. |
602 |
|
*/ |
603 |
|
|| ports_interrupt_server (inp, outp)) |
604 |
|
return 1; |
605 |
|
else |
606 |
|
{ |
607 |
|
/* We didn't recognize the message ID, so pass the message through |
608 |
|
unchanged to the underlying file. */ |
609 |
|
struct protid *cred = ports_lookup_port (netfs_port_bucket, |
610 |
|
inp->msgh_local_port, |
611 |
|
netfs_protid_class); |
612 |
|
if (cred == 0) |
613 |
|
/* This must be an unknown message on our fsys control port. */ |
614 |
|
return 0; |
615 |
|
else |
616 |
|
{ |
617 |
|
error_t err; |
618 |
|
assert (MACH_MSGH_BITS_LOCAL (inp->msgh_bits) |
619 |
|
== MACH_MSG_TYPE_MOVE_SEND); |
620 |
|
inp->msgh_bits = (inp->msgh_bits & MACH_MSGH_BITS_COMPLEX) |
621 |
|
| MACH_MSGH_BITS (MACH_MSG_TYPE_COPY_SEND, |
622 |
|
MACH_MSGH_BITS_REMOTE (inp->msgh_bits)); |
623 |
|
inp->msgh_local_port = inp->msgh_remote_port; /* reply port */ |
624 |
|
inp->msgh_remote_port = cred->po->np->nn->file; |
625 |
|
err = mach_msg (inp, MACH_SEND_MSG, inp->msgh_size, 0, |
626 |
|
MACH_PORT_NULL, MACH_MSG_TIMEOUT_NONE, |
627 |
|
MACH_PORT_NULL); |
628 |
|
assert_perror (err); /* XXX should synthesize reply */ |
629 |
|
ports_port_deref (cred); |
630 |
|
return 1; |
631 |
|
} |
632 |
|
} |
633 |
|
} |
634 |
|
|
635 |
|
|
636 |
int |
int |
637 |
main (int argc, char **argv) |
main (int argc, char **argv) |