Gentoo Archives: gentoo-user

From: Hans-Werner Hilse <hilse@×××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] [OT] Why directories aren't files?
Date: Mon, 18 Sep 2006 15:04:59
Message-Id: 20060918163052.f1838bdf.hilse@web.de
In Reply to: [gentoo-user] [OT] Why directories aren't files? by Matteo Pillon
1 Hi,
2
3 On Mon, 18 Sep 2006 11:10:57 +0200 Matteo Pillon
4 <matteo.pillon@×××××.com> wrote:
5
6 > I was wondering why Linux doesn't treat directories like files, as
7 > many other unix implementations do.
8
9 Pragmatic answer:
10
11 because nobody implemented it for most filesystems. Most filesystems
12 just define "generic_read_dir" as handling function for "readdir".
13 "generic_read_dir" always returns -EISDIR.
14
15 (see /usr/src/linux/fs/libfs.c and /usr/src/linux/fs/*/dir.c)
16
17 > For example, in Linux, you can't do 'cat .' while on FreeBSD you can.
18 > Why? There is a practical reason?
19
20 Well, I think it would be just another unstable API that clueless
21 programmers would get trapped by. What would be the benefit of being
22 able to open it?
23
24 > Forgive me this OT, I wasn't able to find a suitable list.
25
26 That would be the LKML :-)
27
28 -hwh
29 --
30 gentoo-user@g.o mailing list

Replies

Subject Author
Re: [gentoo-user] [OT] Why directories aren't files? alain.didierjean@××××.fr
Re: [gentoo-user] [OT] Why directories aren't files? Matteo Pillon <matteo.pillon@×××××.com>
Re: [gentoo-user] [OT] Why directories aren't files? Hans-Werner Hilse <hilse@×××.de>