소스 검색

* fix compilation for mipsel-android (hopefully)

florian 1 년 전
부모
커밋
dc5041d778
2개의 변경된 파일23개의 추가작업 그리고 13개의 파일을 삭제
  1. 10 3
      rtl/linux/bunxsysc.inc
  2. 13 10
      rtl/linux/linux.pp

+ 10 - 3
rtl/linux/bunxsysc.inc

@@ -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;
 
 

+ 13 - 10
rtl/linux/linux.pp

@@ -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}