mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 20:07:36 +00:00
LibCore: Merge the CSyscallUtils namespace into Core
This commit is contained in:
parent
d17e23bd27
commit
258d798b34
4 changed files with 5 additions and 5 deletions
|
@ -382,7 +382,7 @@ void EventLoop::wait_for_event(WaitMode mode)
|
||||||
should_wait_forever = false;
|
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)) {
|
if (FD_ISSET(s_wake_pipe_fds[0], &rfds)) {
|
||||||
char buffer[32];
|
char buffer[32];
|
||||||
auto nread = read(s_wake_pipe_fds[0], buffer, sizeof(buffer));
|
auto nread = read(s_wake_pipe_fds[0], buffer, sizeof(buffer));
|
||||||
|
|
|
@ -110,7 +110,7 @@ bool IODevice::can_read_from_fd() const
|
||||||
struct timeval timeout {
|
struct timeval timeout {
|
||||||
0, 0
|
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) {
|
if (rc < 0) {
|
||||||
// NOTE: We don't set m_error here.
|
// NOTE: We don't set m_error here.
|
||||||
perror("IODevice::can_read: select");
|
perror("IODevice::can_read: select");
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
namespace CSyscallUtils {
|
namespace Core {
|
||||||
|
|
||||||
template<typename Syscall, class... Args>
|
template<typename Syscall, class... Args>
|
||||||
inline int safe_syscall(Syscall syscall, Args&&... 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)...);
|
int sysret = syscall(forward<Args>(args)...);
|
||||||
if (sysret == -1) {
|
if (sysret == -1) {
|
||||||
int saved_errno = errno;
|
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)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
|
@ -100,7 +100,7 @@ public:
|
||||||
fd_set rfds;
|
fd_set rfds;
|
||||||
FD_ZERO(&rfds);
|
FD_ZERO(&rfds);
|
||||||
FD_SET(m_connection->fd(), &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) {
|
if (rc < 0) {
|
||||||
perror("select");
|
perror("select");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue