diff --git a/rtl/linux/osdefs.inc b/rtl/linux/osdefs.inc index 7e7a91e227..a756e03477 100644 --- a/rtl/linux/osdefs.inc +++ b/rtl/linux/osdefs.inc @@ -88,6 +88,7 @@ {$ifdef cpuaarch64} {$define generic_linux_syscalls} {$undef usestime} + {$define userenameat} {$endif cpuaarch64} {$ifdef cpusparc64} diff --git a/rtl/linux/ossysc.inc b/rtl/linux/ossysc.inc index 3edc485011..d924b9aa8f 100644 --- a/rtl/linux/ossysc.inc +++ b/rtl/linux/ossysc.inc @@ -100,7 +100,11 @@ function Fprename(old : pchar; newpath: pchar): cint; [public, alias : 'FPC_SYSC begin {$if defined(generic_linux_syscalls)} - Fprename:=do_syscall(syscall_nr_renameat,AT_FDCWD,TSysParam(old),AT_FDCWD,TSysParam(newpath)); + {$if defined(userenameat)} + Fprename:=do_syscall(syscall_nr_renameat,AT_FDCWD,TSysParam(old),AT_FDCWD,TSysParam(newpath)); + {$else} + Fprename:=do_syscall(syscall_nr_renameat2,AT_FDCWD,TSysParam(old),AT_FDCWD,TSysParam(newpath),0); + {$endif} {$else} Fprename:=do_syscall(syscall_nr_rename,TSysParam(old),TSysParam(newpath)); {$endif}