mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 12:55:09 +00:00
Kernel: Rename FileDescriptor to FileDescription.
After reading a bunch of POSIX specs, I've learned that a file descriptor is the number that refers to a file description, not the description itself. So this patch renames FileDescriptor to FileDescription, and Process now has FileDescription* file_description(int fd).
This commit is contained in:
parent
69a6ce90df
commit
08cd75ac4b
70 changed files with 373 additions and 373 deletions
|
@ -1,5 +1,5 @@
|
|||
#include <Kernel/FileSystem/FIFO.h>
|
||||
#include <Kernel/FileSystem/FileDescriptor.h>
|
||||
#include <Kernel/FileSystem/FileDescription.h>
|
||||
#include <Kernel/Lock.h>
|
||||
#include <Kernel/Process.h>
|
||||
#include <Kernel/Thread.h>
|
||||
|
@ -30,9 +30,9 @@ Retained<FIFO> FIFO::create(uid_t uid)
|
|||
return adopt(*new FIFO(uid));
|
||||
}
|
||||
|
||||
Retained<FileDescriptor> FIFO::open_direction(FIFO::Direction direction)
|
||||
Retained<FileDescription> FIFO::open_direction(FIFO::Direction direction)
|
||||
{
|
||||
auto descriptor = FileDescriptor::create(this);
|
||||
auto descriptor = FileDescription::create(this);
|
||||
attach(direction);
|
||||
descriptor->set_fifo_direction({ }, direction);
|
||||
return descriptor;
|
||||
|
@ -83,17 +83,17 @@ void FIFO::detach(Direction direction)
|
|||
}
|
||||
}
|
||||
|
||||
bool FIFO::can_read(FileDescriptor&) const
|
||||
bool FIFO::can_read(FileDescription&) const
|
||||
{
|
||||
return !m_buffer.is_empty() || !m_writers;
|
||||
}
|
||||
|
||||
bool FIFO::can_write(FileDescriptor&) const
|
||||
bool FIFO::can_write(FileDescription&) const
|
||||
{
|
||||
return m_buffer.bytes_in_write_buffer() < 4096 || !m_readers;
|
||||
}
|
||||
|
||||
ssize_t FIFO::read(FileDescriptor&, byte* buffer, ssize_t size)
|
||||
ssize_t FIFO::read(FileDescription&, byte* buffer, ssize_t size)
|
||||
{
|
||||
if (!m_writers && m_buffer.is_empty())
|
||||
return 0;
|
||||
|
@ -107,7 +107,7 @@ ssize_t FIFO::read(FileDescriptor&, byte* buffer, ssize_t size)
|
|||
return nread;
|
||||
}
|
||||
|
||||
ssize_t FIFO::write(FileDescriptor&, const byte* buffer, ssize_t size)
|
||||
ssize_t FIFO::write(FileDescription&, const byte* buffer, ssize_t size)
|
||||
{
|
||||
if (!m_readers) {
|
||||
current->process().send_signal(SIGPIPE, ¤t->process());
|
||||
|
@ -119,7 +119,7 @@ ssize_t FIFO::write(FileDescriptor&, const byte* buffer, ssize_t size)
|
|||
return m_buffer.write(buffer, size);
|
||||
}
|
||||
|
||||
String FIFO::absolute_path(const FileDescriptor&) const
|
||||
String FIFO::absolute_path(const FileDescription&) const
|
||||
{
|
||||
return String::format("fifo:%u", this);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue