Commit 59575633 authored by Konstantin Khlebnikov's avatar Konstantin Khlebnikov

bsd,apl: concentrate magic on top

Signed-off-by: default avatarKonstantin Khlebnikov <koct9i@gmail.com>
parent 634b35ef
...@@ -40,15 +40,18 @@ ...@@ -40,15 +40,18 @@
#ifdef __linux__ #ifdef __linux__
# define HAVE_POSIX_FADVICE # define HAVE_POSIX_FADVICE
# define HAVE_POSIX_MEMALIGN # define HAVE_POSIX_MEMALIGN
# define HAVE_DIRECT_IO
#endif #endif
#ifdef __FreeBSD__ #ifdef __FreeBSD__
# include <sys/disk.h> # include <sys/disk.h>
# define HAVE_NOCACHE_IO
#endif #endif
#ifdef __APPLE__ #ifdef __APPLE__
# include <sys/disk.h> # include <sys/disk.h>
# include <sys/uio.h> # include <sys/uio.h>
# define HAVE_NOCACHE_IO
#endif #endif
#ifndef HAVE_POSIX_FADVICE #ifndef HAVE_POSIX_FADVICE
...@@ -434,7 +437,8 @@ int main (int argc, char **argv) ...@@ -434,7 +437,8 @@ int main (int argc, char **argv)
errx(1, "request size must be greather than zero"); errx(1, "request size must be greather than zero");
flags = O_RDONLY; flags = O_RDONLY;
#ifdef O_DIRECT
#ifdef HAVE_DIRECT_IO
if (direct) if (direct)
flags |= O_DIRECT; flags |= O_DIRECT;
#endif #endif
...@@ -509,7 +513,7 @@ int main (int argc, char **argv) ...@@ -509,7 +513,7 @@ int main (int argc, char **argv)
err(2, "failed to open \"%s\"", path); err(2, "failed to open \"%s\"", path);
} }
#ifdef F_NOCACHE #ifdef HAVE_NOCACHE_IO
if (fcntl(fd, F_NOCACHE, direct)) if (fcntl(fd, F_NOCACHE, direct))
err(2, "fcntl nocache failed"); err(2, "fcntl nocache failed");
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment