Kernel/LibC: Implement pread()

This commit is contained in:
2023-11-28 23:47:30 +02:00
parent 4c3da66c92
commit 09b7cb2f33
5 changed files with 19 additions and 0 deletions

View File

@@ -823,6 +823,14 @@ namespace Kernel
return readlink_impl(absolute_path.sv(), buffer, bufsize);
}
BAN::ErrorOr<long> Process::sys_pread(int fd, void* buffer, size_t count, off_t offset)
{
LockGuard _(m_lock);
validate_pointer_access(buffer, count);
auto inode = TRY(m_open_file_descriptors.inode_of(fd));
return TRY(inode->read(offset, { (uint8_t*)buffer, count }));
}
BAN::ErrorOr<long> Process::sys_chmod(const char* path, mode_t mode)
{
if (mode & S_IFMASK)