Article View: comp.sys.next.programmer
Article #638Transferring port access rights
From: Anne Wilson
Date: Sun, 12 Apr 1992 21:18
Date: Sun, 12 Apr 1992 21:18
57 lines
2813 bytes
2813 bytes
I am puzzled about how to transfer port access rights across tasks.
I can think of three methods for a task to acquire port access rights,
but I don't fully understand the implications of each:
-------
1) port owner: allocates port, and does a netname_check_in();
client: does a netname_look_up();
Send rights seem to be conveyed to the client via netname_look_up,
although the docs don't say anything about this. This method has worked
fine for me.
This method is easy and simple. The programmer can use either the
network name server or the bootstrap server. Via the network name server,
ports can be found across a network. However, can receive rights could be
conveyed this way?
-------
2) port owner: allocates port, does a task_by_unix_pid() to get child
task's task id, then does a port_insert_send()/port_insert_receive()
to give child task send/receive rights;
client (in this case, child task): does nothing
I have tried this method, and have been unable to get a successful
execution of port_insert_send(). It tells me my 3rd argument, the "name
by which the receiving task will know the new rights", is invalid and
I'm not sure why. I gave up and went back to my old method, #1.
Does this method automatically construct a message that a programmer
might construct by hand, as in #3, below?
This method looks simple (if I could get it to work!). The only possible
drawback that I'm aware of is that the receiving task must reside on the
same host.
---------
3) port owner: allocates port, sends a message to client
client: waits for message
In this case, I'm not sure how to structure the message. Should
the message body be a port_t/port_rcv_t? Or, should the message body
be port_name_t and one of the predefined capabilities? What is the
difference between the two approaches, and when do you use each?
This method seems to require more effort on the part of the programmer.
But, my impression is that this is the only way to transfer arbitrary rights
to a task on an arbitrary host.
-------
If anyone has any insights or code snippets to share with me, I would
greatly appreciate it! I'm particularly interested in code for method
#3.
Also, for the NeXT people, perhaps some clearer documentation on this
topic would be useful. (Or did I miss it?) (Or maybe this should be
directed to the Mach people...)
Thanks in advance!
Anne
Technical Details
Message-ID:
<53054@mimsy.umd.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!dtix!mimsy!wilsonShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!mimsy!wilson From: wilson@mimsy.umd.edu (Anne Wilson) Newsgroups: comp.sys.next.programmer Subject: Transferring port access rights Message-ID: <53054@mimsy.umd.edu> Date: 12 Apr 92 21:18:25 GMT Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 57