mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:27:34 +00:00
Kernel: Fix checking BlockResult
We now have BlockResult::WokeNormally and BlockResult::NotBlocked, both of which indicate no error. We can no longer just check for BlockResult::WokeNormally and assume anything else must be an interruption.
This commit is contained in:
parent
1493dd9dc6
commit
419703a1f2
7 changed files with 56 additions and 27 deletions
|
@ -250,7 +250,7 @@ ssize_t IPv4Socket::receive_byte_buffered(FileDescription& description, void* bu
|
|||
locker.lock();
|
||||
|
||||
if (!m_can_read) {
|
||||
if (res != Thread::BlockResult::WokeNormally)
|
||||
if (res.was_interrupted())
|
||||
return -EINTR;
|
||||
|
||||
// Unblocked due to timeout.
|
||||
|
@ -300,7 +300,7 @@ ssize_t IPv4Socket::receive_packet_buffered(FileDescription& description, void*
|
|||
locker.lock();
|
||||
|
||||
if (!m_can_read) {
|
||||
if (res != Thread::BlockResult::WokeNormally)
|
||||
if (res.was_interrupted())
|
||||
return -EINTR;
|
||||
|
||||
// Unblocked due to timeout.
|
||||
|
|
|
@ -176,7 +176,7 @@ KResult LocalSocket::connect(FileDescription& description, const sockaddr* addre
|
|||
return KSuccess;
|
||||
}
|
||||
|
||||
if (Thread::current()->block<Thread::ConnectBlocker>(description) != Thread::BlockResult::WokeNormally) {
|
||||
if (Thread::current()->block<Thread::ConnectBlocker>(description).was_interrupted()) {
|
||||
m_connect_side_role = Role::None;
|
||||
return KResult(-EINTR);
|
||||
}
|
||||
|
@ -300,8 +300,7 @@ ssize_t LocalSocket::recvfrom(FileDescription& description, void* buffer, size_t
|
|||
return -EAGAIN;
|
||||
}
|
||||
} else if (!can_read(description, 0)) {
|
||||
auto result = Thread::current()->block<Thread::ReadBlocker>(description);
|
||||
if (result != Thread::BlockResult::WokeNormally)
|
||||
if (Thread::current()->block<Thread::ReadBlocker>(description).was_interrupted())
|
||||
return -EINTR;
|
||||
}
|
||||
if (!has_attached_peer(description) && buffer_for_me.is_empty())
|
||||
|
|
|
@ -372,7 +372,7 @@ KResult TCPSocket::protocol_connect(FileDescription& description, ShouldBlock sh
|
|||
m_direction = Direction::Outgoing;
|
||||
|
||||
if (should_block == ShouldBlock::Yes) {
|
||||
if (Thread::current()->block<Thread::ConnectBlocker>(description) != Thread::BlockResult::WokeNormally)
|
||||
if (Thread::current()->block<Thread::ConnectBlocker>(description).was_interrupted())
|
||||
return KResult(-EINTR);
|
||||
ASSERT(setup_state() == SetupState::Completed);
|
||||
if (has_error()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue