3 ms·
Wow, Linus had me all the way to the very end: > 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
by lisper 8y ago
Wow, Linus had me all the way to the very end:
> 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.
- UlisesAC4 8y agoMaybe you could see them as in memory files. Or buffers of files.
- lisper 8y agoHuh? See what as memory files? (And what the fleep is a "memory file"?)
- fjsolwmv 8y agoI think Linus understands Linux files. Reread the message: > 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.
- lisper 8y ago> I think Linus understands Linux files. 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.
- fjsolwmv 8y agoThis quibbling semantics. That's like saying a ball isn't really a ball because it's not curved at a molecular level. It's true and it'd interesting in it's own sense, but not at all relevant to the real world discussion at hand, and not a refutation of anything in context ("had me until the end..."). 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.
- lisper 8y ago> This quibbling semantics 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."