使用“statfs”在 Mac OS X 上?
我需要检索有关硬盘的信息,并使用 statfs 函数来执行此操作。
- 当您的计算机在硬盘上显示可用空间时,它使用的是“可用块”还是“非特权用户可用的可用块”?
- statfs 可以与 SSD 配合使用吗?
- 主硬盘的“路径”将如何存储?在 Windows 上通常是 C:,但我是 OSX 新手。
手册页似乎没有提供 statfs 工作原理的非常全面的介绍。
使用 C/Objective-C 的 Mac OSX Snowleopard。 Xcode 3.2.6
I need to retrieve information about a hard disk and am using the statfs function to do so.
- When your computer displays free space on the HD, does it use "free blocks" or "free blocks available to unpriveleged user"?
- Does statfs work with SSDs?
- How would the "path" to the main hard drive be stored? On windows it's generally C:, but I am new to OSX.
The man pages don't seem to provide a very comprehensive look of how statfs works.
Mac OSX Snowleopard using C/Objective-C. Xcode 3.2.6
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
1)查看
man statfs
;返回的结构有两个可用的计数(f_bfree
和f_bavail
)。1) 是的,它适用于文件系统,而不是硬盘驱动器,因此无论什么类型文件系统所在的硬盘驱动器(如果有)。
3)
/
1 如果问题的第一部分不是关于
statfs
返回什么,而是“计算机”一般显示什么,我想答案取决于程序用于显示可用空间量。将 statfs 返回的两个值与您感兴趣的程序显示的值进行比较。1) Look at
man statfs
; the structure returned has both counts available (f_bfree
andf_bavail
).¹2) Yes, it works on filesystems, not hard drives, so it doesn't matter what type of hard drive (if any) the filesystem is on.
3)
/
¹ In case the first part of the question was not about what
statfs
returns but what “the computer” displays in general, I guess the answer depends on the program used to display the amount of free space. Compare the two values returned bystatfs
to those displayed by the program you are interested in.