使用“statfs”在 Mac OS X 上?

发布于 2025-01-03 19:59:31 字数 290 浏览 2 评论 0原文

我需要检索有关硬盘的信息,并使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挽袖吟 2025-01-10 19:59:31

1)查看man statfs;返回的结构有两个可用的计数(f_bfreef_bavail)。

1) 是的,它适用于文件系统,而不是硬盘驱动器,因此无论什么类型文件系统所在的硬盘驱动器(如果有)。

3) /

1 如果问题的第一部分不是关于 statfs 返回什么,而是“计算机”一般显示什么,我想答案取决于程序用于显示可用空间量。将 statfs 返回的两个值与您感兴趣的程序显示的值进行比较。

1) Look at man statfs; the structure returned has both counts available (f_bfree and f_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 by statfs to those displayed by the program you are interested in.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文