1 # Copyright 2021 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <http://www.gnu.org/licenses/agpl-3.0.txt>
3 # Dump syscall numbers under Linux and any other kernel which
4 # promises stable syscall numbers. This is to maintain
6 # DO NOT USE this for *BSDs, none of the current BSD kernels
7 # we know about promise stable syscall numbers, we'll use
8 # Inline::C to support them.
9 eval 'exec perl -S $0 ${1+"$@"}' # no shebang
10 if 0; # running under some shell
13 my $cc = $ENV{CC} // 'cc';
14 my @cflags = split(/\s+/, $ENV{CFLAGS} // '-Wall');
15 my $str = do { local $/; <DATA> };
16 my $tmp = File::Temp->newdir('syscall-list-XXXX', TMPDIR => 1);
19 open my $fh, '>', $f or die "open $f $!";
20 print $fh $str or die "print $f $!";
21 close $fh or die "close $f $!";
22 system($cc, '-o', $x, $f, @cflags) == 0 or die "cc failed \$?=$?";
27 #include <sys/syscall.h>
30 #define D(x) printf("$" #x " = %ld;\n", (long)x)
43 D(SYS_inotify_add_watch);
44 D(SYS_inotify_rm_watch);
46 #endif /* Linux, any other OSes with stable syscalls? */
47 printf("size_t=%zu off_t=%zu\n", sizeof(size_t), sizeof(off_t));