[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Getting a file_t from a file descriptor (was: Tiny error w.r.t. change f
From: |
Thomas Schwinge |
Subject: |
Getting a file_t from a file descriptor (was: Tiny error w.r.t. change from 2005-12-05) |
Date: |
Thu, 20 Jul 2006 18:35:39 +0200 |
User-agent: |
Mutt/1.5.6+20040907i |
[Cced to bug-hurd.]
Hello!
On Thu, Jul 20, 2006 at 08:45:37AM -0700, Paul Eggert wrote:
> Thanks for the fix.
Sure, sure. :-)
> By the way, is there some way in the Hurd to change the author of a
> file, given only its Unix file descriptor? I'd like to fix the FIXME
> about 5 lines before your fix, as that problem leads to a potential
> race condition. I'd appreciate any info you can provide for how to
> map a Unix file descriptor to a Hurd file_t.
While I'm not that proficient in these issues, is this what you're
looking for?
<hurd.h>
#v+
[...]
/* Return the io server port for file descriptor FD.
This adds a Mach user reference to the returned port.
On error, sets `errno' and returns MACH_PORT_NULL. */
extern io_t __getdport (int fd), getdport (int fd);
[...]
#v-
Used e.g. like this:
[hurd]/utils/login.c
#v+
[...]
mach_port_t fds[3]; /* File descriptors passed. */
[...]
for (i = 0; i < 3; i++)
fds[i] = getdport (i);
[...]
#v-
Please tell if you (or anyone else, of course) need access to a GNU/Hurd
system.
Regards,
Thomas
- Getting a file_t from a file descriptor (was: Tiny error w.r.t. change from 2005-12-05),
Thomas Schwinge <=