Jan Atle Ramsli <[EMAIL PROTECTED]> writes: > > error_t > > _hurd_ports_use (int which, error_t (*operate) (mach_port_t)) > > { > > + if (_hurd_ports == NULL) > > + return ENOENT; > > return HURD_PORT_USE (&_hurd_ports[which], (*operate) (port)); > > } > > > > END OF PATCH. > > Could someone please explain what tihs function is doing?
I think it works like this: glibc keeps a process global table _hurd_ports of ports (like the root directory, current directory, ...). I don't have the glibc sources here, so I'm not sure exactly what ports are stored there, perhaps also things like open files are stored in the same table. _hurd_ports_use extracts one of the ports from that table, and invokes the function (pointed to by) operate with the port as argument. To access the table, it uses the macro HURD_PORT_USE, which puts the port into the local variable port (which exists only in the expansion of that macro), and which also takes care of all locking that is needed before and after using the table and the port. I don't understand all the details of HURD_PORT_USE, like the struct hurd_userlink argument that is passed to _hurd_port_get and _hurd_port_free, or what information, besides a mach_port_t, is stored in a struct hurd_port. But the overall meaning of the _hurd_ports_use function seems quite clear. Its first argument, which, is used to select a port from the table, and its second argument, operate, says what to do with the port. Regards, /Niels _______________________________________________ Bug-hurd mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-hurd