[Toybox] df not working on FreeBSD

Rob Landley rob at landley.net
Tue Apr 16 04:41:15 PDT 2024


On 4/15/24 04:37, Vidar Karlsen via Toybox wrote:
> Hello,
> 
> df throws the following error on FreeBSD:
> 
> root at 140amd64_noopts-usrports:/usr/local/toybox/bin # ./df /
> df: getmntinfo: Invalid argument
> 
> A little bit of poking around shows that getmntinfo expects the second
> argument (the mode) to be one of these, and not 0:

Presumably it worked at one point, but I didn't write that bit...

> sys/sys/mount.h:
> #define MNT_WAIT    1   /* synchronously wait for I/O to complete */
> #define MNT_NOWAIT  2   /* start all I/O, but do not wait for it */
> #define MNT_LAZY    3   /* push data not written by filesystem syncer */
> #define MNT_SUSPEND 4   /* Suspend file system after sync */
> 
> Changing 0 to MNT_NOWAIT in portability.c makes df happy again.

And doesn't break macos, so I'm not adding the #ifdef in your patch. (I don't
have an openbsd test environment lying around, but
https://man.openbsd.org/getmntinfo.3 links to
https://man.openbsd.org/getfsstat.2 which says the options are MNT_WAIT and
MNT_NOWAIT so presumably they're happy too.

Commit 7d9ee89d3cf8.

Rob


More information about the Toybox mailing list