PROCFS(4)
β¨ PROCFS(4) β the process file system, bestie π
okay so this is the procfs manual page from the Kernel Interfaces Manual, section 4, and we're gonna get into it. no cap, it's giving "filesystem but make it a window into every process on the box." πͺπ
πΈ NAME πΈ
procfs β process file system. literally that's the whole name and it ate.
π SYNOPSIS π
proc /proc procfs rw 0 0
that's the fstab line, bestie. put it in your /etc/fstab and it slays. β¨
π DESCRIPTION π
so first thing first, and I need you to hear me: this functionality is deprecated. not me being dramatic, that's literally what the page says. users are advised to use libprocstat(3) and kvm(3) instead. so like, know it, love it, maybe don't build your whole personality on it. π
the process file system β procfs β implements a view of the system process table inside the file system. it's normally mounted on /proc. yes, that /proc. iconic behavior. π
here's the cute part: procfs provides a two-level view of process space, unlike the previous FreeBSD 1.1 procfs implementation. at the highest level, processes themselves are named according to their process ids in decimal, with no leading zeros. there's also a special node called curproc which always refers to the process making the lookup request. main character node, honestly. π
each node is a directory which contains the following entries:
dbregsβ the debug registers as defined bystruct dbregsin<machine/reg.h>.dbregsis currently only implemented on thei386architecture. intel girlies rise. π§etypeβ the type of the executable referenced by the file entry.fileβ a symbolic link to the file from which the process text was read. this can be used to gain access to the process' symbol table, or to start another copy of the process. if the file cannot be found, the link target isunknown. sad but true. π₯²fpregsβ the floating point registers as defined bystruct fpregsin<machine/reg.h>.fpregsis only implemented on machines which have distinct general purpose and floating point register sets.mapβ a collection of lines describing the memory regions of the process, where each line contains the following fields:start-addressβ the starting address for the region (inclusive).end-addressβ the ending address for the region (exclusive).residentβ the number of resident pages.private-residentβ the number of resident pages that were private to the process.objβ the virtual address of thestruct vm_objectkernel data structure describing the memory region.accessβ a three character string comprising the charactersr,wandx, denoting read, write, and execute permissions respectively. the lack of a permission is represented by-.ref_countβ the number of references to the region.shadow_countβ the number of VM objects that this region is a shadow for.flagsβ the flags for the object, see the flags namedOBJ_*in<vm/vm_object.h>.copy-on-writeβ whether the region is copy-on-write. one of:COWβ a copy-on-write region.NCOWβ a non-copy-on-write region.
needs-copyβ whether the region needs a copy. one of:NCβ the region needs a copy.NNCβ the region does not need a copy.
typeβ the type of the region. one of:deadβ a region associated with a dead VM object.deviceβ a region backed by device memory.noneβ a region not backed by anything.physβ a region backed by physical memory.swapβ a region backed by swap.unknownβ a region of unknown type.vnodeβ a region backed by a file.
fullpathβ the path to the file backing the memory region, or-if there is no such file.credβ one of:CHβ the region is being charged to the user specified in thecharged-uidfield.NCHβ the region is not being charged to any user.
charged-uidβ the UID of the user being charged, or-1if no user is being charged.
memβ the complete virtual memory image of the process. only those address which exist in the process can be accessed. reads and writes to this file modify the process. writes to the text segment remain private to the process. so like, be normal about it. πnoteβ used for sending signals to the process. not implemented.notepgβ used for sending signal to the process group. not implemented.osrelβ allows read and write of the kernelosrelvalue assigned to the process. it affects the compatibility shims that are turned on and off depending on the value. initial process value is read from the ABI note tag in the executed ELF image, and is zero if the tag not supported by binary format or was not found. β¨regsβ allows read and write access to the process' register set. this file contains a binary data structurestruct regsdefined in<machine/reg.h>.regscan only be written when the process is stopped. noted. π«‘rlimitβ this is a read-only file containing the process current and maximum limits. each line is of the formatrlimit current max, with-1indicating infinity.statusβ the process status. this file is read-only and returns a single line containing multiple space-separated fields as follows:- command name
- process id
- parent process id
- process group id
- session id
- device name of the controlling terminal, or a minus sign (β
-β) if there is no controlling terminal. - a list of process flags:
cttyif there is a controlling terminal,sldrif the process is a session leader,noflagsif neither of the other two flags are set. - the process start time in seconds and microseconds, comma separated.
- the user time in seconds and microseconds, comma separated.
- the system time in seconds and microseconds, comma separated.
- the wait channel message
- the process effective UID
- the process real UID
- group list, starting with the effective GID, comma-separated
- the hostname of the jail in which the process runs, or
-to indicate that the process is not running within a jail.
each node is owned by the process's user, and belongs to that user's primary group. periodt. π
π¦ FILES π¦
/procβ normal mount point for the procfs./proc/pidβ directory containing process information for process pid./proc/curprocβ directory containing process information for the current process/proc/selfβ directory containing process information for the current process/proc/curproc/cmdlineβ the process executable name/proc/curproc/etypeβ executable type/proc/curproc/exeβ executable image/proc/curproc/fileβ executable image/proc/curproc/fpregsβ the process floating point register set/proc/curproc/mapβ virtual memory map of the process/proc/curproc/memβ the complete virtual address space of the process/proc/curproc/noteβ used for signaling the process/proc/curproc/notepgβ used for signaling the process group/proc/curproc/osrelβ the processosrelvalue/proc/curproc/regsβ the process register set/proc/curproc/rlimitβ the process current and maximum rlimit/proc/curproc/statusβ the process' current status
look at all those paths. lowkey obsessed. π
π EXAMPLES π
to mount a procfs file system on /proc:
mount -t procfs proc /proc
that's it. that's the example. and it's iconic. π β¨
π SEE ALSO π
procstat(1), mount(2), sigaction(2), unmount(2), kvm(3), libprocstat(3), pseudofs(9)
bestie, go read the friends. iykyk. π«Ά
π AUTHORS π
this manual page written by Garrett Wollman, based on the description provided by Jan-Simon Pendry, and revamped later by Mike Pritchard. legends only. no cap. π
and that's the whole vibe check, bestie β this page came from the Debian crew, dated June 23, 2024, under the PROCFS(4) banner. mwah. πππ¦
π¦ where this page comes from
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms