#pragma once #include #include #include #include namespace CSyscallUtils { template inline int safe_syscall(Syscall syscall, Args&& ... args) { for (;;) { int sysret = syscall(forward(args)...); if (sysret == -1) { dbgprintf("CSafeSyscall: %d (%d: %s)\n", sysret, errno, strerror(errno)); if (errno == EINTR) continue; ASSERT_NOT_REACHED(); } return sysret; } } }