#include #include #include #include #include #include "util.h" void panic(const char *msg) { perror(msg); exit(EXIT_FAILURE); } int setblocking(int fd, bool blocking) { u_long mode = blocking ? 0 : 1; if (ioctl(fd, FIONBIO, &mode) == -1) return ERROR; return OK; }