Hi,

(Only quickly reading the thread, so I hope my answer makes sense
anyway.)

Marcus Brinkmann <[EMAIL PROTECTED]> writes:

> However, it happens that in Unix, Directories and Files are not only
> very distinct objects, but they are also understand by a wide range of
> applications simultaneously.  Ie, many applications look at a node in
> the filesystem, decide if it is a file _or_ a directory, and then take
> an appropriate action.  All applications that can traverse a filesystem
> belong into this group, for example ls, rm, grep, find, etc.  This is
> the most prominent group, but I would expect there to be isolated cases
> of other applications that do this (maybe Apache?  Input welcome here).

On GNU/Linux with, say, an ext[23] filesystem, a directory does not
implement the file interface, only the directory interface.  Thus, for
instance, `cat DIR' returns `EISDIR'.

On some other systems (e.g., Tru64 with AdvFS IIRC), directories do
implement both interfaces.  So there, one can `cat' the contents of a
directory and it just shows its ``binary content''.

This difference doesn't preclude good behavior of `grep', `find' and
friends.  This is because those programs call `stat ()' before actually
accessing the node, and look at the value of `S_ISDIR ()' _before_
looking at the value of `S_ISREG ()'.  In OO terms: they check for the
most specialized type first.

IOW, the `st_mode' field can be viewed as a poor man's type system.  ;-)

Thanks,
Ludovic.


_______________________________________________
L4-hurd mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/l4-hurd

Reply via email to