[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Hurd advocacy? (newb docs)



Greg Buchholz <sleepingsquirrel@sleepingsquirrel.org> writes:

> I've wondered about the
> chain of events that occur when a program makes a call to read().
[...]
> A call to
> read() is really a wrapper around another glibc function called
> io_read().  This function sends a message to the root translator with
> the name of the target file and a request for a handle to a subroutine
> which will be invoked to get the actual data.

I think you're a little confused. There should be no filenames
involved at all in the read operation (that's just as true for the
Hurd as for traditional Un*x). When you call *open*, you provide a
filename. The filename is sent on either to the / filesystem (if it's
an absolute filename), or to the filesystem responsible for your
current working directory (for relative filenames). Additional
translators may be encountered during the process.

The result of a successful open is a *port* that represents the open
file, and which is served by the filesystem/translator responsible for
the file. read and write operations on the file result in messages
sent to that port, no other servers should be involved. In the Hurd, a
POSIX file descriptor is more or less a wrapper around such a Mach
port.

So the chain of events that occur when a program calls read() should
be fairly simple (which of course doesn't imply that it is bad to
describe it in an text on how the Hurd works). But the chain of events
that occur when a program calls open() is more complex, and also more
"Hurdish", i.e. it should reveal more about the Hurd way of doing
things.

Regards,
/Niels



Reply to: