From 4cd7a78f3b8c03670e2d77675229472506eee1eb Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Thu, 21 Oct 2021 21:10:32 +0000 Subject: lei: use RENAME_NOREPLACE on Linux 3.15+ One syscall is better than two for atomicity in Maildirs. This means there's no window where another process can see both the old and new file at the same time (link && unlink), nor a window where we might inadvertantly clobber an existing file if we were to do `stat && rename'. --- devel/syscall-list | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'devel') diff --git a/devel/syscall-list b/devel/syscall-list index b33401d9..3d55df1f 100755 --- a/devel/syscall-list +++ b/devel/syscall-list @@ -1,4 +1,4 @@ -# Copyright 2021 all contributors +# Copyright all contributors # License: AGPL-3.0+ # Dump syscall numbers under Linux and any other kernel which # promises stable syscall numbers. This is to maintain @@ -9,7 +9,10 @@ eval 'exec perl -S $0 ${1+"$@"}' # no shebang if 0; # running under some shell use strict; +use v5.10.1; use File::Temp 0.19; +use POSIX qw(uname); +say '$machine='.(POSIX::uname())[-1]; my $cc = $ENV{CC} // 'cc'; my @cflags = split(/\s+/, $ENV{CFLAGS} // '-Wall'); my $str = do { local $/; }; @@ -43,6 +46,9 @@ int main(void) D(SYS_inotify_add_watch); D(SYS_inotify_rm_watch); D(SYS_prctl); +#ifdef SYS_renameat2 + D(SYS_renameat2); +#endif #endif /* Linux, any other OSes with stable syscalls? */ printf("size_t=%zu off_t=%zu\n", sizeof(size_t), sizeof(off_t)); return 0; -- cgit v1.2.3-24-ge0c7