[PATCH] [FreeBSD 15] statvfs() abstraction

Timur I. Bakeyev timur at com.bat.ru
Sun Jun 7 14:07:05 GMT 2009

Samba3 introduces an abstraction function for the statvfs(). FreeBSD has
both statvfs() and statfs(), but man page for stavfs() says:

  The statvfs() and fstatvfs() functions fill the structure pointed to by
  buf with garbage.  This garbage will occasionally bear resemblance to
  file system statistics, but portable applications must not depend on

So, this patch adds emulation of statvfs() via statfs() plus some
additional heurestics for some FS flags.

There is a (un)related configure check, that makes statfs() being
properly recognized(but test fails anyhow as there is no such a struct

With regards,
Timur Bakeyev.
-------------- next part --------------
--- ./source3/configure.in.orig	2009-04-30 07:53:01.000000000 +0000
+++ ./source3/configure.in	2009-06-01 11:49:40.000000000 +0000
@@ -6088,13 +6113,21 @@
 # Start
+AC_CHECK_HEADERS(sys/statfs.h sys/mount.h)
 AC_MSG_CHECKING([vfs_fileid: checking for statfs() and struct statfs.f_fsid)])
 		#include <sys/types.h>
+		#ifdef HAVE_SYS_PARAM_H
+		#include <sys/param.h>
+		#endif
+		#ifdef HAVE_SYS_MOUNT_H
+		#include <sys/mount.h>
+		#endif
 		#include <sys/statfs.h>
+		#endif
 		int main(void)
 			struct statfs fsd;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-source3__smbd__statvfs.c
Type: text/x-csrc
Size: 1937 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20090607/938f7cde/patch-source3__smbd__statvfs.bin

More information about the samba-technical mailing list