* fix compilation for mipsel-android (hopefully)

This commit is contained in:
florian 2024-01-21 11:32:13 +01:00
parent 08e494ffd1
commit dc5041d778
2 changed files with 23 additions and 13 deletions

View File

@ -406,12 +406,19 @@ end;
{$endif}
{ on 32 bit systems, we should use the 64 bit time calls }
{$if (sizeof(time_t)<=4)}
{ mipsel-android doesn't have them as it is not part of newer android versions anymode }
{$if not(defined(ANDROID) and defined(CPU_MIPSEL))}
{$define USE_TIME64}
{$endif not(defined(ANDROID) and defined(CPU_MIPSEL))}
{$endif (sizeof(clong)<=4)}
Function FpFUtimens (handle: cint;constref times: TTimespecArr):cint;
var
tsa: Array[0..1] of timespec;
begin
{$if sizeof(clong)<=4}
{$ifdef USE_TIME64}
FpFUtimens:=do_syscall(syscall_nr_utimensat_time64,handle,TSysParam(nil),TSysParam(@times),0);
if (FpFUtimens>=0) or (fpgeterrno<>ESysENOSYS) then
exit;
@ -421,9 +428,9 @@ begin
tsa[1].tv_sec := times[1].tv_sec;
tsa[1].tv_nsec := times[1].tv_nsec;
FpFUtimens:=do_syscall(syscall_nr_utimensat,handle,TSysParam(nil),TSysParam(@tsa),0);
{$else sizeof(clong)<=4}
{$else USE_TIME64}
FpFUtimens:=do_syscall(syscall_nr_utimensat,handle,TSysParam(nil),TSysParam(@times),0);
{$endif sizeof(clong)<=4}
{$endif USE_TIME64}
end;

View File

@ -551,10 +551,8 @@ Type
function statx(dfd: cint; filename: PAnsiChar; flags,mask: cuint; var buf: tstatx):cint; {$ifdef FPC_USE_LIBC} cdecl; weakexternal name 'statx'; {$ENDIF}
{$ifndef android}
Function utimensat(dfd: cint; path:PAnsiChar;const times:TTimespecArr;flags:cint):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'utimensat'; {$ENDIF}
Function futimens(fd: cint; const times:TTimespecArr):cint; {$ifdef FPC_USE_LIBC} cdecl; external name 'futimens'; {$ENDIF}
{$endif android}
implementation
@ -875,13 +873,19 @@ begin
statx:=do_syscall(syscall_nr_statx,TSysParam(dfd),TSysParam(filename),TSysParam(flags),TSysParam(mask),TSysParam(@buf));
end;
{ on 32 bit systems, we should use the 64 bit time calls }
{$if (sizeof(time_t)<=4)}
{ mipsel-android doesn't have them as it is not part of newer android versions anymode }
{$if not(defined(ANDROID) and defined(CPU_MIPSEL))}
{$define USE_TIME64}
{$endif not(defined(ANDROID) and defined(CPU_MIPSEL))}
{$endif (sizeof(clong)<=4)}
{$ifndef android}
Function utimensat(dfd: cint; path:PAnsiChar;const times:TTimespecArr;flags:cint):cint;
var
tsa: Array[0..1] of timespec;
begin
{$if sizeof(clong)<=4}
{$ifdef USE_TIME64}
utimensat:=do_syscall(syscall_nr_utimensat_time64,dfd,TSysParam(path),TSysParam(@times),0);
if (utimensat>=0) or (fpgeterrno<>ESysENOSYS) then
exit;
@ -891,9 +895,9 @@ begin
tsa[1].tv_sec := times[1].tv_sec;
tsa[1].tv_nsec := times[1].tv_nsec;
utimensat:=do_syscall(syscall_nr_utimensat,dfd,TSysParam(path),TSysParam(@tsa),0);
{$else sizeof(clong)<=4}
{$else USE_TIME64}
utimensat:=do_syscall(syscall_nr_utimensat,dfd,TSysParam(path),TSysParam(@times),0);
{$endif sizeof(clong)<=4}
{$endif USE_TIME64}
end;
@ -901,7 +905,7 @@ Function futimens(fd: cint; const times:TTimespecArr):cint;
var
tsa: Array[0..1] of timespec;
begin
{$if sizeof(clong)<=4}
{$ifdef USE_TIME64}
futimens:=do_syscall(syscall_nr_utimensat_time64,fd,TSysParam(nil),TSysParam(@times),0);
if (futimens>=0) or (fpgeterrno<>ESysENOSYS) then
exit;
@ -911,11 +915,10 @@ begin
tsa[1].tv_sec := times[1].tv_sec;
tsa[1].tv_nsec := times[1].tv_nsec;
futimens:=do_syscall(syscall_nr_utimensat,fd,TSysParam(nil),TSysParam(@tsa),0);
{$else sizeof(clong)<=4}
{$else USE_TIME64}
futimens:=do_syscall(syscall_nr_utimensat,fd,TSysParam(nil),TSysParam(@times),0);
{$endif sizeof(clong)<=4}
{$endif USE_TIME64}
end;
{$endif android}
{$endif not FPC_USE_LIBC}