Kernel: Add SYS_OPENAT

This commit is contained in:
2023-06-11 03:27:56 +03:00
parent 91f812e17f
commit 5aed186827
5 changed files with 48 additions and 14 deletions

View File

@@ -469,6 +469,22 @@ namespace Kernel
return fd;
}
BAN::ErrorOr<int> Process::openat(int fd, BAN::StringView path, int flags)
{
BAN::String absolute_path;
{
LockGuard _(m_lock);
TRY(validate_fd(fd));
TRY(absolute_path.append(open_file_description(fd).path));
}
TRY(absolute_path.push_back('/'));
TRY(absolute_path.append(path));
return open(absolute_path, flags);
}
BAN::ErrorOr<void> Process::close(int fd)
{
LockGuard _(m_lock);