Kernel/LibC/Userspace: Implement chown and set tty owner on login

This commit is contained in:
2024-01-02 22:19:38 +02:00
parent 07d5d3f936
commit 96d831c31a
12 changed files with 62 additions and 2 deletions

View File

@@ -886,6 +886,18 @@ namespace Kernel
return 0;
}
BAN::ErrorOr<long> Process::sys_chown(const char* path, uid_t uid, gid_t gid)
{
LockGuard _(m_lock);
validate_string_access(path);
auto absolute_path = TRY(absolute_path_of(path));
auto file = TRY(VirtualFileSystem::get().file_from_absolute_path(m_credentials, absolute_path, O_WRONLY));
TRY(file.inode->chown(uid, gid));
return 0;
}
BAN::ErrorOr<long> Process::sys_pipe(int fildes[2])
{
LockGuard _(m_lock);