Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Correction: streams are files. Everything are files.


"Everything is a file" is the biggest myth of UNIX. Everthing is represented by an integer that we call a "file descriptor", that's true. But try calling "accept" on a file descriptor you made with "open", or try calling "sendfile" on a pipe instead of a socket. Doesn't work.

Everything is an integer.


Those integers don't mean anything unless they are actually file descriptors, so the statement "Everything is an integer." is inaccurate.

And of course there are different sorts of files... everybody knows that.


Everything except directories, network interfaces, processes, memory mappings, System V IPC, capabilities (capget(2)), and signals, to name a few.

If everything was a file, Linux would have like 10 system calls total.



Rather than just being snarky why not correctly correct the post by mentioning named pipes?


Named or anonymous, pipes are still just types of files. "Everything is a file" isn't snark, it's a saying almost as old as unix itself.


I'm well familiar with the expression. However it's not helpful to someone who isn't already familiar. It's another form of "you're doing it wrong" without explanation.


It's an intellectual teaser. You read it and think to yourself, "well this can't possibly be true, let me look into this further". Then you learn.


Do you expect people to "look into it further" with everything they think cannot be true? I would not.


If they have any interest in the topic in the first place? Of course.

I certainly did, so many years ago...


It also serves to separate the curious from the non-curious. Getting everything wrong is a fact of life and can happen to anyone.


I think the commenter is simply clarifying that the file has been a universal way to represent almost every resource in Unix since its inception.


If "everything are files", then the whole concept of "file" is completely meaningless.


Welcome to unix. Enjoy your stay!


Not really. It's a completely different statement than "everything is rocks". If everything is a file then everything shares properties common to files. It turns out that this is really useful. If everything were a rock then... well, let's say that it would not be so useful :-)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: