Lazarus
Programming => Operating Systems => Linux => Topic started by: mai on October 21, 2017, 01:52:22 pm
-
dudes... the kernel dudes added an enhanced fstat() , named fstatx() in 4.11 :-X
there is a C sample with kernl src and example 28 demos fstat() in Pascal.
I was trying out stuff and thought about making a GUI for the new function which - however - may not be supported on all file systems yet. Sooner or later FP will have to offer fstatx() in the RTL of course. Seems not to be that much sweat though, I'd say. 8-)
- fstatx() querys hi-res timestamps of files, their mode bits, attributes, and all the rest...
what u think ? 8)
both C & Pascal src are easy to use , they beg to make a lil GUI showing the new ULTRA HI RES timestamps and the new mode bits !
sample test-stax.c does not build: https://lkml.org/lkml/2017/2/26/163
https://lwn.net/Articles/707602/ (https://lwn.net/Articles/707602/)
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a528d35e8bfcc521d7cb70aaf03e1bd296c8493f (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a528d35e8bfcc521d7cb70aaf03e1bd296c8493f)
https://www.freepascal.org/docs-html/rtl/baseunix/fpstat.html (https://www.freepascal.org/docs-html/rtl/baseunix/fpstat.html)
-
Sounds to me as a Linux specific, special purpose call, though I don't really understand why they did this. Specially the stx_ prefix of fields seems to indicate that this really isn't meant as a compatible stat.
You can call syscalls over the syscall unit, but what do you really need that compatible cross-unix stat/baseunix.fpstat doesn't give?
To me this reeks of the horrors of stat32/stat64 that needed linux specific ifdefs for a decade.
The only thing one commonly would need is higher resolution timestamps, but applying this to the compatible (fp)(f)stat has been delayed, see point 8 here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a528d35e8bfcc521d7cb70aaf03e1bd296c8493f
All the other features seem to be for specific cases like network daemons (nfsd,smbd), and management tools of newer FS.
But maybe it is logical to first test the waters with an extra call, and only later go through the massive undertaking of updating the portable call.
-
use statx in bash:
https://github.com/bernd-wechner/Linux-Tools/blob/master/xstat (https://github.com/bernd-wechner/Linux-Tools/blob/master/xstat)
$ xstat xstat
File: xstat
Size: 4984 Blocks: 16 IO Block: 4096 regular file
Device: 804h/2052d Inode: 21093276 Links: 1
Access: (0755/-rwxr-xr-x) Uid: ( 1000/ abc) Gid: ( 1001/ abc)
Access: 2017-11-20 18:27:26.592431702 +0100
Modify: 2017-11-20 18:27:26.592431702 +0100
Change: 2017-11-20 18:29:19.859787498 +0100
Birth: 1970-01-01 01:00:00.000000000 +0100
"Birth" is kinda incorrect since though kernl 4.14. is in use, old functions were used to create the file.