Thanks a lot PascalDragon for your reply. But I did not understand all you wrote because I'm not an expert for those things like you.
No, from a 32-bit process you only have access to the 32-bit compatible interface of the kernel.
Does this mean, that a 64-bit Linux provides 2 completely separate "interfaces": one complete set with all system calls only for 64-bit programs and a second complete set with all system calls only for 32-bit programs?
What you need to do instead is to use the correct system call that provides 64-bit timestamps (fpStat should already do that, if it doesn't please report a bug).
Hmm: when I call fpStat() in a 32-bit program (FPC 3.2.0) it returns a record, where the 3 timestamps are in 32-bit variables, as also shown in
https://www.freepascal.org/docs-html/current/rtl/baseunix/stat.html (type Cardinal = LongWord = 32-bit). Is that the bug which I should report?
In case of utime or utimes you should look at the system calls utimensat and utimensat_time64 (and maybe also report a bug so that the y2038 problem is handled correctly).
I did not find utimensat and utimensat_time64 in unit "baseunix". Then I googled for both and found hard stuff but did not find something what helped me to proceed: it seems that 'utimensat' uses only 32-bit variables (in a 32-bit program) and that 'utimensat_time64' exists only in kernel >= 5.1, but I have 4.15 (Ubuntu 18.04).
So I searched the sources of FPC 3.2.0 for both words and found only 2 (Linux related) matches for 'syscall_nr_utimensat':
1) in file <installdir>/fpcsrc/rtl/linux/sysnr-gen.inc =>
const syscall_nr_utimensat = 88;2) in file <installdir>/fpcsrc/rtl/linux/bunxsysc.inc =>
{$if defined(generic_linux_syscalls)}
Function fpUtime(path:pchar;times:putimbuf):cint;
var
tsa: Array[0..1] of timespec;
begin
tsa[0].tv_sec := times^.actime;
tsa[0].tv_nsec := 0;
tsa[1].tv_sec := times^.modtime;
tsa[1].tv_nsec := 0;
fputime:=do_syscall(syscall_nr_utimensat,AT_FDCWD,TSysParam(path),
TSysParam(@tsa),0);
end;
I had the idea to try to get this running, but type 'timespec' uses only 32-bit variables for the timestamps in a 32-bit program, so I think it can't work.
Please, what did you mean, what should I try exactly? Sorry, I'm a beginner to this stuff.
Thanks for your help.