Re:Logs Are Streams, Not Files
by burgerbrain on Friday April 01, 2011 @01:08PM
(#2397039)
Correction: streams are files. Everything are files.
[ Parent
| on HN ]
"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.
Re:Logs Are Streams, Not Files
by burgerbrain on Friday April 01, 2011 @06:27PM
(#2398366)
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.
See Plan 9: http://lwn.net/Articles/137439/
Re:Logs Are Streams, Not Files
by jasonwatkinspdx on Friday April 01, 2011 @01:40PM
(#2397172)
Rather than just being snarky why not correctly correct the post by mentioning named pipes?
Re:Logs Are Streams, Not Files
by burgerbrain on Friday April 01, 2011 @01:52PM
(#2397223)
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.
Re:Logs Are Streams, Not Files
by jasonwatkinspdx on Friday April 01, 2011 @02:53PM
(#2397505)
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.
Re:Logs Are Streams, Not Files
by burgerbrain on Friday April 01, 2011 @03:45PM
(#2397717)
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.
Re:Logs Are Streams, Not Files
by burgerbrain on Friday April 01, 2011 @06:25PM
(#2398357)
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!
Re:Logs Are Streams, Not Files
by arctangent on Friday April 01, 2011 @06:48PM
(#2398440)
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 :-)