UPD: refactoring Statfs Fix from uMyDarwin to uDarwinIO

This commit is contained in:
rich2014 2025-12-10 21:35:06 +08:00
commit 8c5274e6ff
2 changed files with 39 additions and 36 deletions

View file

@ -16,9 +16,46 @@ unit uDarwinIO;
interface
uses
Classes, SysUtils,
Classes, SysUtils, UnixType,
MacOSAll, CocoaAll, CocoaUtils,
uMyDarwin, uDarwinFileUtil, uLog;
uDarwinFileUtil, uLog;
// Workarounds for FPC RTL Bug
// copied from ptypes.inc and modified fstypename only
{$if defined(cpuarm) or defined(cpuaarch64) or defined(iphonesim)}
{ structure used on iPhoneOS and available on Mac OS X 10.6 and later }
const MFSTYPENAMELEN = 16;
type
TDarwinAarch64Statfs = record
bsize : cuint32;
iosize : cint32;
blocks : cuint64;
bfree : cuint64;
bavail : cuint64;
files : cuint64;
ffree : cuint64;
fsid : fsid_t;
owner : uid_t;
ftype : cuint32;
fflags : cuint32;
fssubtype : cuint32;
fstypename : array[0..(MFSTYPENAMELEN)-1] of char;
mountpoint : array[0..(PATH_MAX)-1] of char;
mntfromname : array[0..(PATH_MAX)-1] of char;
reserved: array[0..7] of cuint32;
end;
type TDarwinStatfs = TDarwinAarch64Statfs;
{$else}
type TDarwinStatfs = TStatFs;
{$endif}
type
io_object_t = mach_port_t;

View file

@ -46,40 +46,6 @@ const
procedure onMainMenuCreate( menu: NSMenu );
// Workarounds for FPC RTL Bug
// copied from ptypes.inc and modified fstypename only
{$if defined(cpuarm) or defined(cpuaarch64) or defined(iphonesim)}
{ structure used on iPhoneOS and available on Mac OS X 10.6 and later }
const MFSTYPENAMELEN = 16;
type TDarwinAarch64Statfs = record
bsize : cuint32;
iosize : cint32;
blocks : cuint64;
bfree : cuint64;
bavail : cuint64;
files : cuint64;
ffree : cuint64;
fsid : fsid_t;
owner : uid_t;
ftype : cuint32;
fflags : cuint32;
fssubtype : cuint32;
fstypename : array[0..(MFSTYPENAMELEN)-1] of char;
mountpoint : array[0..(PATH_MAX)-1] of char;
mntfromname : array[0..(PATH_MAX)-1] of char;
reserved: array[0..7] of cuint32;
end;
type TDarwinStatfs = TDarwinAarch64Statfs;
{$else}
type TDarwinStatfs = TStatFs;
{$endif}
type
{ TMacosServiceMenuHelper }