mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:07:35 +00:00
Kernel/SysFS: Provide a way to "truncate" and "set" mtime on inodes
Normally, trying to truncate a SysFSInode should result in EPERM error. However, as suggested by Ali (@alimpfard), we can allow the PowerState node to be "truncated" so one can open that file with O_TRUNC option. Likewise, we also need to provide a way to set modified time on SysFS inodes. For most inodes, we should return ENOTIMPL error, but for the power state switch, we ignore the modified time setting and just return KSuccess. These fixes allow to do "echo -n 1 > /sys/firmware/power_state" in Shell after gaining root permissions, to switch the power state.
This commit is contained in:
parent
7269ce15fc
commit
f8489da8ee
5 changed files with 21 additions and 2 deletions
|
@ -146,6 +146,7 @@ protected:
|
|||
virtual KResult chmod(mode_t) override;
|
||||
virtual KResult chown(UserID, GroupID) override;
|
||||
virtual KResult truncate(u64) override;
|
||||
virtual KResult set_mtime(time_t);
|
||||
|
||||
virtual KResult attach(OpenFileDescription& description) override final;
|
||||
virtual void did_seek(OpenFileDescription&, off_t) override final;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue