Rename FileDescriptor::has_data_available_for_reading() -> can_read().

This commit is contained in:
Andreas Kling 2019-01-16 00:47:00 +01:00
parent a8baee4dcd
commit 8ad2dfb6e1
4 changed files with 6 additions and 6 deletions

View file

@ -1076,7 +1076,7 @@ ssize_t Process::sys$read(int fd, void* outbuf, size_t nread)
if (!descriptor)
return -EBADF;
if (descriptor->is_blocking()) {
if (!descriptor->has_data_available_for_reading(*this)) {
if (!descriptor->can_read(*this)) {
m_blocked_fd = fd;
block(BlockedRead);
sched_yield();
@ -1964,7 +1964,7 @@ int Process::sys$select(const Syscall::SC_select_params* params)
memset(readfds, 0, sizeof(fd_set));
auto bitmap = Bitmap::wrap((byte*)readfds, FD_SETSIZE);
for (int fd : m_select_read_fds) {
if (m_fds[fd].descriptor->has_data_available_for_reading(*this)) {
if (m_fds[fd].descriptor->can_read(*this)) {
bitmap.set(fd, true);
++markedfds;
}

View file

@ -52,7 +52,7 @@ bool Scheduler::pick_next()
if (process.state() == Process::BlockedRead) {
ASSERT(process.m_blocked_fd != -1);
// FIXME: Block until the amount of data wanted is available.
if (process.m_fds[process.m_blocked_fd].descriptor->has_data_available_for_reading(process))
if (process.m_fds[process.m_blocked_fd].descriptor->can_read(process))
process.unblock();
return true;
}
@ -66,7 +66,7 @@ bool Scheduler::pick_next()
if (process.state() == Process::BlockedSelect) {
for (int fd : process.m_select_read_fds) {
if (process.m_fds[fd].descriptor->has_data_available_for_reading(process)) {
if (process.m_fds[fd].descriptor->can_read(process)) {
process.unblock();
return true;
}

View file

@ -176,7 +176,7 @@ bool FileDescriptor::can_write(Process& process)
return true;
}
bool FileDescriptor::has_data_available_for_reading(Process& process)
bool FileDescriptor::can_read(Process& process)
{
if (is_fifo()) {
ASSERT(fifo_direction() == FIFO::Reader);

View file

@ -29,7 +29,7 @@ public:
ssize_t write(Process&, const byte* data, size_t);
int stat(Unix::stat*);
bool has_data_available_for_reading(Process&);
bool can_read(Process&);
bool can_write(Process&);
ssize_t get_dir_entries(byte* buffer, size_t);