| Commit | Line | Data |
| 5643fec9 |
1 | |
| 2 | |
| 5643fec9 |
3 | ## 6.11 Tuning with sysctl |
| 4 | |
| 5 | |
| 6 | |
| 7 | [sysctl(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=sysctl§ion=8) is an interface that allows you to make changes to a running DragonFly system. This includes many advanced options of the TCP/IP stack and virtual memory system that can dramatically improve performance for an experienced system administrator. Over five hundred system variables can be read and set using [sysctl(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=sysctl§ion=8). |
| 8 | |
| 9 | |
| 10 | |
| 11 | At its core, [sysctl(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=sysctl§ion=8) serves two functions: to read and to modify system settings. |
| 12 | |
| 13 | |
| 14 | |
| 15 | To view all readable variables: |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | % sysctl -a |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | To read a particular variable, for example, `kern.maxproc`: |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | % sysctl kern.maxproc |
| 34 | |
| 35 | kern.maxproc: 1044 |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | To set a particular variable, use the intuitive `***variable***`=`***value***` syntax: |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | # sysctl kern.maxfiles=5000 |
| 48 | |
| 49 | kern.maxfiles: 2088 -< 5000 |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | Settings of sysctl variables are usually either strings, numbers, or booleans (a boolean being `1` for yes or a `0` for no). |
| 56 | |
| 57 | |
| 58 | |
| 59 | If you want to set automatically some variables each time the machine boots, add them to the `/etc/sysctl.conf` file. For more information see the [sysctl.conf(5)](http://leaf.dragonflybsd.org/cgi/web-man?command=sysctl.conf§ion=5) manual page and the [configtuning-configfiles.html#CONFIGTUNING-SYSCTLCONF Section 6.10.4]. |
| 60 | |
| 61 | |
| 62 | |
| 63 | ### 6.11.1 sysctl(8) Read-only |
| 64 | |
| 65 | |
| 66 | |
| 67 | ***Contributed by Tom Rhodes. *** |
| 68 | |
| 69 | |
| 70 | |
| 71 | In some cases it may be desirable to modify read-only [sysctl(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=sysctl§ion=8) values. While this is not recommended, it is also sometimes unavoidable. |
| 72 | |
| 73 | |
| 74 | |
| 75 | For instance on some laptop models the [cardbus(4)](http://leaf.dragonflybsd.org/cgi/web-man?command=cardbus§ion=4) device will not probe memory ranges, and fail with errors which look similar to: |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | cbb0: Could not map register memory |
| 82 | |
| 83 | device_probe_and_attach: cbb0 attach returned 12 |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | Cases like the one above usually require the modification of some default [sysctl(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=sysctl§ion=8) settings which are set read only. To overcome these situations a user can put [sysctl(8)](http://leaf.dragonflybsd.org/cgi/web-man?command=sysctl§ion=8) ***OIDs*** in their local `/boot/loader.conf`. Default settings are located in the `/boot/defaults/loader.conf` file. |
| 90 | |
| 91 | |
| 92 | |
| 51e754f0 |
93 | Fixing the problem mentioned above would require a user to set `hw.pci.allow_unsupported_io_range=1` in the aforementioned file. Now [cardbus(4)](http://leaf.dragonflybsd.org/cgi/web-man?command=cardbus§ion=4) will work properly. |
| 5643fec9 |
94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | CategoryHandbook |
| 102 | |
| 103 | CategoryHandbook-configuration |
| 104 | |