Using “statfs” on Mac OS X?

我是研究僧i 提交于 2019-12-11 03:29:04

问题


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


回答1:


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.



来源:https://stackoverflow.com/questions/9186698/using-statfs-on-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!