From 31668dc7626f98d8fb2bafa1fafb14c4e2f6bef0 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 1 Jan 2026 20:51:50 +0100 Subject: [PATCH] unix,win: add f_frsize field to uv_statfs_t Fixes: https://github.com/libuv/libuv/issues/4983 --- docs/src/fs.rst | 3 ++- include/uv.h | 3 ++- src/unix/fs.c | 1 + src/win/fs.c | 1 + test/test-fs.c | 1 + 5 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/src/fs.rst b/docs/src/fs.rst index def767258..99524e702 100644 --- a/docs/src/fs.rst +++ b/docs/src/fs.rst @@ -129,7 +129,8 @@ Data types uint64_t f_bavail; uint64_t f_files; uint64_t f_ffree; - uint64_t f_spare[4]; + uint64_t f_frsize; + uint64_t f_spare[3]; } uv_statfs_t; .. c:enum:: uv_dirent_type_t diff --git a/include/uv.h b/include/uv.h index d1a77c749..41d7acc93 100644 --- a/include/uv.h +++ b/include/uv.h @@ -1262,7 +1262,8 @@ struct uv_statfs_s { uint64_t f_bavail; uint64_t f_files; uint64_t f_ffree; - uint64_t f_spare[4]; + uint64_t f_frsize; + uint64_t f_spare[3]; }; typedef enum { diff --git a/src/unix/fs.c b/src/unix/fs.c index e66c9d299..2190c6bda 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -706,6 +706,7 @@ static int uv__fs_statfs(uv_fs_t* req) { stat_fs->f_type = buf.f_type; #endif stat_fs->f_bsize = buf.f_bsize; + stat_fs->f_frsize = buf.f_frsize; stat_fs->f_blocks = buf.f_blocks; stat_fs->f_bfree = buf.f_bfree; stat_fs->f_bavail = buf.f_bavail; diff --git a/src/win/fs.c b/src/win/fs.c index 3bd610ba4..ca09ad46c 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -3154,6 +3154,7 @@ retry_get_full_path_name: stat_fs->f_type = 0; stat_fs->f_bsize = bytes_per_sector * sectors_per_cluster; + stat_fs->f_frsize = bytes_per_sector * sectors_per_cluster; stat_fs->f_blocks = total_clusters; stat_fs->f_bfree = free_clusters; stat_fs->f_bavail = free_clusters; diff --git a/test/test-fs.c b/test/test-fs.c index db4f6e841..44788dc26 100644 --- a/test/test-fs.c +++ b/test/test-fs.c @@ -363,6 +363,7 @@ static void statfs_cb(uv_fs_t* req) { #endif ASSERT_GT(stats->f_bsize, 0); + ASSERT_GT(stats->f_frsize, 0); ASSERT_GT(stats->f_blocks, 0); ASSERT_LE(stats->f_bfree, stats->f_blocks); ASSERT_LE(stats->f_bavail, stats->f_bfree);