about summary refs log tree commit homepage
path: root/devel
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-10-21 21:10:32 +0000
committerEric Wong <e@80x24.org>2021-10-22 00:54:51 +0000
commit4cd7a78f3b8c03670e2d77675229472506eee1eb (patch)
tree2a0e89de3e77b70962e509d41883518fb6574dde /devel
parent2c354e17694da744c6dc1ab19c14af3d456b28bb (diff)
downloadpublic-inbox-4cd7a78f3b8c03670e2d77675229472506eee1eb.tar.gz
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'.
Diffstat (limited to 'devel')
-rwxr-xr-xdevel/syscall-list8
1 files changed, 7 insertions, 1 deletions
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 <meta@public-inbox.org>
+# Copyright all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <http://www.gnu.org/licenses/agpl-3.0.txt>
 # 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 $/; <DATA> };
@@ -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;