Hello everyone,
I want to get the confirmation from you about the usage of
ports_get_right(), ports_destroy_right() and ports_port_deref().
When I use ports_get_right() to get the receive right of the port, I
should always make a send right for the port. So if we just want to get
the name of the port, we should use the port_right field in port_info
directly. Am I right?
ports_destroy_right() is only used to destroy the receive right and it
shouldn't be able to destroy the port_info object. ports_port_deref() is
the one to destroy the port_info object (of course, only when its
reference count is 0), right?
I realize now that I really need to use libports very carefully.
Another question is about the notification of no senders.
From the mach manual, I see there are two situations where no-senders
notification is generated.
1. "If notify is not null, and the receive right’s make-send count is
greater than or equal to the sync value, and it has no extant send
rights, than an immediate no-senders notification is generated."
2. "Otherwise the notification is generated when the receive right next
loses its last extant send right."
For the first case, why is the notification generated only when
make-send count >= the sync value? Is there any special reason for this?
For the second case, if notify is null, how can we receive the
notification? The same question for the dead-name notification (the
argument notify is also allowed to be null).
Zheng Da