8 procfs: Gone But Not Forgotten

In Linux®, you may have looked at /proc/sys/net/ipv4/ip_forward to determine if IP forwarding was enabled. Under FreeBSD you should use sysctl(8) to view this and other system settings, as procfs(5) has been deprecated in current versions of FreeBSD. (Although sysctl is available in Linux as well.)

In the IP forwarding example, you would use the following to determine if IP forwarding is enabled on your FreeBSD system:

% sysctl net.inet.ip.forwarding
net.inet.ip.forwarding: 0

The -a flag is used to list all the system settings:

% sysctl -a
kern.ostype: FreeBSD
kern.osrelease: 6.2-RELEASE-p9
kern.osrevision: 199506
kern.version: FreeBSD 6.2-RELEASE-p9 #0: Thu Nov 29 04:07:33 UTC 2007
    root@i386-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC

kern.maxvnodes: 17517
kern.maxproc: 1988
kern.maxfiles: 3976
kern.argmax: 262144
kern.securelevel: -1
kern.hostname: server1
kern.hostid: 0
kern.clockrate: { hz = 1000, tick = 1000, profhz = 666, stathz = 133 }
kern.posix1version: 200112
...

Note: Some of these sysctl values are read-only.

There are occasions where procfs is required, such as running older software, using truss(1) to trace system calls, and Linux Binary Compatibility. (Although, Linux Binary Compatibility uses its own procfs, linprocfs(5).) If you need to mount procfs you can add the following to /etc/fstab:

proc                /proc           procfs  rw,noauto       0       0

Note: noauto will prevent /proc from being automatically mounted at boot.

And then mount procfs with:

# mount /proc