From 9efba16c2444b838117d375715e927333de1ce54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A7=9C=E5=87=AF?= Date: Sat, 14 Feb 2026 09:29:13 +0800 Subject: [PATCH] [fix](compile) fix macOS compilation error due to missing f_frsize in statfs macOS statfs struct does not have f_frsize member (it is Linux-specific). Use f_bsize directly on macOS via #ifdef __APPLE__ guard. Co-Authored-By: Claude Opus 4.6 --- be/src/io/cache/block_file_cache_factory.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/be/src/io/cache/block_file_cache_factory.cpp b/be/src/io/cache/block_file_cache_factory.cpp index ef12ca353de0ae..a68673f2d4d866 100644 --- a/be/src/io/cache/block_file_cache_factory.cpp +++ b/be/src/io/cache/block_file_cache_factory.cpp @@ -94,7 +94,11 @@ Status FileCacheFactory::create_file_cache(const std::string& cache_base_path, LOG_ERROR("").tag("file cache path", cache_base_path).tag("error", strerror(errno)); return Status::IOError("{} statfs error {}", cache_base_path, strerror(errno)); } +#ifdef __APPLE__ + const auto block_size = stat.f_bsize; +#else const auto block_size = stat.f_frsize ? stat.f_frsize : stat.f_bsize; +#endif size_t disk_capacity = static_cast(static_cast(stat.f_blocks) * static_cast(block_size)); if (file_cache_settings.capacity == 0 || disk_capacity < file_cache_settings.capacity) { @@ -289,7 +293,11 @@ std::string validate_capacity(const std::string& path, int64_t new_capacity, valid_capacity = 0; // caller will handle the error return ret; } +#ifdef __APPLE__ + const auto block_size = stat.f_bsize; +#else const auto block_size = stat.f_frsize ? stat.f_frsize : stat.f_bsize; +#endif size_t disk_capacity = static_cast(static_cast(stat.f_blocks) * static_cast(block_size)); if (new_capacity == 0 || disk_capacity < new_capacity) {