diff options
author | Liav A <liavalb@gmail.com> | 2021-09-11 12:20:47 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-12 11:52:16 +0200 |
commit | 8d0dbdeaac4fa1d38ce9b1c467fc3865fb3685e2 (patch) | |
tree | ae33d3b978c4141fef463c78ce75ad217f7f8520 /Userland/Libraries | |
parent | 06e95d0fd74a93858e5f4d0e1d32e92631e649ff (diff) | |
download | serenity-8d0dbdeaac4fa1d38ce9b1c467fc3865fb3685e2.zip |
Kernel+Userland: Introduce a new way to reboot and poweroff the machine
This change removes the halt and reboot syscalls, and create a new
mechanism to change the power state of the machine.
Instead of how power state was changed until now, put a SysFS node as
writable only for the superuser, that with a defined value, can result
in either reboot or poweroff.
In the future, a power group can be assigned to this node (which will be
the GroupID responsible for power management).
This opens an opportunity to permit to shutdown/reboot without superuser
permissions, so in the future, a userspace daemon can take control of
this node to perform power management operations without superuser
permissions, if we enforce different UserID/GroupID on that node.
Diffstat (limited to 'Userland/Libraries')
-rw-r--r-- | Userland/Libraries/LibC/unistd.cpp | 12 | ||||
-rw-r--r-- | Userland/Libraries/LibC/unistd.h | 2 |
2 files changed, 0 insertions, 14 deletions
diff --git a/Userland/Libraries/LibC/unistd.cpp b/Userland/Libraries/LibC/unistd.cpp index 7f7aa566c4..a902910424 100644 --- a/Userland/Libraries/LibC/unistd.cpp +++ b/Userland/Libraries/LibC/unistd.cpp @@ -715,18 +715,6 @@ int fsync(int fd) __RETURN_WITH_ERRNO(rc, rc, -1); } -int halt() -{ - int rc = syscall(SC_halt); - __RETURN_WITH_ERRNO(rc, rc, -1); -} - -int reboot() -{ - int rc = syscall(SC_reboot); - __RETURN_WITH_ERRNO(rc, rc, -1); -} - int mount(int source_fd, const char* target, const char* fs_type, int flags) { if (!target || !fs_type) { diff --git a/Userland/Libraries/LibC/unistd.h b/Userland/Libraries/LibC/unistd.h index 2cdfb4df5c..d738aaa32d 100644 --- a/Userland/Libraries/LibC/unistd.h +++ b/Userland/Libraries/LibC/unistd.h @@ -108,8 +108,6 @@ int chown(const char* pathname, uid_t, gid_t); int fchown(int fd, uid_t, gid_t); int ftruncate(int fd, off_t length); int truncate(const char* path, off_t length); -int halt(); -int reboot(); int mount(int source_fd, const char* target, const char* fs_type, int flags); int umount(const char* mountpoint); int pledge(const char* promises, const char* execpromises); |