-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please revert this commit about statvfs #535
Comments
Ping, @sepherosa @bapt |
Experiment: ❯ cat f_bsize.c
#include <sys/statvfs.h>
#include <stdio.h>
int main() {
struct statvfs buf;
statvfs("/", &buf);
printf("%lf\n", (unsigned long long) buf.f_bsize * (unsigned long long)buf.f_bavail / (double)1000.0 / 1000 / 1000);
}
❯ cat f_frsize.c
#include <sys/statvfs.h>
#include <stdio.h>
int main() {
struct statvfs buf;
statvfs("/", &buf);
printf("%lf\n", (unsigned long long) buf.f_frsize * (unsigned long long)buf.f_bavail / (double)1000.0 / 1000 / 1000);
} MacOS: ❯ cc f_bsize.c -o f_bsize
❯ ./f_bsize
63521.527169
❯ cc f_frsize.c -o f_frsize
❯ ./f_frsize
248.129827
❯ df -H /
Filesystem Size Used Avail Capacity iused ifree %iused Mounted on
/dev/disk3s1s1 995G 10G 248G 4% 404k 2.4G 0% / FreeBSD: blast@x470-freebsd ~/P/C/d> cc f_bsize.c -o f_bsize
blast@x470-freebsd ~/P/C/d> ./f_bsize
12250.145358
blast@x470-freebsd ~/P/C/d> cc f_frsize.c -o f_frsize
blast@x470-freebsd ~/P/C/d> ./f_frsize
47.852171
blast@x470-freebsd ~/P/C/d> df -H /
Filesystem Size Used Avail Capacity Mounted on
zroot/ROOT/default 175G 127G 48G 73% / OpenBSD: openbsd-pve$ cc f_bsize.c -o f_bsize
openbsd-pve$ ./f_bsize
6.862389
openbsd-pve$ cc f_frsize.c -o f_frsize
openbsd-pve$ ./f_frsize
0.857799
openbsd-pve$ df -h /
Filesystem Size Used Avail Capacity Mounted on
/dev/sd0a 986M 118M 818M 13% / |
I have no idea about OpenBSD or MacOS, but I confirm for FreeBSD that I had to backout this change. https://cgit.freebsd.org/ports/tree/deskutils/i3status/files/patch-src_print__disk__info.c |
aokblast
changed the title
Please revoke this commit about statvfs
Please revert this commit about statvfs
Sep 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, this commit indicates that BSD style system use f_bsize instead of f_frsize. But after I test on my FreeBSD and MacOS. It indicates the f_frsize is the correct result.
The text was updated successfully, but these errors were encountered: