sysctl: Use /sys/kernel/variables/ directory instead of /proc/sys

This commit is contained in:
Liav A 2022-10-14 17:36:52 +03:00 committed by Andrew Kaster
parent 4556fdc891
commit a0ed543993
Notes: sideshowbarker 2024-07-17 05:06:49 +09:00
2 changed files with 4 additions and 4 deletions

View file

@ -12,7 +12,7 @@ sysctl - configure kernel parameters at runtime
sysctl is a utility for managing kernel configuration parameters at runtime.
This requires root privileges, and can crash your system.
Available parameters are listed under /proc/sys/.
Available parameters are listed under /sys/kernel/variables/.
## Options

View file

@ -14,7 +14,7 @@ static bool s_set_variable = false;
static String get_variable(StringView name)
{
auto path = String::formatted("/proc/sys/{}", name);
auto path = String::formatted("/sys/kernel/variables/{}", name);
auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::ReadOnly)) {
warnln("Failed to open {}: {}", path, file->error_string());
@ -42,7 +42,7 @@ static bool write_variable(StringView name, StringView value)
auto old_value = get_variable(name);
if (old_value.is_null())
return false;
auto path = String::formatted("/proc/sys/{}", name);
auto path = String::formatted("/sys/kernel/variables/{}", name);
auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::WriteOnly)) {
warnln("Failed to open {}: {}", path, file->error_string());
@ -80,7 +80,7 @@ static int handle_variables(Vector<StringView> const& variables)
static int handle_show_all()
{
Core::DirIterator di("/proc/sys", Core::DirIterator::SkipDots);
Core::DirIterator di("/sys/kernel/variables", Core::DirIterator::SkipDots);
if (di.has_error()) {
outln("DirIterator: {}", di.error_string());
return 1;