Check out my first novel, midnight's simulacra!

Procfs: Difference between revisions

From dankwiki
No edit summary
No edit summary
Line 1: Line 1:
procfs [http://lucasvr.gobolinux.org/etc/Killian84-Procfs-USENIX.pdf began life] in 1984's UNIX V8 as a virtual filesystem dedicated to exporting process information and supporting [[ptrace]] (another decades-old mess), presumably after Tom Killian lost a bet to a VAX. Over time, it has grown substantially on any number of operating systems. It is pretty much a required interface on [[Linux APIs|Linux]], and strongly recommended on Solaris and [[FreeBSD]].
procfs [http://lucasvr.gobolinux.org/etc/Killian84-Procfs-USENIX.pdf began life] in 1984's UNIX V8 as a virtual filesystem dedicated to exporting process information and supporting [[ptrace]] (another decades-old mess), presumably after Tom Killian lost a bet to a VAX. Over time, it has grown substantially on any number of operating systems. It is pretty much a required interface on [[Linux APIs|Linux]], and strongly recommended on Solaris and [[FreeBSD]].


==proc/PID==
==<tt>proc/PID</tt>==
Each entity associated with a non-zero PID (this includes most kernel threads) has a corresponding toplevel procfs directory named by its PID (e.g. when using [[systemd]] as init and mounting procfs at <tt>/proc</tt>, systemd's primary process is described by <tt>/proc/1</tt> (the process only appears in procfs mounts within the same PID namespace). One of the entries is <tt>proc/PID/task</tt>, a directory which contains the threads making up the process, using the TID as name:
Each entity associated with a non-zero PID (this includes most kernel threads) has a corresponding toplevel procfs directory named by its PID (e.g. when using [[systemd]] as init and mounting procfs at <tt>/proc</tt>, systemd's primary process is described by <tt>/proc/1</tt> (the process only appears in procfs mounts within the same PID namespace). One of the entries is <tt>proc/PID/task</tt>, a directory which contains the threads making up the process, using the TID as name: