Most notably: network sockets do not have file-like semantics, mainly because they were introduced as a concept and implemented long after the system was designed. Plan9 is an effort to revise all system objects to be accessible with the same file-like fopen/fclose system calls.
Re:Dd is not a disk writing tool (2015)
by RJIb8RBYxzAMX9u on Sunday January 08, 2017 @09:23AM
(#13349772)
"Everything is a file on UNIX" is as true as "Vulcan's cannot lie."
Re:Dd is not a disk writing tool (2015)
by sh_tinh_hair on Sunday January 08, 2017 @12:37PM
(#13350859)
Great analogy.
I assume Vulcans can lie?
Re:Dd is not a disk writing tool (2015)
by LeoPanthera on Monday January 09, 2017 @01:35AM
(#13354488)
Technically they cannot lie. But they can exaggerate. Or omit facts.
Re:Dd is not a disk writing tool (2015)
by sh_tinh_hair on Sunday January 08, 2017 @12:28PM
(#13350804)
Only one ipc primitive (fifo) can be used with man 2 read or write. Sysv ipc cannot, sockets (any domain) cannot (unless there is a kernel interface via /proc or another pseudo fs). What is meant by this saying (and the way it is has been used in my experience) is that everything in unix _looks_ like a file. That is usually meant in reference to the C API which has some r[ec]v|read|write|snd type namespace.
Re:Dd is not a disk writing tool (2015)
by deathanatos on Sunday January 08, 2017 @03:18PM
(#13351733)
You can read(2) and write(2) to a socket, although it is more normal to recv and send on it. On Linux, you can also (and pretty much MUST) read(2) and write(2) to an eventfd; you can read(2) from a timerfd. That said, the semantics of the latter are considerably different from that of fifos or sockets.
Re:Dd is not a disk writing tool (2015)
by sh_tinh_hair on Sunday January 08, 2017 @04:35PM
(#13352162)
You are right. I've long forgotten about read() and write() compat with sockets for very good reason.
I don't lump an eventfd into the same IPC category as those mentioned in parent for the semantic(s) reason you mention and also for it's intended usage.
- not all the things on unix are abstracted as files (or 'byte streams' to be more accurate). however, i/o resources and some ipc facilities are defined so. an operating system provides many other abstractions in addition to these such as processes, threads, non-stream devices, concurrency and synchronization primitives, etc.; thus it's absolutely wrong to say that everything is a file on unix.