Recent

Author Topic: Wrong TStatfs record on Mac OS loaded  (Read 312 times)

comdora

  • New Member
  • *
  • Posts: 10
Wrong TStatfs record on Mac OS loaded
« on: July 04, 2022, 03:15:59 pm »
I have installed fpc 3.2.2 and Lazarus IDE v 2.2.2 on MAC macOS Catalina 10.15.7

I am trying to use record

{$if defined(cpuarm) or defined(cpuaarch64) or defined(iphonesim)}
 { structure used on iPhoneOS and available on Mac OS X 10.6 and later }
 tstatfs = 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..(MFSNAMELEN)-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;
{$else}
     tstatfs = record
          otype : cint16;
          oflags : cint16;
          bsize : clong;
          iosize : clong;
          blocks : clong;
          bfree : clong;
          bavail : clong;
          files : clong;
          ffree : clong;
          fsid : fsid_t;
          fowner : uid_t;
          reserved1 : cint16;
          ftype : cint16;
          fflags : clong;
          reserved2 : array[0..1] of clong;
          fstypename : array[0..(MFSNAMELEN)-1] of char;
          mountpoint : array[0..(MNAMELEN)-1] of char;
          mntfromname : array[0..(MNAMELEN)-1] of char;
          f_reserved3: char;
          reserved4: array[0..3] of clong;
       end;
{$endif}
    pstatfs = ^tstatfs;   


but the record is loaded wrong, from the {$else} part. 

Any idea how to solve the problem?

Thanks in advance Bojan

Thausand

  • Sr. Member
  • ****
  • Posts: 282
Re: Wrong TStatfs record on Mac OS loaded
« Reply #1 on: July 04, 2022, 07:08:43 pm »
Any idea how to solve the problem?
You can solve self  :)

Show list defines for compile:
Code: [Select]
fpc -vc

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 970
Re: Wrong TStatfs record on Mac OS loaded
« Reply #2 on: July 04, 2022, 08:01:11 pm »
The old stat(fs) record also works under current macOS versions. You cannot just change the stat(fs) record, you also have to change the used stat calls in that case. I have a local patch that changes all of that depending on the target macOS version (-WM) command line parameter *used to compile the RTL*, but I haven't committed it yet.
« Last Edit: July 04, 2022, 08:44:08 pm by Jonas Maebe »

comdora

  • New Member
  • *
  • Posts: 10
Re: Wrong TStatfs record on Mac OS loaded
« Reply #3 on: July 04, 2022, 08:39:38 pm »
Quote
You cannot just change the stat(fs) record, you also have to change the used stat calls in that case.

I completely agree with you, that's why I asked for everyone's opinion. In particular, I am very interested in the f_fssubtype... which is an integral part of the new... If I were to change the processor type to aacrch64 the execution asks me to upgrade system to 11.

 

TinyPortal © 2005-2018