View Issue Details

IDProjectCategoryView StatusLast Update
0038418FPCRTLpublic2021-02-07 19:00
ReporterHartmut Assigned ToFlorian  
Status resolvedResolutionfixed 
Product Version3.2.0 
Fixed in Version3.3.1 
Summary0038418: baseunix. fpStat() can't get 64-bit timestamps in 32-bit programs
DescriptionWhen you call baseunix.fpStat() in a 32-bit program it returns a record, where the 3 timestamps are only in 32-bit variables. Currently it is not possible to read 64-bit timestamps in a 32-bit program.
PascalDragon asked me to create this report in the forum in,32.0.html (reply 0000003) so that this issue won't be forgotten.
TagsNo tags attached.
Fixed in Revision
Attached Files



2021-01-30 19:32

administrator   ~0128683

Doesn't fpstatx (trunk only) provide what you are looking for?


2021-01-31 11:00

reporter   ~0128702

That sounds interesting. Thank you. I will install trunk version in next days and test and report then.
Do you know, if fpstatx() requires a Linux kernel >= 5.1 like utimensat_time64() does?
Do you know, if there exists something like fpstatx() in FPC but for fpUTime() to set 64-bit timestamps in a 32-bit program?


2021-01-31 17:26

administrator   ~0128709

fpstatx requires 4.11, on 32 bit linux, there is no way round using a recent kernel.
I just added a fputimensat call to the linux unit.

While I answered the questions here, please ask questions on the mailing list/forum, this is not the purpose of the bug tracker.


2021-02-01 12:30

reporter   ~0128723

Great. I will test fpstatx() and fputimensat() from trunk in the next days. Thank you very much for fixing so soon.


2021-02-07 15:56

reporter   ~0128805

I testet function linux.statx() in FPC 3.3.1 trunk rev 48497 and it works great! Thanks a lot for your continuous work.

In above sources I saw 2 usages of statx() which do not match completely to the documentation in as I understand it, but I can't estimate if that might cause any problems or not. Maybe you want to have a look at them?

a) in file fpcsrc/rtl/unix/sysutils.pp in function FileAge() line 572 shows:
   if (statx(0,pchar(SystemFileName),0,STATX_MTIME or STATX_MODE,Infox)>=0) ...
Should the 1st parameter (=dfd) be 'AT_FDCWD' in case that 'SystemFileName' can be a relative path?

b) in file fpcsrc/rtl/unix/sysutils.pp in function FileGetDate() line 1088 shows:
   if statx(Handle,nil,0,STATX_MTIME,Infox)=0 then
Should the 3rd parameter (=flags) be 'AT_EMPTY_PATH', when the 2nd parameter (=filename) is an empty string?


2021-02-07 19:00

administrator   ~0128808

You are right with both remarks, I fixed it. Thanks. Actually, empty string means even a pointer to #0 and not only nil.

Issue History

Date Modified Username Field Change
2021-01-29 09:28 Hartmut New Issue
2021-01-30 19:32 Florian Note Added: 0128683
2021-01-31 00:03 Florian Assigned To => Florian
2021-01-31 00:03 Florian Status new => feedback
2021-01-31 00:03 Florian FPCTarget => -
2021-01-31 11:00 Hartmut Note Added: 0128702
2021-01-31 11:00 Hartmut Status feedback => assigned
2021-01-31 17:26 Florian Status assigned => resolved
2021-01-31 17:26 Florian Resolution open => fixed
2021-01-31 17:26 Florian Fixed in Version => 3.3.1
2021-01-31 17:26 Florian Note Added: 0128709
2021-02-01 12:30 Hartmut Note Added: 0128723
2021-02-07 15:56 Hartmut Note Added: 0128805
2021-02-07 19:00 Florian Note Added: 0128808