Request for improvement, to obtain the creation date of a file under Linux formatted in *ext4*
Original Reporter info from Mantis: devEric69
-
Reporter name: devEric69
Original Reporter info from Mantis: devEric69
- Reporter name: devEric69
Description:
Currently, 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 information:
If 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;
Mantis conversion info:
- Mantis ID: 36501
- OS: Linux
- OS Build: ext3 versus ext4
- Version: 3.0.4
- Fixed in version: 3.3.1
- Fixed in revision: 43837 (#d425a85f)
- Monitored by: » devEric69 (devEric69)