<s>
sysctl	B-Application
is	O
a	O
software	O
utility	O
of	O
some	O
Unix-like	B-Operating_System
operating	I-Operating_System
systems	I-Operating_System
that	O
reads	O
and	O
modifies	O
the	O
attributes	O
of	O
the	O
system	O
kernel	B-Operating_System
such	O
as	O
its	O
version	O
number	O
,	O
maximum	O
limits	O
,	O
and	O
security	O
settings	O
.	O
</s>
<s>
It	O
is	O
available	O
both	O
as	O
a	O
system	B-Operating_System
call	I-Operating_System
for	O
compiled	B-Language
programs	O
,	O
and	O
an	O
administrator	O
command	O
for	O
interactive	O
use	O
and	O
scripting	O
.	O
</s>
<s>
Linux	B-Application
additionally	O
exposes	O
sysctl	B-Application
as	O
a	O
virtual	B-Application
file	I-Application
system	I-Application
.	O
</s>
<s>
In	O
BSD	O
,	O
these	O
parameters	O
are	O
generally	O
objects	O
in	O
a	O
management	O
information	O
base	O
(	O
MIB	O
)	O
that	O
describe	O
tunable	O
limits	O
such	O
as	O
the	O
size	O
of	O
a	O
shared	O
memory	O
segment	O
,	O
the	O
number	O
of	O
threads	O
the	O
operating	O
system	O
will	O
use	O
as	O
an	O
NFS	B-Protocol
client	O
,	O
or	O
the	O
maximum	O
number	O
of	O
processes	O
on	O
the	O
system	O
;	O
or	O
describe	O
,	O
enable	O
or	O
disable	O
behaviors	O
such	O
as	O
IP	B-Protocol
forwarding	O
,	O
security	O
restrictions	O
on	O
the	O
superuser	B-Application
(	O
the	O
"	O
securelevel	O
"	O
)	O
,	O
or	O
debugging	O
output	O
.	O
</s>
<s>
In	O
OpenBSD	B-Operating_System
and	O
DragonFly	B-Application
BSD	I-Application
,	O
sysctl	B-Application
is	O
also	O
used	O
as	O
the	O
transport	O
layer	O
for	O
the	O
hw.sensors	B-Application
framework	O
for	O
hardware	B-Application
monitoring	I-Application
,	O
whereas	O
NetBSD	B-Device
uses	O
the	O
ioctl	B-Operating_System
system	B-Operating_System
call	I-Operating_System
for	O
its	O
sysmon	B-Device
envsys	I-Device
counterpart	O
.	O
</s>
<s>
Both	O
sysctl	B-Application
and	O
ioctl	B-Operating_System
are	O
the	O
two	O
system	B-Operating_System
calls	I-Operating_System
which	O
can	O
be	O
used	O
to	O
add	O
extra	O
functionality	O
to	O
the	O
kernel	B-Operating_System
without	O
adding	O
yet	O
another	O
system	B-Operating_System
call	I-Operating_System
;	O
for	O
example	O
,	O
in	O
2004	O
with	O
OpenBSD	B-Operating_System
3.6	O
,	O
when	O
the	O
tcpdrop	O
utility	O
was	O
introduced	O
,	O
sysctl	B-Application
was	O
used	O
as	O
the	O
underlying	O
system	B-Operating_System
call	I-Operating_System
.	O
</s>
<s>
In	O
FreeBSD	B-Operating_System
,	O
although	O
there	O
is	O
no	O
sensors	O
framework	O
,	O
the	O
individual	O
temperature	O
and	O
other	O
sensors	O
are	O
still	O
commonly	O
exported	O
through	O
the	O
sysctl	B-Application
tree	O
through	O
Newbus	O
,	O
for	O
example	O
,	O
as	O
is	O
the	O
case	O
with	O
the	O
aibs(4 )	O
driver	O
that	O
's	O
available	O
in	O
all	O
the	O
4	O
BSD	O
systems	O
,	O
including	O
FreeBSD	B-Operating_System
.	O
</s>
<s>
In	O
BSD	O
,	O
a	O
system	B-Operating_System
call	I-Operating_System
or	O
system	B-Operating_System
call	I-Operating_System
wrapper	O
is	O
usually	O
provided	O
for	O
use	O
by	O
programs	O
,	O
as	O
well	O
as	O
an	O
administrative	O
program	O
and	O
a	O
configuration	O
file	O
(	O
for	O
setting	O
the	O
tunable	O
parameters	O
when	O
the	O
system	B-Operating_System
boots	I-Operating_System
)	O
.	O
</s>
<s>
It	O
has	O
the	O
advantage	O
over	O
hardcoded	O
constants	O
that	O
changes	O
to	O
the	O
parameters	O
can	O
be	O
made	O
dynamically	O
without	O
recompiling	B-Language
the	O
kernel	B-Operating_System
.	O
</s>
<s>
Historically	O
,	O
although	O
kernel	B-Operating_System
variables	O
themselves	O
could	O
be	O
modified	O
through	O
sysctl	B-Application
,	O
the	O
elements	O
comprising	O
the	O
MIB	O
of	O
the	O
sysctl	B-Application
tree	O
were	O
hardcoded	O
at	O
compile	B-Language
time	O
,	O
and	O
as	O
of	O
2019	O
,	O
it	O
's	O
mostly	O
still	O
the	O
case	O
in	O
OpenBSD	B-Operating_System
(	O
with	O
some	O
exceptions	O
like	O
hw.sensors	B-Application
,	O
which	O
manages	O
and	O
provides	O
its	O
own	O
dynamic	O
subtree	O
)	O
.	O
</s>
<s>
FreeBSD	B-Operating_System
has	O
had	O
"	O
sysctl	B-Application
internal	O
magic	O
"	O
for	O
dynamic	O
sysctl	B-Application
tree	O
management	O
since	O
1995	O
;	O
NetBSD	B-Device
has	O
had	O
its	O
own	O
implementation	O
of	O
a	O
dynamic	O
sysctl	B-Application
tree	O
since	O
December	O
2003	O
.	O
</s>
<s>
In	O
Linux	B-Application
,	O
the	O
sysctl	B-Application
interface	O
mechanism	O
is	O
also	O
exported	O
as	O
part	O
of	O
procfs	B-Application
under	O
the	O
directory	O
(	O
not	O
to	O
be	O
confused	O
with	O
the	O
directory	O
)	O
.	O
</s>
<s>
This	O
difference	O
means	O
checking	O
the	O
value	O
of	O
some	O
parameter	O
requires	O
opening	O
a	O
file	O
in	O
a	O
virtual	B-Application
file	I-Application
system	I-Application
,	O
reading	O
its	O
contents	O
,	O
parsing	O
them	O
and	O
closing	O
the	O
file	O
.	O
</s>
<s>
The	O
sysctl	B-Application
system	B-Operating_System
call	I-Operating_System
does	O
exist	O
on	O
Linux	B-Application
,	O
but	O
it	O
has	O
been	O
deprecated	O
and	O
does	O
not	O
have	O
a	O
wrapper	O
function	O
in	O
glibc	B-Language
;	O
it	O
is	O
usually	O
unavailable	O
due	O
to	O
many	O
distributions	O
configuring	O
the	O
kernel	B-Operating_System
without	O
CONFIG_SYSCTL_SYSCALL	O
;	O
so	O
it	O
is	O
not	O
recommended	O
for	O
use	O
.	O
</s>
<s>
When	O
IP	B-Protocol
forwarding	O
is	O
enabled	O
,	O
the	O
operating	B-Operating_System
system	I-Operating_System
kernel	I-Operating_System
will	O
act	O
as	O
a	O
router	B-Protocol
.	O
</s>
<s>
In	O
FreeBSD	B-Operating_System
,	O
NetBSD	B-Device
,	O
OpenBSD	B-Operating_System
,	O
DragonFly	B-Application
BSD	I-Application
,	O
and	O
Darwin/Mac	O
OS	O
X	O
,	O
the	O
parameter	O
can	O
be	O
set	O
to	O
to	O
enable	O
this	O
behavior	O
.	O
</s>
<s>
In	O
Linux	B-Application
,	O
the	O
parameter	O
is	O
called	O
.	O
</s>
<s>
If	O
the	O
behavior	O
should	O
be	O
enabled	O
whenever	O
the	O
system	B-Operating_System
boots	I-Operating_System
,	O
the	O
line	O
can	O
be	O
added/rewritten	O
to	O
the	O
file	O
.	O
</s>
<s>
Additionally	O
,	O
some	O
sysctl	B-Application
variables	O
cannot	O
be	O
modified	O
after	O
the	O
system	O
is	O
booted	O
.	O
</s>
<s>
These	O
variables	O
(	O
depending	O
on	O
the	O
variable	O
,	O
the	O
version	O
and	O
flavor	O
of	O
BSD	O
)	O
need	O
to	O
either	O
be	O
set	O
statically	O
in	O
the	O
kernel	B-Operating_System
at	O
compile	B-Language
time	O
or	O
set	O
in	O
.	O
</s>
