#include <fcntl.h>
#include <stdint.h>
#include <string.h>
+#ifndef _WIN32
#include <sys/mount.h>
+#endif
#include <sys/param.h>
#include <sys/socket.h>
#include <sys/stat.h>
}
int on_zfs(int basedir_fd) {
+ #ifndef _WIN32
struct statfs basefs;
(void)fstatfs(basedir_fd, &basefs);
return (basefs.f_type == FS_ZFS_TYPE);
+ #else
+ return 0;
+ #endif
}
int ceph_posix_fallocate(int fd, off_t offset, off_t len) {
if (pipe(pipefd) == -1)
return -1;
+ #ifndef _WIN32
/*
* The old-fashioned, race-condition prone way that we have to fall
* back on if pipe2 does not exist.
if (fcntl(pipefd[1], F_SETFD, FD_CLOEXEC) < 0) {
goto fail;
}
+ #endif
return 0;
fail:
if (fd == -1)
return -1;
+ #ifndef _WIN32
if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
goto fail;
+ #endif
return fd;
fail:
if (rc == -1)
return -1;
+ #ifndef _WIN32
if (fcntl(sv[0], F_SETFD, FD_CLOEXEC) < 0)
goto fail;
if (fcntl(sv[1], F_SETFD, FD_CLOEXEC) < 0)
goto fail;
+ #endif
return 0;
fail:
if (fd == -1)
return -1;
+ #ifndef _WIN32
if (fcntl(fd, F_SETFD, FD_CLOEXEC) < 0)
goto fail;
+ #endif
return fd;
fail: