Home  >  Article  >  Operation and Maintenance  >  What file system is proc under linux?

What file system is proc under linux?

青灯夜游
青灯夜游Original
2023-03-15 11:31:061896browse

In Linux, proc is a virtual file system and a control center that can change the running status of the kernel by changing some of the files; it is also a query center provided by the kernel to us, through which users can view the system. Hardware and currently running process information. The proc system only exists in memory and provides an interface for accessing system kernel data in the form of a file system. The kernel operating status can be changed by changing some of the files.

What file system is proc under linux?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

What is proc file system

proc is called a virtual file system, it is a control center that can change the kernel operation by changing some of the files Status, it is also a query center provided by the kernel to us. Users can use it to view system hardware and currently running process information.

The data source of many tools in Linux is the content in the proc directory. For example, the lsmod command is an alias of cat /proc/modules.

There is a special type of pseudo file system in Linux, which is used to complete various functions using operations unified with the file interface, such as ptyfs, devfs, sysfs and procfs. Procfs is one of the most widely used pseudo file systems.

As far as the term file system is concerned, the /proc directory is not a real file system, it is a virtual file system, sometimes also called a process information pseudo file system.

The data placed by proc is all in the memory, such as the system kernel, process, status of external devices and network status, etc. Because the data in this directory is in memory, it does not occupy any hard disk space.

procfs is an abstract file interface for Linux kernel information. A large number of kernel information and adjustable parameters are mapped to a directory tree as regular files, so that we can simply and directly use echo or cat. File operation commands are used to retrieve and adjust system information. At the same time, procfs also provides an interface so that our own kernel modules or user-mode programs can transfer parameters through procfs. In today's Linux systems, a large number of system tools also obtain kernel parameters through procfs, such as ps, lspci, etc. Without procfs, they may not work properly.

The proc file system is a pseudo file system. It only exists in the memory and does not occupy external memory space. It provides an interface for accessing system kernel data in the form of a file system. Users and applications can obtain system information through proc and change certain parameters of the kernel. Since system information, such as processes, changes dynamically, when a user or application reads a proc file, the proc file system dynamically reads the required information from the system kernel and submits it.

Detailed explanation of linux proc file system

The /proc directory on the Linux system is a file system, that is, the proc file system. Different from other common file systems, /proc is a pseudo file system (that is, a virtual file system). It only exists in memory and does not occupy external memory space. It uses a file system to access system kernel data. Operation provides an interface), which stores a series of special files that store the current kernel running status. Users can use these files to view information about the system hardware and currently running processes, and even change the running status of the kernel by changing some of these files.

PID

Directory, each process currently running in the system has a corresponding directory in /proc Below, the PID number of the process is used as the directory name.

  • attr

    directory, which provides security Relevant attributes are readable and writable. To support security modules such as SELinux, CONFIG_SECURITY needs to be configured.

  • ##current

    file, current security-related attributes.

  • exec

    file, security-related attributes set when executing the execve command.

  • fscreate

    file, security-related attributes set when executing commands open, mkdir, symlink, mknod.

  • keycreate

    file, security-related attributes set when executing the command add_key.

  • prev

    file, the security-related attributes when the command execve was last executed, that is, the previous "/ proc/[pid]/attr/current".

  • sockcreate

    file, security-related attributes set when creating the socket.

  • autogroup

    file can be used to modify the CPU bandwidth allocated to automatic groups. This is done by writing a number in the "nice" range to set the nice value for the automatic grouping. The value range is 19 (low priority) ~ -20 (high priority). (Writing values ​​outside this range will cause write(2) to fail with the error EINVAL.)

  • auxv

    file, ELF interpreter information, the format is an unsigned long type ID plus an unsigned long type value , and finally two 0s (man getauxval).

  • cgroup

    file, the control group to which the process belongs, the format is three fields separated by colons, respectively Structure ID, subsystem, control group, CONFIG_CGROUPS needs to be configured.

  • clear_refs

    File, write-only, only used by the owner of the process, clear for estimating memory usage There are four strategies 1, 2, 3, and 4 for the amount of PG_Referenced and ACCESSED/YOUNG. 1 means clearing all related pages, 2 means clearing related anonymous pages, 3 means clearing related mapping file pages, and 4 means clearing related pages. For soft-dirty pages, CONFIG_PROC_PAGE_MONITOR needs to be configured.

  • cmdline

    File, read-only, saves the complete command line string to start the process, if it is a zombie process, this file is empty.

  • comm

    File, command name of the process, different threads (man clone prctl pthread_setname_np) may be different The thread name is located in "task/[tid]/comm". If the name exceeds TASK_COMM_LEN, it will be truncated.

  • coredump_filter

    file, coredump filter, such as 00000037 (man core), different binary bits represent filtering Different information.

  • cpuset

    file, node that controls CPU and memory (man cpuset).

  • cwd -> /

    directory, a symbolic link to the current working directory.

  • environ

    File, environment variable.

  • exe

    file, symlinked to the full command to start the process. q

  • fd

    directory, containing the current fd, these fd symbolic links to the actual open files.

  • fdinfo

    Directory contains information about the current fd. Different types of fd have different information.

  • gid_map

    file, information about group IDs mapped from user namespaces (man user_namespaces).

  • io

    File, IO information.

  • limits

    File, resource soft and hard limits (man getrlimit).

  • loginuid

    file, the audit daemon enables auditing tools in the kernel. Any process running before auditing is turned on in the kernel will get loginuid 4294967295.
    4294967295 is just (unsigned long) -1. -1 means loginuid is not set. This is normal behavior for processes not spawned by any login process (such as a daemon). loginuid defaults to -1; whenever you log in (in tty/in DM/via ssh), the pam_loginuid module changes it to your user ID, and the value is retained by the child process.

  • map_files

    Directory, including some memory mapped files (man mmap), the file name format is BeginAddress-EndAddress , the symbolic link to the mapped file needs to be configured with CONFIG_CHECKPOINT_RESTORE.

  • maps

    File, memory mapping information.

  • mem

    file is used to access the memory pages of the process through open, read, and lseek.

  • mountinfo

    File, mount information, format is 44 41 253:1 // rw,relatime shared :35 master:1 - ext4 /dev/vda1 rw,data=ordered, with spaces as separators. The meanings of each field from left to right are the unique mount ID, the parent mount ID, and the device master-slave number of the file system. , the root node mounted in the file system, the mount point relative to the process root node, mount permissions and other mounting configurations, optional configurations, dashes indicate the end of the previous optional configurations, file system types, file system specific The mounting source may be none or additional configuration.

  • mounts

    File, file system list mounted in the current process, /dev/vda1/ext4 rw ,relatime,data=ordered 0 0 Format reference (man fstab).

  • mountstats

    File, mount information, format is device /dev/vda1 mounted on / with fstype ext4[statistics].

  • net

    Directory, saves network-related files and directories of the process.

  • ns

    directory saves the entry of each namespace, see (man namespaces) for details.

  • numa_maps

    file, numa is Non Uniform Memory Access, see (man numa) for details.

  • oom_adj

    file, adjust the OOM score. OOM is Out Of Memory. When OOM occurs, OOM Killer kills the process with a high score based on the OOM score. The default value is 0 and will inherit the settings of the parent process.

  • oom_score

    File, OOM score.

  • ##oom_score_adj

    file, the OOM score ranges from -1000 to 1000.

  • pagemap

    file, the virtual memory page mapping information of the current process, needs to be configured with CONFIG_PROC_PAGE_MONITOR.

  • personality

    file makes the process personality flag visible in /proc. Because the personality of a process may be sensitive (such as READ_IMPLIES_EXEC), this file can only be read by the process owner.

  • projid_map

    file, similar to user and group ID mapping, can create project ID mapping for user namespaces . (Item ids are used for disk quotas; see setquota(8) and quotactl(2).)

  • patch_state

    file that exposes the patch status value for each task so that users can determine which tasks are preventing the completion of the patch operation.

  • ##root -> The / directory is linked to the root directory of the current process.

  • ##sched file, scheduling statistics and status information of the process.

  • schedstat file, scheduling information of the process.

  • sessionidFile, process session ID, default 4294967295.

  • setgroups file, if the process containing the process pid in the user namespace is allowed to use setgroups(2) System call, the /proc/[pid]/setgroups file displays the string "allow"; if setgroups(2) is not allowed in the user namespace, "deny" is displayed. Note that regardless of the value in the /proc/[pid]/setgroups file (and regardless of the capabilities of the process), calling setgroups(2) is not allowed if /proc/[pid]/gid_map has not been set.

  • smaps Files, memory mapping information, similar to the pmap command, need to configure CONFIG_PROC_PAGE_MONITOR.

  • stack file, the function call stack of the kernel space, needs to be configured with CONFIG_STACKTRACE.

  • stat file, process status information, used for ps command.

  • statm file, process memory usage information, 7 numbers separated by spaces, from left to right Respectively represent the total size of the program, resident memory size, shared memory page size, text code, library, data stack, and dirty pages.

  • status file, readable process-related information.

  • syscall file, system call related information, needs to configure CONFIG_HAVE_ARCH_TRACEHOOK.

  • task Directory, one subdirectory for each thread, and the directory name is the thread ID.

  • timers file, POSIT timer list, including timer ID, signal and other information.

  • uid_map file, user ID mapping information.

  • wchan file, the symbolic representation of the corresponding location in the kernel when the process is sleeping, such as do_wait.

acpi/wakeup file, device wakeup operation.

buddyinfo file, used to diagnose memory fragmentation problems.

bus Directory, installed bus.

  • input/devices file, enter device information.

  • input/handlersFile, handle information.

  • ##pci/00/00.0-08.0

    file, pci socket information.

  • pci/devices

    file, pci device information.

cgroupscgroups information summary, field subsys_name hierarchy num_cgroups enabled.

cmdline file, parameters passed to the Linux kernel when the system starts, such as lilo, grub and other boot management module.

consoles

file, to view the currently used device line characters in the system console /dev/console, you can simply View the /proc/console file.

cpuinfo

file, CPU and system architecture information, use the lscpu command this file.

crypto

file, the encryption list provided by the kernel encryption API.

devices

files, device related information.

diskstats

File, disk status.

dma

file, dma is Direct Memory Access.

driver

  • ##nvram

    file that provides access to the non-volatile memory in the real-time clock on PCs and Ataris. On a PC, this is often called CMOS memory and stores BIOS configuration options.

  • rtc

    file, system runtime configuration.

execdomains

file, execution domain list.

fb

file, Frame Buffer information, CONFIG_FB needs to be configured.

filesystems

File, file system type supported by the kernel (man filesystems).

fs

Directory, mounted file system information.

interrupts

file, interrupt information for each IO of each CPU. The irq number, the number of times each CPU processes the irq, the name of the interrupt controller, the name of the irq, and the name used by the driver to register the irq are displayed in sequence.

iomem

File, IO memory mapping information.

ioports

file, IO port information.

irq

directory, the following will create a subtitle with the irq number as the name for each registered irq. Table of contents.

kallsyms

file, used for dynamic linking and symbol definitions bound to modules.

kcore

file, physical memory in ELF format in the system.

keys

file exposes the list of keys that the reading thread has permission to view and provides information about each Various information for each key. The thread is not required to own the key, which is visible in this file.

key-users

file that lists every user who has at least one key on the system Various information about the ID.

kmsg

file, kernel log information, this file is used by the dmsg command.

kpagecount

file, the number of times each physical page frame is mapped, needs to be configured CONFIG_PROC_PAGE_MONITOR.

kpageflags

file, the mask of each physical page frame, needs to be configured CONFIG_PROC_PAGE_MONITOR.

loadavg

file, current system load.

locks

File, the current file lock status.

mdstat

file, virtual device information (soft raid, etc.).

meminfo

file, system memory usage statistics, this file is used by the free command.

misc

# files, drivers registered on other major devices (device number 10).

modules

file, module information loaded by the system, the related command is lsmod.

mounts -> self/mounts

file, linked to /self/mounts.

mtrr

File, Memory Type Range Registers.

net -> self/net

directory, related to the network pseudo file system.

pagetypeinfo

file, other page allocator information.

partitions

File, partition information.

sched_debug

file, scheduler debug information.

schedstat

file, scheduler information.

scsi

Directory, SCSI interface device.

self -> 22699

directory, linked to the directory where the current process is located.

slabinfo

file, kernel cache information, CONFIG_SLAB needs to be configured.

softirqs

file, system soft interrupt information.

stat

File, system and kernel statistics.

swaps

File, swap partition usage.

sys

Directory, system variable related information.

sysrq-trigger

File, writable, triggers system call.

sysvipc

directory includes three files: msg, sem, and shm, which are System V IPC objects.

timer_list

file, list of timers that are still running.

timer_stats

File, timer status.

tty

Directory, tty device related.

uptime

File, system update time and process idle time.

version

file, kernel version information.

vmallocinfo

file, virtual memory allocation information.

vmstat

file, memory statistics, displayed in the form of key-value pairs.

zoneinfo

file, memory block information, used to analyze the behavior of virtual memory.

Related recommendations: "Linux Video Tutorial"

The above is the detailed content of What file system is proc under linux?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn