admin管理员组文章数量:1123776
Is the value of st_blksize
field of struct stat
type filled inside function stat()
's output parameter, hard coded in some system config file? If it is, can somebody tell me the system config file path?
Is the value of st_blksize
field of struct stat
type filled inside function stat()
's output parameter, hard coded in some system config file? If it is, can somebody tell me the system config file path?
1 Answer
Reset to default 1Converting my comments into an answer.
The preferred block size may vary by file system type, so there's no easy way to determine one size at compile time for all files on a system — let alone if the executable will be copied across systems.
Can you get that information non-programmatically?
No — certainly not portably between Linux and non-Linux systems. There's the POSIX statvfs()
function, but it provides minimal reliable information. The various stat()
functions may provide more information, but that's all programmatic because the answer depends on which file system a given file resides on. You can't rely on a value derived at compile time.
本文标签: cpreferred block size for efficient file IOStack Overflow
版权声明:本文标题:c - preferred block size for efficient file IO - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736593106a1945106.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
struct stat
, thest_blksize
is a property of the filesystem, not of the individual file. Generally, there's not a config file for this per se, but you can determine the filesystem type and some details from files, and, if that's not enough, with sufficient privilege you can read filesystem details from the host device. But I don't that, especially the last bit, is what you really meant. – John Bollinger Commented yesterdaystatvfs()
function, but it provides minimal reliable information. The variousstat()
functions may provide more, but that's all programmatic because the answer depends on which file system a given file resides on. You can't rely on a value derived at compile time. – Jonathan Leffler Commented yesterday