Sysctl

Sysctl is an interface for examining and dynamically changing parameters in the BSD and Linux operating systems. The implementation mechanism in these two systems is very different.

In BSD these parameters are generally objects in a management information base (MIB) that describe tunable limits such as the size of a shared memory segment, the number of threads the operating system will use as an NFS client, or the maximum number of processes on the system; or describe, enable or disable behaviors such as IP forwarding, security restrictions on the superuser (the "securelevel"), or debugging output.

In BSD a system call or system call wrapper is usually provided for use by programs, as well as an administrative program and a configuration file (for setting the tunable parameters when the system boots).

This feature appeared in 4.4BSD. It has the advantage over hardcoded constants that changes to the parameters can be made dynamically without recompiling the kernel.

In Linux the sysctl interface mechanism is also exported as part of procfs under the sys directory. This difference means checking the value of some parameter requires opening a file in a virtual file system, reading its contents, parsing them and closing the file. The sysctl system call does exist on Linux, but does not have a wrapping function in glibc and is not recommended for use.

Read more about SysctlPerformance Considerations, Examples

Other articles related to "sysctl":

TCP Window Scale Option - Configuration of Operating Systems - FreeBSD, NetBSD and Mac OS X
... a user can check the value of the "net.inet.tcp.rfc1323" variable via the sysctl command sysctl net.inet.tcp.rfc1323 A value of 1 (output "net.inet.tcp.rfc1323=1 ... If enabled it can be turned off by issuing the command sudo sysctl -w net.inet.tcp.rfc1323=0 This setting is lost across a system restart, to make it permanent it must be written in the /etc/sys ...
Determining System Uptime - BSD - Using Sysctl
... There is also a method of using sysctl to call the system's last boot time $ sysctl kern.boottime kern.boottime { sec = 1271934886, usec = 667779 } Thu Apr 2010. ...
Sysctl - Examples
... In Linux's emulation of sysctl, the parameter is called net.ipv4.ip_forward ... In most systems, the command sysctl -w parameter=1 will enable a certain behavior ... whenever the system boots, the line parameter=1 can be added/rewritten to the file /etc/sysctl.conf ...
TCP Window Scale Option - Configuration of Operating Systems - Linux
... and /proc/sys/net/ipv4/tcp_wmem (more information man tcp, section sysctl) ... Scaling can be turned off by issuing the command sysctl -w "net.ipv4.tcp_window_scaling=0" as root ... the changes after a restart, include the line "net.ipv4.tcp_window_scaling=0" in /etc/sysctl.conf ...