FUN WITH LINUX

Using the new statx() system-call

4 June 2017

In the Linux Kernel 4.11 a new system-call statx() was introduced. The old stat() system-call is used to get meta-data(like size, permissions aso.) of files and directories. Stat() lacks functionallity for remote filesystems and collects all the information of a file at once which might lead to slow operations. Statx() is a new implementation of stat. The caller can request specific information(like just the size of a file) to speed up the call. If the filesystem is a remote filesystem, it is possible to let statx() first sync with the remote-server before requesting the information(or just be fine with the cached infos). Another nice feature is that statx() can also be used to get extra fileattributes like: “is the file encrypted or compressed?”.

To get a feeling for statx() and to learn how to use it, I wrote a little statx()-application and published it on github. At the moment the glibc doesn’t support statx() so I had to use the generic syscall()-function and create my own statx()-header-file to make it work.

[ Programming  C  Downloads  ]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti