From d3393ce25833c0afd7f0fa6b85fd6f3bd7ad520a Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 2 Jul 2017 14:57:21 -0700 Subject: Add support for statx(2) on Linux This system call, new in Linux 4.11, gives us the file birth time. It's also extensible, representing the fourth generation of stat(2) on Linux (the original sys_stat(), sys_newstat(), sys_stat64() and now sys_statx()), not to be confused with glibc's __xstat function, which wraps a call to stat64. Anyway, the new one is designed to be extensible. Now we get birth times on ext[34] on Linux too: Name: . Path: . (/home/tjmaciei/src/qt) Size: 4096 Type: Directory Attrs: readable writable executable hidden nativepath Mode: drwxr-xr-x Owner: tjmaciei (1000) Group: users (100) Access: 2017-07-02T14:47:49.608 Birth: 2016-05-02T13:20:33.097 Change: 2017-07-01T13:37:08.737 Modified: 2017-07-01T13:37:08.737 It's not supported in any other filesystems I have (Linux sources show xfs has the feature too). Even on ext4, it depends on whether the filesystem was created with 256-byte inodes, which my /boot fs wasn't. Change-Id: I8d96dea9955d4c749b99fffd14cda23ed60d5e72 Reviewed-by: Simon Hausmann --- src/corelib/configure.json | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/corelib/configure.json') diff --git a/src/corelib/configure.json b/src/corelib/configure.json index c8fede2b8f..8b503233a0 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -383,6 +383,19 @@ "main": "renameat2(AT_FDCWD, argv[1], AT_FDCWD, argv[2], RENAME_NOREPLACE | RENAME_WHITEOUT);" } }, + "statx": { + "label": "statx() in libc", + "type": "compile", + "test": { + "head": "#define _ATFILE_SOURCE 1", + "include": [ "sys/types.h", "sys/stat.h", "unistd.h", "fcntl.h" ], + "main": [ + "struct statx statxbuf;", + "unsigned int mask = STATX_BASIC_STATS;", + "return statx(AT_FDCWD, \"\", AT_STATX_SYNC_AS_STAT, mask, &statxbuf);" + ] + } + }, "syslog": { "label": "syslog", "type": "compile", @@ -585,6 +598,11 @@ "condition": "libs.slog2", "output": [ "privateFeature" ] }, + "statx": { + "label": "statx() in libc", + "condition": "config.linux && tests.statx", + "output": [ "privateFeature" ] + }, "syslog": { "label": "syslog", "autoDetect": false, -- cgit v1.2.3