1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +00:00

LibCore: Remove the barely-used Core::safe_syscall()

This was a helper that would call a syscall repeatedly until it either
succeeded or failed with a non-EINTR error.

It was only used in two places, so I don't think we need this helper.
This commit is contained in:
Andreas Kling 2021-04-21 20:05:00 +02:00
parent c41c41cc0f
commit e5318d51e6
4 changed files with 22 additions and 74 deletions

View file

@ -32,7 +32,6 @@
#include <LibCore/EventLoop.h>
#include <LibCore/LocalSocket.h>
#include <LibCore/Notifier.h>
#include <LibCore/SyscallUtils.h>
#include <LibCore/Timer.h>
#include <LibIPC/Message.h>
#include <stdint.h>
@ -167,12 +166,19 @@ protected:
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(m_socket->fd(), &rfds);
int rc = Core::safe_syscall(select, m_socket->fd() + 1, &rfds, nullptr, nullptr, nullptr);
if (rc < 0) {
perror("select");
for (;;) {
if (auto rc = select(m_socket->fd() + 1, &rfds, nullptr, nullptr, nullptr); rc < 0) {
if (errno == EINTR)
continue;
perror("wait_for_specific_endpoint_message: select");
VERIFY_NOT_REACHED();
} else {
VERIFY(rc > 0);
VERIFY(FD_ISSET(m_socket->fd(), &rfds));
break;
}
}
VERIFY(rc > 0);
VERIFY(FD_ISSET(m_socket->fd(), &rfds));
if (!drain_messages_from_peer())
break;
}