> If you can read on it, it's a file.
Um, no. If you can SEEK on it, it's a file. If you can't, it's a socket or a pipe.
> If you can read on it, it's a file.
Um, no. If you can SEEK on it, it's a file. If you can't, it's a socket or a pipe.
> In UNIX, a file descriptor is pretty much anything. You could say that sockets aren't remotely file-like, and you'd be right. What's your point?
The fact that you can't seek on a socket is irrelevant to the thread, which is about accessing files, not navigating them.
Sure, but that doesn't mean he doesn't occasionally make a mistake.
> In that message, he's talking about...
Yes, I know. But the larger context is Linus debunking (correctly) the unix philosophy that "everything is a file". Linus is correct: it is not the case, never has been the case, nor should it be the case, that everything is a file. But then he undermines his own argument with the (mistaken) claim that "if you can read it, it's a file." No. There's a salient difference between files one the one hand, and pipes and sockets on the other, and it has nothing to do with whether or not they have names. A named pipe is still a pipe, not a file. "Files" in /dev are not files, neither are "files" in /proc, despite the fact that they have names.
It's a detail, but an important one in the larger context IMHO.
Yes, the wording around "file" is a bit ambiguous, because Unix has a major design philosophy that said you can treat non files as files as get a lot of mileage, but didn't call those things "fauxles" or something instead.
No, it's quibbling pedagogy.
> Yes, the wording around "file" is a bit ambiguous
Exactly. And this can be a real problem when people are first learning about unix.
In fact, it can be a real problem even after that. Just the other day (true story) I was trying to debug some server latency issues and I asked one of our sysadmins for help. He suggested that I run lsof to help debug the problem. I told him I was pretty sure that wouldn't help because all the evidence indicated that the problem was with a rogue process, not a file, and he said, "This is unix. Everything is a file."