1 |
Hi, |
2 |
|
3 |
the question is, what is a file? I would say; a file is an object related to a specific inode. So a directory would be a file as well as FIFOs, unix-sockets, char, block-devices, symlinks and of course regular files. |
4 |
|
5 |
The problem is, that not each kind of file is threaded the same way on Linux. And also it isn't on FreeBSD and the most unix-like systems. If you want an OS, where really everything is a file without exceptions and special kind of files, you should use Plan9. |
6 |
|
7 |
But independent from this aspect, a file refers in its inode to a chunk of storage on the hard disk (or other storage medias), which contains its data. But some files like directories don't contain data. And when you read from a file for example by cat, the content of its allocated chunk of storage will be read. But if there is no such data, for example because of it is a directory, the most clean way IMHO would be to show a corresponding error message. |
8 |
|
9 |
Best Regards |
10 |
Sebastian Noack |
11 |
|
12 |
|
13 |
|
14 |
> -----Ursprüngliche Nachricht----- |
15 |
> Von: Matteo Pillon [mailto:matteo.pillon@×××××.com] |
16 |
> Gesendet: Montag, 18. September 2006 11:11 |
17 |
> An: gentoo-user@l.g.o |
18 |
> Betreff: [gentoo-user] [OT] Why directories aren't files? |
19 |
> |
20 |
> Hi all, |
21 |
> |
22 |
> I was wondering why Linux doesn't treat directories like files, as many |
23 |
> other unix implementations do. |
24 |
> For example, in Linux, you can't do 'cat .' while on FreeBSD you can. |
25 |
> Why? There is a practical reason? |
26 |
> |
27 |
> Forgive me this OT, I wasn't able to find a suitable list. |
28 |
> |
29 |
> Thanks for replies. |
30 |
> Bye. |
31 |
> |
32 |
> -- |
33 |
> * Pillon Matteo |
34 |
> -- |
35 |
> gentoo-user@g.o mailing list |
36 |
|
37 |
|
38 |
-- |
39 |
gentoo-user@g.o mailing list |