43a44
> #include <cerrno>
44a46
> #include <cstring>
202a205,227
> template <class ArgT>
> static int fcntlHelper(int fd, int cmd, ArgT arg)
> {
> int retval = fcntl(fd, cmd, arg);
> if (retval == -1) {
> char *errstr = strerror(errno);
> panic("fcntl(%d, %d, %s): \"%s\" when setting up async IO.\n",
> errstr, fd, cmd, arg);
> }
> return retval;
> }
>
> static int fcntlHelper(int fd, int cmd)
> {
> int retval = fcntl(fd, cmd);
> if (retval == -1) {
> char *errstr = strerror(errno);
> panic("fcntl(%d, %d): \"%s\" when setting up async IO.\n",
> errstr, fd, cmd);
> }
> return retval;
> }
>
206,208c231
< int flags = fcntl(fd, F_GETFL);
< if (flags == -1)
< panic("Could not set up async IO");
---
> int flags = fcntlHelper(fd, F_GETFL);
215,218c238,239
< if (set) {
< if (fcntl(fd, F_SETOWN, getpid()) == -1)
< panic("Could not set up async IO");
< }
---
> if (set)
> fcntlHelper(fd, F_SETOWN, getpid());
220,221c241
< if (fcntl(fd, F_SETFL, flags) == -1)
< panic("Could not set up async IO");
---
> fcntlHelper(fd, F_SETFL, flags);