HOME

TheInfoList



OR:

sysfs is a pseudo file system provided by the
Linux kernel The Linux kernel is a Free and open-source software, free and open source Unix-like kernel (operating system), kernel that is used in many computer systems worldwide. The kernel was created by Linus Torvalds in 1991 and was soon adopted as the k ...
that exports information about various kernel subsystems, hardware devices, and associated
device driver In the context of an operating system, a device driver is a computer program that operates or controls a particular type of device that is attached to a computer or automaton. A driver provides a software interface to hardware devices, enabli ...
s from the kernel's device model to
user space A modern computer operating system usually uses virtual memory to provide separate address spaces or regions of a single address space, called user space and kernel space. This separation primarily provides memory protection and hardware prote ...
through virtual files. In addition to providing information about various devices and kernel subsystems, exported virtual files are also used for their configuration. sysfs provides functionality similar to the
sysctl sysctl is a software mechanism in some Unix-like operating systems that reads and modifies the attributes of the system kernel such as its version number, maximum limits, and security settings. It is available both as a system call for compile ...
mechanism found in
BSD The Berkeley Software Distribution (BSD), also known as Berkeley Unix or BSD Unix, is a discontinued Unix operating system developed and distributed by the Computer Systems Research Group (CSRG) at the University of California, Berkeley, beginni ...
operating system An operating system (OS) is system software that manages computer hardware and software resources, and provides common daemon (computing), services for computer programs. Time-sharing operating systems scheduler (computing), schedule tasks for ...
s, with the difference that sysfs is implemented as a virtual file system instead of being a purpose-built kernel mechanism, and that, in Linux, ''sysctl'' configuration parameters are made available at ''/proc/sys/'' as part of
procfs The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized metho ...
, not sysfs which is mounted at ''/sys/''.


History

During the 2.5 development cycle, the Linux driver model was introduced to fix the following shortcomings of version 2.4: * No unified method of representing driver-device relationships existed. * There was no generic
hotplug Hot swapping is the replacement or addition of components to a computer system without stopping, shutting down, or rebooting the system. Hot plugging describes only the addition of components to a running computer system. Components which ha ...
mechanism. *
procfs The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized metho ...
was cluttered with non-process information. Sysfs was designed to export the information present in the
device tree In computing, a devicetree (also written device tree) is a data structure describing the hardware components of a particular computer so that the operating system's kernel can use and manage those components, including the CPU or CPUs, the memor ...
which would then no longer clutter up procfs. It was written by Patrick Mochel. Maneesh Soni later wrote the sysfs backing store patch to reduce memory usage on large systems. During the next year of 2.5 development the infrastructural capabilities of the driver model and driverfs began to prove useful to other subsystems. kobjects were developed to provide a central object management mechanism and driverfs was renamed to sysfs to represent its subsystem agnosticism. Sysfs is mounted under the mount point. If it is not mounted automatically during initialization, it can be mounted manually using the mount command: mount -t sysfs sysfs /sys.


Supported buses

; ACPI : Exports information about
ACPI Advanced Configuration and Power Interface (ACPI) is an open standard that operating systems can use to discover and configure computer hardware components, to perform power management (e.g. putting unused hardware components to sleep), auto con ...
devices. ; PCI : Exports information about
PCI PCI may refer to: Business and economics * Payment card industry, businesses associated with debit, credit, and other payment cards ** Payment Card Industry Data Security Standard, a set of security requirements for credit card processors * Prov ...
and
PCI Express PCI Express (Peripheral Component Interconnect Express), officially abbreviated as PCIe, is a high-speed standard used to connect hardware components inside computers. It is designed to replace older expansion bus standards such as Peripher ...
devices. ; PCI Express : Exports information about
PCI Express PCI Express (Peripheral Component Interconnect Express), officially abbreviated as PCIe, is a high-speed standard used to connect hardware components inside computers. It is designed to replace older expansion bus standards such as Peripher ...
devices. ; USB : Exports information about
USB Universal Serial Bus (USB) is an industry standard, developed by USB Implementers Forum (USB-IF), for digital data transmission and power delivery between many types of electronics. It specifies the architecture, in particular the physical ...
devices. ; SCSI : Exports information about
mass storage In computing, mass storage refers to the storage of large amounts of data in a persisting and machine-readable fashion. In general, the term ''mass'' in ''mass storage'' is used to mean ''large'' in relation to contemporaneous hard disk drive ...
devices, including
USB Universal Serial Bus (USB) is an industry standard, developed by USB Implementers Forum (USB-IF), for digital data transmission and power delivery between many types of electronics. It specifies the architecture, in particular the physical ...
,
SATA SATA (Serial AT Attachment) is a computer bus interface that connects host bus adapters to mass storage devices such as hard disk drives, optical drives, and solid-state drives. Serial ATA succeeded the earlier Parallel ATA (PATA) standard ...
and
NVMe NVM Express (NVMe) or Non-Volatile Memory Host Controller Interface Specification (NVMHCIS) is an open, logical-device interface specification for accessing a computer's non-volatile storage media usually attached via the PCI Express bus. The in ...
interfaces. ; S/390 buses : As the S/390 architecture contains devices not found elsewhere, special buses have been created: :* ''css'': Contains subchannels (currently the only driver provided is for I/O subchannels). :* ''ccw'': Contains channel attached devices (driven by CCWs). :* ''ccwgroup'': Artificial devices, created by the user and consisting of ccw devices. Replaces some of the 2.4 chandev functionality. :* ''iucv'': Artificial devices like netiucv devices which use VM's IUCV interface.


Sysfs and userspace

Sysfs is used by several utilities to access information about hardware and its driver ( kernel modules) such as
udev udev (userspace ) is a device manager for the Linux kernel. As the successor of devfsd and hotplug, udev primarily manages device nodes in the directory. At the same time, udev also handles all user space events raised when hardware devices ...
or HAL. Scripts have been written to access information previously obtained via
procfs The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized metho ...
, and some scripts configure device drivers and devices via their attributes.


See also

*
procfs The proc filesystem (procfs) is a special filesystem in Unix-like operating systems that presents information about processes and other system information in a hierarchical file-like structure, providing a more convenient and standardized metho ...
* configfs * tmpfs *
sysctl sysctl is a software mechanism in some Unix-like operating systems that reads and modifies the attributes of the system kernel such as its version number, maximum limits, and security settings. It is available both as a system call for compile ...
, alternative way of exporting configuration used in BSD systems


References


External links


Driver model overview from the LWN porting to 2.6 serieskobjects and sysfs from the LWN porting to 2.6 seriesRamfsThe sysfs Filesystem, OLS'05Documentation/filesystems/sysfs.txt
Linux kernel documentation for sysfs {{File systems Free special-purpose file systems Interfaces of the Linux kernel Linux kernel features Pseudo file systems supported by the Linux kernel