File: make-syscalls-linux.pl

package info (click to toggle)
bochs 3.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 25,244 kB
  • sloc: cpp: 270,331; ansic: 25,334; sh: 8,371; makefile: 5,512; yacc: 1,485; asm: 395; perl: 359; lex: 318; csh: 3
file content (34 lines) | stat: -rwxr-xr-x 874 bytes parent folder | download | duplicates (13)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/perl
#
# tested with linux 2.2.14
# reads <asm/unistd.h>, outputs syscalls-linux.h

$date = `date`;
print <<EOF;
//////////////////////////////////////////////////////////////////////////////
// Linux system call table
//////////////////////////////////////////////////////////////////////////////
//
// Format for each entry:
//   DEF_LINUX_SYSCALL(syscall_number, "syscall_name")
// This file can be regenerated with the following command:
//
//    ./make-syscalls-linux.pl < /usr/include/asm/unistd.h > syscalls-linux.h
//
EOF

$max = 0;
while (<STDIN>) {
  $line = $_;
  next unless /#define __NR_[a-z]/;
  s/.*NR_//;
  undef $number;
  ($name, $number) = split (/[\s]+/);
  if ((length $number) < 1) {
    die "bad line: $line";
  }
  if ($number > $max) { $max = $number; }
  print "DEF_SYSCALL($number, \"$name\")\n";
}

print "#define N_SYSCALLS $max\n";