[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fsusage.c fails to build on GNU
From: |
Pádraig Brady |
Subject: |
Re: fsusage.c fails to build on GNU |
Date: |
Mon, 02 Jul 2012 23:25:10 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 |
On 07/02/2012 10:28 PM, Jim Meyering wrote:
> Ludovic Courtès wrote:
>> On GNU/Hurd, ‘struct statfs’ is defined in <sys/statfs.h>. However,
>> fsusage.c ends up including only <sys/statvfs.h>, and thus, ‘struct
>> statfs’ and the ‘statfs’ function aren’t defined/declared, leading to:
>>
>> fsusage.c: In function 'get_fs_usage':
>> fsusage.c:222:17: error: storage size of 'fsd' isn't known
>> fsusage.c:224:3: warning: implicit declaration of function 'statfs'
>> [-Wimplicit-function-declaration]
>>
>> (Seen on <http://hydra.nixos.org/build/2751266>.)
>>
>> The fix appears to be to include <sys/statfs.h> when STAT_STATFS2_FRSIZE
>> is defined.
>
> Hi Ludo,
>
> Thanks for the report and suggested fix.
> Can you easily see if this does the job?
>
>>From 3e26070ccd633da280ade87c8441da52fb957473 Mon Sep 17 00:00:00 2001
> From: Jim Meyering <address@hidden>
> Date: Mon, 2 Jul 2012 22:26:44 +0200
> Subject: [PATCH] fsusage: avoid build failure on GNU/Hurd
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
>
> * lib/fsusage.c [STAT_STATFS2_FRSIZE]: Include <sys/statfs.h>.
> Report and suggested fix from Ludovic Courtès.
> ---
> ChangeLog | 6 ++++++
> lib/fsusage.c | 4 ++++
> 2 files changed, 10 insertions(+)
>
> diff --git a/ChangeLog b/ChangeLog
> index 2a798eb..034c434 100644
> --- a/ChangeLog
> +++ b/ChangeLog
> @@ -1,3 +1,9 @@
> +2012-07-02 Jim Meyering <address@hidden>
> +
> + fsusage: avoid build failure on GNU/Hurd
> + * lib/fsusage.c [STAT_STATFS2_FRSIZE]: Include <sys/statfs.h>.
> + Report and suggested fix from Ludovic Courtès.
> +
> 2012-06-28 Bruno Haible <address@hidden>
>
> log10f: Fix possible configuration problem.
> diff --git a/lib/fsusage.c b/lib/fsusage.c
> index bca78cc..39dc57b 100644
> --- a/lib/fsusage.c
> +++ b/lib/fsusage.c
> @@ -55,6 +55,10 @@
> # include "full-read.h"
> #endif
>
> +#ifdef STAT_STATFS2_FRSIZE
> +# include <sys/statfs.h>
> +#endif
> +
> /* The results of open() in this file are not used with fchdir,
> therefore save some unnecessary work in fchdir.c. */
> #undef open
> --
> 1.7.11.1.104.ge7b44f1
Oops my bad.
I didn't consider that case in commit b1fac37
I think the following might be a better fix
since it will remove redundant code in this case.
cheers,
Pádraig.
diff --git a/lib/fsusage.c b/lib/fsusage.c
index 1e35d30..8c82c2d 100644
--- a/lib/fsusage.c
+++ b/lib/fsusage.c
@@ -90,6 +90,8 @@
preceding entries in /proc/mounts; that makes df hang if even one
of the corresponding file systems is hard-mounted but not available. */
# if ! (__linux__ && (__GLIBC__ || __UCLIBC__))
+/* The FRSIZE fallback is not required in this case. */
+# undef STAT_STATFS2_FRSIZE
static int statvfs_works (void) { return 1; }
# else
# include <string.h> /* for strverscmp */