Mac doesn't have O_DIRECT, but it has F_NOCACHE
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/fcntl.h>
|
||||
|
||||
// TODO This C wrapper is required since P/Invoke cannot correctly pass variadic
|
||||
// arguments to ioctl on non-Windows platforms.
|
||||
@@ -25,3 +26,9 @@ int ioctl_no_arg(int fd, unsigned long request)
|
||||
{
|
||||
return ioctl(fd, request);
|
||||
}
|
||||
|
||||
// Wrapper for fcntl to set F_NOCACHE (equivalent to O_DIRECT on Linux)
|
||||
int fcntl_nocache(int fd)
|
||||
{
|
||||
return fcntl(fd, F_NOCACHE, 1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user