diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2017-06-29 14:27:48 -0700 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2017-08-04 17:30:33 +0000 |
commit | 88c30618d512864adab0733b58dd5f48b7f98f74 (patch) | |
tree | 0c28e9d39de9bb0a2076fc83e9f3501c1b2c9587 /src/corelib/configure.json | |
parent | 4934138be29868bdf848e2aeb6c6163819ab3a5c (diff) | |
download | qtbase-88c30618d512864adab0733b58dd5f48b7f98f74.tar.gz |
QFileSystemEngine::renameFile: use calls that don't overwrite
The renameat2(2) Linux system call, new in 3.16, allows for the atomic
renaming of a file if and only if it won't clobber an existing
file. None of the Linux libcs have enabled this syscall as an API, so we
use syscall(3) to place the call.
If your libc has SYS_renameat2 but your kernel doesn't support it, we'll
keep issuing the unknown syscall, every time. Users in that situation
should upgrade (3.16 is from 2014).
On Darwin, there's a similar renameatx_np (guessing "np" stands for
"non-portable"). I haven't found anything similar on the other BSDs.
Change-Id: I1eba2b016de74620bfc8fffd14ccb4e455a3ec9e
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/configure.json')
-rw-r--r-- | src/corelib/configure.json | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/corelib/configure.json b/src/corelib/configure.json index 44d6ccfdf5..61fc2e16c9 100644 --- a/src/corelib/configure.json +++ b/src/corelib/configure.json @@ -379,6 +379,15 @@ ] } }, + "renameat2": { + "label": "renameat2()", + "type": "compile", + "test": { + "head": "#define _ATFILE_SOURCE 1", + "include": [ "fcntl.h", "stdio.h" ], + "main": "renameat2(AT_FDCWD, argv[1], AT_FDCWD, argv[2], RENAME_NOREPLACE | RENAME_WHITEOUT);" + } + }, "syslog": { "label": "syslog", "type": "compile", @@ -576,6 +585,11 @@ "condition": "features.statemachine", "output": [ "publicFeature" ] }, + "renameat2": { + "label": "renameat2()", + "condition": "config.linux && tests.renameat2", + "output": [ "privateFeature" ] + }, "slog2": { "label": "slog2", "condition": "libs.slog2", |