mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:48:10 +00:00
Add close-on-exec flag for file descriptors.
I was surprised to find that dup()'ed fds don't share the close-on-exec flag. That means it has to be stored separately from the FileDescriptor object.
This commit is contained in:
parent
19b9401487
commit
97c799576a
10 changed files with 74 additions and 35 deletions
|
@ -52,14 +52,14 @@ bool Scheduler::pick_next()
|
|||
if (process.state() == Process::BlockedRead) {
|
||||
ASSERT(process.m_fdBlockedOnRead != -1);
|
||||
// FIXME: Block until the amount of data wanted is available.
|
||||
if (process.m_file_descriptors[process.m_fdBlockedOnRead]->hasDataAvailableForRead())
|
||||
if (process.m_fds[process.m_fdBlockedOnRead].descriptor->hasDataAvailableForRead())
|
||||
process.unblock();
|
||||
return true;
|
||||
}
|
||||
|
||||
if (process.state() == Process::BlockedWrite) {
|
||||
ASSERT(process.m_blocked_fd != -1);
|
||||
if (process.m_file_descriptors[process.m_blocked_fd]->can_write())
|
||||
if (process.m_fds[process.m_blocked_fd].descriptor->can_write())
|
||||
process.unblock();
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue