tstatfs example program errors for macOS
Original Reporter info from Mantis: trev @trevoz
-
Reporter name: Trevor Roydhouse
Original Reporter info from Mantis: trev @trevoz
- Reporter name: Trevor Roydhouse
Description:
Example 30 at https://www.freepascal.org/docs-html/rtl/unix/tstatfs.html
{$if defined(Linux) or defined(sunos)}
// SysV like.
writeln ('fstype : ',info.fstype);
{$else}
// BSD like, incl Mac OS X. <<<<<< Suggests example works on macOS
writeln ('fstype : ',info.ftype);
{$endif}
[...]
writeln ('ffree : ',info.ffree);
{$ifdef FreeBSD}
writeln ('fsid : ',info.fsid[0]);
{$else}
writeln ('fsid : ',info.fsid[0]); <<<<<<<
writeln ('Namelen : ',info.namelen); <<<<<<<
{$endif}
macOS does not have the fsid and namelen fields (or equivalents) in its record structure for statfs, statfs64, fstatfs or fstatfs64. See man 2 statfs.
Suggest:
{$ifdef Darwin}
writeln ('ffree : ',info.ffree);
{$elseif FreeBSD}
writeln ('ffree : ',info.ffree);
writeln ('fsid : ',info.fsid[0]);
{$else}
writeln ('ffree : ',info.ffree);
writeln ('fsid : ',info.fsid[0]);
writeln ('Namelen : ',info.namelen);
{$endif}
Mantis conversion info:
- Mantis ID: 37530
- OS: macOS
- OS Build: 10.14.6
- Build: All
- Platform: Apple
- Fixed in version: 3.3.1
- Fixed in revision: 1740 (#e2f7110e)
- Target version: 3.2.2