98
Registered line disciplines are stored in the ldiscs file, with detailed information available in the
ldisc directory.
4.4 Using sysctl
Setting kernel parameters in the /proc/sys directory need not be a manual process or one that
required echoing values into a virtual file, hoping they are correct. The sysctl command can make
viewing, setting, and automating special kernel settings very easy.
To get a quick overview of all settings configurable in the /proc/sys directory, type the sysctl
-a command as root. This will create a large, comprehensive list, a small portion of which looks
something like this:
net.ipv4.route.min_delay = 2
kernel.sysrq = 0
kernel.sem = 250
This is the same basic information you would see if you viewed each of the files individually. The only
difference is the file location. The /proc/sys/net/ipv4/route/min_delay is signified by
net.ipv4.route.min_delay, with the directory slashes replaced by dots and the proc.sys
portion assumed.
As we have seen in Section 4.3.9, /proc/sys , you can manually assign values to writable files
by echoing the value to the file. The sysctl command is able to do the same thing by typing the
sysctl -w <file> =" <new-value> " command. For example, to activate the System Request
Key, the following command is required:
[root@bleach /]# sysctl -w kernel.sysrq="1"
kernel.sysrq = 1
[root@bleach /]#
While quickly setting single values like this in /proc/sys is helpful during testing, it does not work
as well on a production system, as all /proc/sys special settings are lost when the machine is
rebooted. To preserve the settings that you like to make permanently to your kernel, add them to the
/etc/sysctl.conf file.
Every time the system boots, the /etc/rc.d/rc.sysinit script is executed by init. This script
contains a command to execute sysctl using /etc/sysctl.conf as the values to set. Therefore,
any values added to /etc/sysctl.conf will take effect right after the system boots with no need
to reconfigure and rebuild the kernel to incorporate the change.
4.5 Additional Resources
As the file contents throughout the /proc directory provide a look at the state of your system's ker-
nel, which may also be specially configured for a certain purpose, this chapter should not be seen as
32000
32
Chapter 4:The /proc Filesystem
128
Need help?
Do you have a question about the LINUX 7.2 and is the answer not in the manual?
Questions and answers