Skip to main content
added 70 characters in body
Source Link
goldilocks
  • 90k
  • 33
  • 212
  • 272

sockets use different APIs

That's not entirely true. There are some additional functions for use with sockets, but you can use, e.g., normal read() and write() on a socket fd.

how does this "Everything is a file" apply here?

In the sense that a file descriptor is involved.

If your definition of "file" is a discrete sequence of bytes stored in a filesystem, then not everything is a file. However, if your definition of file is more handle like -- a conduit for information, i.e., an I/O connection -- then "everything is a file" starts to make more sense. These things inevitably do involve sequences of bytes, but where they come from or go to may differ contextually.

It's not really intended literally, however. A daemon is not a file, a daemon is a process; but if you are doing IPCIPC your method of relating to another process might well be mitigated by file style entities. Etc. Etc.

sockets use different APIs

That's not entirely true. There are some additional functions for use with sockets, but you can use, e.g., normal read() and write() on a socket fd.

how does this "Everything is a file" apply here?

In the sense that a file descriptor is involved.

If your definition of "file" is a discrete sequence of bytes stored in a filesystem, then not everything is a file. However, if your definition of file is more handle like -- a conduit for information, i.e., an I/O connection -- then "everything is a file" starts to make more sense.

It's not really intended literally, however. A daemon is not a file, a daemon is a process; but if you are doing IPC your method of relating to another process might well be mitigated by file style entities. Etc. Etc.

sockets use different APIs

That's not entirely true. There are some additional functions for use with sockets, but you can use, e.g., normal read() and write() on a socket fd.

how does this "Everything is a file" apply here?

In the sense that a file descriptor is involved.

If your definition of "file" is a discrete sequence of bytes stored in a filesystem, then not everything is a file. However, if your definition of file is more handle like -- a conduit for information, i.e., an I/O connection -- then "everything is a file" starts to make more sense. These things inevitably do involve sequences of bytes, but where they come from or go to may differ contextually.

It's not really intended literally, however. A daemon is not a file, a daemon is a process; but if you are doing IPC your method of relating to another process might well be mitigated by file style entities.

Source Link
goldilocks
  • 90k
  • 33
  • 212
  • 272

sockets use different APIs

That's not entirely true. There are some additional functions for use with sockets, but you can use, e.g., normal read() and write() on a socket fd.

how does this "Everything is a file" apply here?

In the sense that a file descriptor is involved.

If your definition of "file" is a discrete sequence of bytes stored in a filesystem, then not everything is a file. However, if your definition of file is more handle like -- a conduit for information, i.e., an I/O connection -- then "everything is a file" starts to make more sense.

It's not really intended literally, however. A daemon is not a file, a daemon is a process; but if you are doing IPC your method of relating to another process might well be mitigated by file style entities. Etc. Etc.