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) Look at
man statfs; the structure returned has both counts available (f_bfreeandf_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
statfsreturns 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 bystatfsto those displayed by the program you are interested in.