1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:48:11 +00:00

Kernel: Add InodeFile, a File subclass for regular files.

Finally everything that can be held by a FileDescriptor actually inherits
from the File class.
This commit is contained in:
Andreas Kling 2019-05-30 13:39:17 +02:00
parent 66c1a9be3b
commit 08926e59b3
9 changed files with 151 additions and 133 deletions

View file

@ -1608,9 +1608,7 @@ int Process::sys$ioctl(int fd, unsigned request, unsigned arg)
auto* descriptor = file_descriptor(fd);
if (!descriptor)
return -EBADF;
if (!descriptor->is_file())
return -ENOTTY;
return descriptor->file()->ioctl(*descriptor, request, arg);
return descriptor->file().ioctl(*descriptor, request, arg);
}
int Process::sys$getdtablesize()
@ -2717,8 +2715,6 @@ int Process::sys$ftruncate(int fd, off_t length)
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);
}