summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/minimum-linux.S
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-06-29 14:27:48 -0700
committerThiago Macieira <thiago.macieira@intel.com>2017-08-04 17:30:33 +0000
commit88c30618d512864adab0733b58dd5f48b7f98f74 (patch)
tree0c28e9d39de9bb0a2076fc83e9f3501c1b2c9587 /src/corelib/global/minimum-linux.S
parent4934138be29868bdf848e2aeb6c6163819ab3a5c (diff)
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/global/minimum-linux.S')
-rw-r--r--src/corelib/global/minimum-linux.S5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/corelib/global/minimum-linux.S b/src/corelib/global/minimum-linux.S
index 3d97ea7ec8..aa67be44ca 100644
--- a/src/corelib/global/minimum-linux.S
+++ b/src/corelib/global/minimum-linux.S
@@ -86,6 +86,7 @@
* - eventfd 2.6.23
* - pipe2 & dup3 2.6.27
* - accept4 2.6.28
+ * - renameat2 3.16 QT_CONFIG(renameat2)
* - getrandom 3.17 QT_CONFIG(getentropy)
*/
@@ -93,6 +94,10 @@
.long 3
.long 17
.long 0
+#elif QT_CONFIG(renameat2)
+ .long 3
+ .long 16
+ .long 0
#else
.long 2
.long 6