0

It's more like if I run the command cat /proc/net/tcp how are the entries being inserted?

marked as duplicate by muru, Stephen Kitt, Sparhawk, telcoM, Rui F Ribeiro Jun 10 at 12:41

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • To summarize: the files in the /proc directory don't really exist, so the kernel doesn't really update them at all. Whenever a process attempts to read something under /proc, the kernel's procfs driver produces the requested data on demand, by translating the contents of the appropriate kernel internal data structures into formatted text. – telcoM Jun 10 at 5:49
  • Thanks for the reply! It's more like if I run the command cat /proc/net/tcp how are the entries being inserted? – user357066 Jun 10 at 6:30
  • 1
    You can think of it as conceptually similar to how device nodes work: when you open /dev/zero, the endless string of zeroes is not coming from any real file; instead, when you attempt to read the "file", the kernel just generates the data. When you open /proc/net/tcp, the kernel's procfs driver communicates directly with the kernel's TCP protocol driver, which just looks at its table of ongoing TCP connections over IPv4 and produces a human-readable representation of the actual state of the in-kernel connection table at that time. – telcoM Jun 10 at 6:55

Browse other questions tagged or ask your own question.