--- libeio/eio.c 2012/04/01 17:22:42 1.117 +++ libeio/eio.c 2012/04/24 18:47:50 1.120 @@ -210,7 +210,7 @@ #define D_NAME(entp) entp->d_name /* POSIX_SOURCE is useless on bsd's, and XOPEN_SOURCE is unreliable there, too */ - #if __FreeBSD__ || defined __NetBSD__ || defined __OpenBSD__ + #if __FreeBSD__ || __NetBSD__ || __OpenBSD__ #define _DIRENT_HAVE_D_TYPE /* sigh */ #define D_INO(de) (de)->d_fileno #define D_NAMLEN(de) (de)->d_namlen @@ -1034,8 +1034,7 @@ #if HAVE_SYS_SYNCFS res = (int)syscall (__NR_syncfs, (int)(fd)); #else - res = -1; - errno = ENOSYS; + res = EIO_ENOSYS (); #endif if (res < 0 && errno == ENOSYS && fd >= 0) @@ -1075,11 +1074,10 @@ static int eio__fallocate (int fd, int mode, off_t offset, size_t len) { -#if HAVE_FALLOCATE +#if HAVE_LINUX_FALLOCATE return fallocate (fd, mode, offset, len); #else - errno = ENOSYS; - return -1; + return EIO_ENOSYS (); #endif } @@ -1151,7 +1149,7 @@ if (sbytes) res = sbytes; -# elif defined (__APPLE__) +# elif defined __APPLE__ off_t sbytes = count; res = sendfile (ifd, ofd, offset, &sbytes, 0, 0); @@ -1188,8 +1186,7 @@ res = TransmitFile (TO_SOCKET (ofd), h, count, 0, 0, 0, 0); #else - res = -1; - errno = ENOSYS; + res = EIO_ENOSYS (); #endif /* we assume sendfile can copy at least 128mb in one go */ @@ -2245,8 +2242,6 @@ X_LOCK (wrklock); etp_worker_free (self); X_UNLOCK (wrklock); - - return 0; } /*****************************************************************************/ @@ -2497,8 +2492,7 @@ break; default: - errno = ENOSYS; - req->result = -1; + req->result = EIO_ENOSYS (); break; }