}
inline
-std::system_error errno_error(int errnum) noexcept
+std::system_error errno_error(int errnum)
{
return std::system_error(errnum, errno_category());
}
inline
-std::system_error errno_error(int errno, const char* what)
+std::system_error errno_error(int errnum, const char* what)
{
return std::system_error(errnum, errno_category(), what);
}
case EINTR:
continue;
default:
- throw simgrid::mc::errno_error(errno);
+ throw simgrid::xbt::errno_error(errno);
}
}
if (socket_pollfd->revents & POLLIN) {
ssize_t size = MC_receive_message(socket_pollfd->fd, buffer, sizeof(buffer), MSG_DONTWAIT);
if (size == -1 && errno != EAGAIN)
- throw simgrid::mc::errno_error(errno);
+ throw simgrid::xbt::errno_error(errno);
return handle_message(buffer, size);
}
if (socket_pollfd->revents & POLLERR) {
if (errno == EINTR)
continue;
else
- throw simgrid::mc::errno_error(errno);
+ throw simgrid::xbt::errno_error(errno);
} else if (size != sizeof(info))
return throw std::runtime_error(
"Bad communication with model-checked application");
break;
} else {
XBT_ERROR("Could not wait for pid");
- throw simgrid::mc::errno_error(errno);
+ throw simgrid::xbt::errno_error(errno);
}
}
#endif
#include <xbt/log.h>
+#include <xbt/system_error.hpp>
#include "simgrid/sg_config.h"
#include "src/xbt_modinter.h"
{
pid_t pid = fork();
if (pid < 0)
- throw simgrid::mc::errno_error(errno, "Could not fork model-checked process");
+ throw simgrid::xbt::errno_error(errno, "Could not fork model-checked process");
if (pid != 0)
return pid;
sigset_t mask;
sigemptyset (&mask);
if (sigprocmask(SIG_SETMASK, &mask, nullptr) < 0)
- throw simgrid::mc::errno_error(errno, "Could not unblock signals");
+ throw simgrid::xbt::errno_error(errno, "Could not unblock signals");
if (prctl(PR_SET_PDEATHSIG, SIGHUP) != 0)
- throw simgrid::mc::errno_error(errno, "Could not PR_SET_PDEATHSIG");
+ throw simgrid::xbt::errno_error(errno, "Could not PR_SET_PDEATHSIG");
#endif
int res;
// Remove CLOEXEC in order to pass the socket to the exec-ed program:
int fdflags = fcntl(socket, F_GETFD, 0);
if (fdflags == -1 || fcntl(socket, F_SETFD, fdflags & ~FD_CLOEXEC) == -1)
- throw simgrid::xbt::system_error(errno, "Could not remove CLOEXEC for socket");
+ throw simgrid::xbt::errno_error(errno, "Could not remove CLOEXEC for socket");
// Set environment:
setenv(MC_ENV_VARIABLE, "1", 1);
int sockets[2];
res = socketpair(AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0, sockets);
if (res == -1)
- throw simgrid::xbt::system_error(errno, "Could not create socketpair");
+ throw simgrid::xbt::errno_error(errno, "Could not create socketpair");
pid_t pid = do_fork([&] {
close(sockets[1]);