summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src
diff options
context:
space:
mode:
Diffstat (limited to 'libglusterfs/src')
-rw-r--r--libglusterfs/src/syscall.c35
-rw-r--r--libglusterfs/src/syscall.h3
2 files changed, 37 insertions, 1 deletions
diff --git a/libglusterfs/src/syscall.c b/libglusterfs/src/syscall.c
index 0828b8a64fa..3683488edb6 100644
--- a/libglusterfs/src/syscall.c
+++ b/libglusterfs/src/syscall.c
@@ -283,7 +283,40 @@ sys_lseek (int fd, off_t offset, int whence)
int
sys_statvfs (const char *path, struct statvfs *buf)
{
- return statvfs (path, buf);
+ int ret;
+
+ ret = statvfs (path, buf);
+#ifdef __FreeBSD__
+ /* FreeBSD doesn't return the expected vaule in buf->f_bsize. It
+ * contains the optimal I/O size instead of the file system block
+ * size. Gluster expects that this field contains the block size.
+ */
+ if (ret == 0) {
+ buf->f_bsize = buf->f_frsize;
+ }
+#endif /* __FreeBSD__ */
+
+ return ret;
+}
+
+
+int
+sys_fstatvfs (int fd, struct statvfs *buf)
+{
+ int ret;
+
+ ret = fstatvfs (fd, buf);
+#ifdef __FreeBSD__
+ /* FreeBSD doesn't return the expected vaule in buf->f_bsize. It
+ * contains the optimal I/O size instead of the file system block
+ * size. Gluster expects this field to contain the block size.
+ */
+ if (ret == 0) {
+ buf->f_bsize = buf->f_frsize;
+ }
+#endif /* __FreeBSD__ */
+
+ return ret;
}
diff --git a/libglusterfs/src/syscall.h b/libglusterfs/src/syscall.h
index bbf23bef07b..a9f6a7eb1cc 100644
--- a/libglusterfs/src/syscall.h
+++ b/libglusterfs/src/syscall.h
@@ -142,6 +142,9 @@ int
sys_statvfs (const char *path, struct statvfs *buf);
int
+sys_fstatvfs (int fd, struct statvfs *buf);
+
+int
sys_close (int fd);
int