bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

configure issue: getfsstat(), 'struct statfs' and 'struct fsstat'


From: Barath Aron
Subject: configure issue: getfsstat(), 'struct statfs' and 'struct fsstat'
Date: Wed, 11 Jul 2018 14:00:21 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Hello,

I have a little issue around the detection of the getfsstat() function.

According to multiple manuals from different BSD versions [1,2], the signature of the BSD's getfsstat() is this:
int getfsstat(struct statfs *buf, long bufsize, int mode);

Note, it refers to 'struct statfs'. The statfs structure contains a field that will be interesting in the following [3,4]:

struct statfs {
...
char      f_fstypename[MFSNAMELEN]; /* filesystem type name */
...
};

The configure script tries to detect the getfsstat() function but failes, because:
configure:31706: checking for struct fsstat.f_fstypename
configure:31706: /path/to/some-cross-gcc -c   conftest.c >&5
conftest.c: In function 'main':
conftest.c:473:22: error: storage size of 'ac_aggr' isn't known
 static struct fsstat ac_aggr;
                      ^~~~~~~
configure:31706: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "GNU findutils"
| #define PACKAGE_TARNAME "findutils"
| #define PACKAGE_VERSION "4.6.0"
...
| int
| main ()
| {
| static struct fsstat ac_aggr;
| if (ac_aggr.f_fstypename)
| return 0;
|   ;
|   return 0;
| }

However, the used type in the failed program was 'struct fsstat'. By the definition of 'struct statfs' found in the BSD manuals, does have a field 'f_fstypename'. But the name is different.

My goal is to compile the findutils by supplying the BSD's getfsstat() API to get mountlist. For now, I do not want to implement the Linux's <mntent.h> stuff, I like the BSD approach.

So, my questions are:
a) Why the configure use a different type name?
b) If it is intentional, then where that type is defined? Unfortunately, I did not found anything. c) Is this branch of the configure still maintained, or it is abandoned? The related code that use this API is also still maintained?

Aron

[1] https://man.openbsd.org/getfsstat.2
[2] https://www.freebsd.org/cgi/man.cgi?query=getfsstat&sektion=2
[3] https://man.openbsd.org/statfs.2
[4] https://www.freebsd.org/cgi/man.cgi?query=statfs&sektion=2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]