1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 15:48:12 +00:00

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
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. sysctl is a utility for managing kernel configuration parameters at runtime.
This requires root privileges, and can crash your system. 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 ## Options

View file

@ -14,7 +14,7 @@ static bool s_set_variable = false;
static String get_variable(StringView name) 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); auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::ReadOnly)) { if (!file->open(Core::OpenMode::ReadOnly)) {
warnln("Failed to open {}: {}", path, file->error_string()); 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); auto old_value = get_variable(name);
if (old_value.is_null()) if (old_value.is_null())
return false; return false;
auto path = String::formatted("/proc/sys/{}", name); auto path = String::formatted("/sys/kernel/variables/{}", name);
auto file = Core::File::construct(path); auto file = Core::File::construct(path);
if (!file->open(Core::OpenMode::WriteOnly)) { if (!file->open(Core::OpenMode::WriteOnly)) {
warnln("Failed to open {}: {}", path, file->error_string()); 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() 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()) { if (di.has_error()) {
outln("DirIterator: {}", di.error_string()); outln("DirIterator: {}", di.error_string());
return 1; return 1;