mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-09 18:15:19 +00:00
Kernel: More work towards POSIX SHM, also add ftruncate().
This commit is contained in:
@@ -2468,3 +2468,14 @@ int Process::sys$shm_unlink(const char* name)
|
||||
return -EFAULT;
|
||||
return -ENOTIMPL;
|
||||
}
|
||||
|
||||
int Process::sys$ftruncate(int fd, off_t length)
|
||||
{
|
||||
auto* descriptor = file_descriptor(fd);
|
||||
if (!descriptor)
|
||||
return -EBADF;
|
||||
// FIXME: Check that fd is writable, otherwise EINVAL.
|
||||
if (!descriptor->is_file() && !descriptor->is_shared_memory())
|
||||
return -EINVAL;
|
||||
return descriptor->truncate(length);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user