View Issue Details

IDProjectCategoryView StatusLast Update
0036501FPCRTLpublic2020-01-02 15:10
ReporterdevEric69Assigned ToFlorian 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformOSLinuxOS Versionext3 versus ext4
Product Version3.0.4Product Build 
Target VersionFixed in Version3.3.1 
Summary0036501: Request for improvement, to obtain the creation date of a file under Linux formatted in *ext4*
DescriptionCurrently, RTL makes it possible to retrieve the creation date with:
- function FpStat (unit BaseUnix). The resulting record Stat has parts, where we are looking for:
         Last access time: st_atime
         Last modification time: st_mtime
         Creation time: st_ctime

It worked and it works... still for an *ext3* filesystem.
But it no longer returns the file creation date, for a Linux *ext4* filesystem.
For a Linux *ext4* filesystem, there's a new function named statx, with its new Info structure:
===============
NEW SYSTEM CALL
===============

The new system call is:

   int ret = statx(int dfd,
         const char *filename,
         unsigned int flags,
         unsigned int mask,
         struct statx *buffer);"

Steps To Reproduce- This conversation: https://forum.lazarus.freepascal.org/index.php/topic,47956.msg344767.html#msg344767 .
- On the official Gihub site of Linux Torvalds ( https://github.com/torvalds/linux/commit/a528d35e8bfcc521d7cb70aaf03e1bd296c8493f ) where the Linux kernel is managed, it is written:
"statx : Add a system call to make enhanced file info available.
statx function add a system call, to make extended file information available, including
*file creation* and some attribute flags where available through the
underlying filesystem.../..."
Additional InformationIf it could be useful, I post a function in Pascal to retrieve the formatting (ext3, ext4, etc) of a machine:

{^^
Explanations: add in a TStringlist parameter, all the filesystem under Linux: ext2, ext3, etx4, ...
^^}
procedure GetListeFileSystems(var o_slFileSystems: TStringList);
var
  F: TextFile;
  S: string;
begin
  AssignFile(F, '/proc/filesystems');
  Reset(F);
  repeat
    Readln(F, S);
    if Pos('nodev', S) = 0 then
      o_slFileSystems.Add(Trim(S));
  until Eof(F);
  o_slFileSystems.Add('supermount');
  CloseFile(F);
end;
TagsNo tags attached.
Fixed in Revision43837
FPCOldBugId
FPCTarget-
Attached Files

Activities

There are no notes attached to this issue.

Issue History

Date Modified Username Field Change
2020-01-02 10:38 devEric69 New Issue
2020-01-02 15:10 Florian Assigned To => Florian
2020-01-02 15:10 Florian Status new => resolved
2020-01-02 15:10 Florian Resolution open => fixed
2020-01-02 15:10 Florian Fixed in Version => 3.3.1
2020-01-02 15:10 Florian Fixed in Revision => 43837
2020-01-02 15:10 Florian FPCTarget => -