From 07ee5508f829a3374d505feb5cd862d2bb7d4b75 Mon Sep 17 00:00:00 2001 From: Benedikt Meurer <benny@xfce.org> Date: Mon, 31 Jul 2006 12:42:03 +0000 Subject: [PATCH] 2006-07-31 Benedikt Meurer <benny@xfce.org> * configure.in.in, thunar-vfs/thunar-vfs-io-local-xfer.c, thunar-vfs/thunar-vfs-io-local.c: Use statvfs1()/fstatvfs1() on NetBSD 2.99 and above. (Old svn revision: 22591) --- ChangeLog | 6 ++++++ configure.in.in | 2 +- thunar-vfs/thunar-vfs-io-local-xfer.c | 5 ++++- thunar-vfs/thunar-vfs-io-local.c | 8 +++++--- 4 files changed, 16 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1272a4b0..f5176d7f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2006-07-31 Benedikt Meurer <benny@xfce.org> + + * configure.in.in, thunar-vfs/thunar-vfs-io-local-xfer.c, + thunar-vfs/thunar-vfs-io-local.c: Use statvfs1()/fstatvfs1() on + NetBSD 2.99 and above. + 2006-07-31 Benedikt Meurer <benny@xfce.org> * thunar/thunar-permissions-chooser.c diff --git a/configure.in.in b/configure.in.in index 5056cb6ec..3aa6d5592 100644 --- a/configure.in.in +++ b/configure.in.in @@ -116,7 +116,7 @@ AC_FUNC_MMAP() AC_CHECK_FUNCS([attropen extattr_get_fd fgetxattr lchmod localeconv \ localtime_r mbrtowc mkdtemp mkfifo posix_madvise pread \ pwrite readdir_r sched_yield setgroupent setpassent \ - statfs statvfs strcoll strlcpy strptime symlink]) + statfs statvfs statvfs1 strcoll strlcpy strptime symlink]) dnl ****************************************** dnl *** Linux/glibc specified work-arounds *** diff --git a/thunar-vfs/thunar-vfs-io-local-xfer.c b/thunar-vfs/thunar-vfs-io-local-xfer.c index bcf81ecb4..5cc92b8a7 100644 --- a/thunar-vfs/thunar-vfs-io-local-xfer.c +++ b/thunar-vfs/thunar-vfs-io-local-xfer.c @@ -94,7 +94,10 @@ static inline void tvilx_copy_regular (const gchar *so static gboolean tvilx_mounted_readonly (gint fd) { -#if defined(HAVE_STATVFS) +#if defined(HAVE_STATVFS1) + struct statvfs statvfsb; + return (fstatvfs1 (fd, &statvfsb, ST_NOWAIT) == 0 && (statvfsb.f_flag & ST_RDONLY) != 0); +#elif defined(HAVE_STATVFS) struct statvfs statvfsb; return (fstatvfs (fd, &statvfsb) == 0 && (statvfsb.f_flag & ST_RDONLY) != 0); #elif defined(HAVE_STATFS) diff --git a/thunar-vfs/thunar-vfs-io-local.c b/thunar-vfs/thunar-vfs-io-local.c index 9cf33ae30..3a0d182d2 100644 --- a/thunar-vfs/thunar-vfs-io-local.c +++ b/thunar-vfs/thunar-vfs-io-local.c @@ -101,9 +101,9 @@ gboolean _thunar_vfs_io_local_get_free_space (const ThunarVfsPath *path, ThunarVfsFileSize *free_space_return) { -#if defined(HAVE_STATFS) && !defined(__sgi__) && !defined(__sun__) +#if defined(HAVE_STATFS) && !defined(HAVE_STATVFS1) && !defined(__sgi__) && !defined(__sun__) struct statfs statfsb; -#elif defined(HAVE_STATVFS) +#elif defined(HAVE_STATVFS) || defined(HAVE_STATVFS1) struct statvfs statfsb; #endif gboolean succeed; @@ -116,8 +116,10 @@ _thunar_vfs_io_local_get_free_space (const ThunarVfsPath *path, return FALSE; /* determine the amount of free space for the mount point */ -#if defined(HAVE_STATFS) && !defined(__sgi__) && !defined(__sun__) +#if defined(HAVE_STATFS) && !defined(HAVE_STATVFS1) && !defined(__sgi__) && !defined(__sun__) succeed = (statfs (absolute_path, &statfsb) == 0); /* the good old BSD way */ +#elif defined(HAVE_STATVFS1) + succeed = (statvfs1 (absolute_path, &statfsb, ST_WAIT) == 0); /* the new NetBSD way */ #elif defined(HAVE_STATVFS) succeed = (statvfs (absolute_path, &statfsb) == 0); /* the Linux, IRIX, Solaris way */ #else -- GitLab