forked from dtrace4linux/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_syscalls.pl
More file actions
executable file
·61 lines (50 loc) · 1.04 KB
/
test_syscalls.pl
File metadata and controls
executable file
·61 lines (50 loc) · 1.04 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#! /usr/bin/perl
# $Header:$
use strict;
use warnings;
use File::Basename;
use FileHandle;
use Getopt::Long;
use IO::File;
use POSIX;
#######################################################################
# Command line switches. #
#######################################################################
my %opts;
sub main
{
Getopt::Long::Configure('no_ignore_case');
usage() unless GetOptions(\%opts,
'help',
);
usage() if ($opts{help});
my $fname = glob("build/driver/syscalls-*.tbl");
my $fh = new FileHandle($fname);
my $str = <<EOF;
int main(int argc, char **argv)
{
EOF
while (<$fh>) {
next if !/^.*defined\(__NR_(.*)\)/;
my $func = $1;
next if $func eq 'exit';
$str .= "\t$1();\n";
}
$str .= " exit(0);\n";
$str .= "}\n";
print $str;
}
#######################################################################
# Print out command line usage. #
#######################################################################
sub usage
{
print <<EOF;
Some help...
Usage:
Switches:
EOF
exit(1);
}
main();
0;