LibCore: Merge the CSyscallUtils namespace into Core

This commit is contained in:
Andreas Kling 2020-02-06 15:04:57 +01:00
parent d17e23bd27
commit 258d798b34
Notes: sideshowbarker 2024-07-19 09:34:04 +09:00
4 changed files with 5 additions and 5 deletions

View file

@ -382,7 +382,7 @@ void EventLoop::wait_for_event(WaitMode mode)
should_wait_forever = false;
}
int marked_fd_count = CSyscallUtils::safe_syscall(select, max_fd + 1, &rfds, &wfds, nullptr, should_wait_forever ? nullptr : &timeout);
int marked_fd_count = Core::safe_syscall(select, max_fd + 1, &rfds, &wfds, nullptr, should_wait_forever ? nullptr : &timeout);
if (FD_ISSET(s_wake_pipe_fds[0], &rfds)) {
char buffer[32];
auto nread = read(s_wake_pipe_fds[0], buffer, sizeof(buffer));

View file

@ -110,7 +110,7 @@ bool IODevice::can_read_from_fd() const
struct timeval timeout {
0, 0
};
int rc = CSyscallUtils::safe_syscall(select, m_fd + 1, &rfds, nullptr, nullptr, &timeout);
int rc = Core::safe_syscall(select, m_fd + 1, &rfds, nullptr, nullptr, &timeout);
if (rc < 0) {
// NOTE: We don't set m_error here.
perror("IODevice::can_read: select");

View file

@ -32,7 +32,7 @@
#include <sys/types.h>
#include <unistd.h>
namespace CSyscallUtils {
namespace Core {
template<typename Syscall, class... Args>
inline int safe_syscall(Syscall syscall, Args&&... args)
@ -41,7 +41,7 @@ inline int safe_syscall(Syscall syscall, Args&&... args)
int sysret = syscall(forward<Args>(args)...);
if (sysret == -1) {
int saved_errno = errno;
dbg() << "CSafeSyscall: " << sysret << " (" << saved_errno << ": " << strerror(saved_errno) << ")";
dbg() << "Core::safe_syscall: " << sysret << " (" << saved_errno << ": " << strerror(saved_errno) << ")";
if (errno == EINTR)
continue;
ASSERT_NOT_REACHED();

View file

@ -100,7 +100,7 @@ public:
fd_set rfds;
FD_ZERO(&rfds);
FD_SET(m_connection->fd(), &rfds);
int rc = CSyscallUtils::safe_syscall(select, m_connection->fd() + 1, &rfds, nullptr, nullptr, nullptr);
int rc = Core::safe_syscall(select, m_connection->fd() + 1, &rfds, nullptr, nullptr, nullptr);
if (rc < 0) {
perror("select");
}