[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: notify_no_senders oddity
From: |
Samuel Thibault |
Subject: |
Re: notify_no_senders oddity |
Date: |
Sun, 31 Dec 2006 17:33:21 +0100 |
User-agent: |
Mutt/1.5.11 |
Richard Braun, le Sun 31 Dec 2006 17:11:55 +0100, a écrit :
> On Sun, Dec 31, 2006 at 12:30:24PM +0100, Samuel Thibault wrote:
> > There's something I don't understand in
> > i386/i386at/i386at_ds_routines.c:ds_notify()
> >
> > dev = (device_t) ns->not_header.msgh_remote_port;
> >
> > How a port can be a device_t?
>
> In include/mach/message.h:
>
> typedef struct {
> ...
> mach_port_t msgh_remote_port;
> ...
> } mach_msg_header_t;
>
> and in include/device/device_types.h
>
> typedef mach_port_t device_t;
>
> I'm not totally sure of what you call a `port' in your question.
Well, I actually don't know much details about mach ports :)
More specifically, I'm talking about an ipc_port_t, as used for instance
in linux/dev/glue/block.c in device_open()
bd->port = ipc_port_alloc_kernel ();
and just a few lines below,
ipc_port_nsrequest (bd->port, 1, notify, ¬ify);
which eventually calls ipc_notify_no_senders() which does
n->not_header.msgh_remote_port = (mach_port_t) port;
Hence casting ipc_port_t into mach_port_t, which later is converted to
device_t as I said:
> > dev = (device_t) ns->not_header.msgh_remote_port;
Samuel