Lines Matching +full:sig +full:- +full:dir +full:- +full:cmd
2 # SPDX-License-Identifier: GPL-2.0-only
7 # - Scans dmesg output.
8 # - Walks directory tree and parses each file (for each directory in @DIRS).
10 # Use --debug to output path before parsing, this is useful to find files that
41 # Kernel addresses vary by architecture. We can only auto-detect the following
42 # architectures (using `uname -m`). (flag --32-bit overrides auto-detection.)
55 my $opt_32bit = 0; # Scan 32-bit kernel.
56 my $page_offset_32bit = 0; # Page offset for 32-bit kernel.
61 '/proc/device-tree',
91 -o, --output-raw=<file> Save results for future processing.
92 -i, --input-raw=<file> Read results from file instead of scanning.
93 --raw Show raw results (default).
94 --suppress-dmesg Do not show dmesg results.
95 --squash-by-path Show one result per unique path.
96 --squash-by-filename Show one result per unique filename.
97 --kernel-config-file=<file> Kernel configuration file (e.g /boot/config)
98 --32-bit Scan 32-bit kernel.
99 --page-offset-32-bit=o Page offset (for 32-bit kernel 0xABCD1234).
100 -d, --debug Display debugging output.
101 -h, --help Display this help and exit.
112 'o|output-raw=s' => \$output_raw,
113 'i|input-raw=s' => \$input_raw,
114 'suppress-dmesg' => \$suppress_dmesg,
115 'squash-by-path' => \$squash_by_path,
116 'squash-by-filename' => \$squash_by_filename,
118 'kernel-config-file=s' => \$kernel_config_file,
119 '32-bit' => \$opt_32bit,
120 'page-offset-32-bit=o' => \$page_offset_32bit,
131 printf "\nSummary reporting only available with --input-raw=<file>\n";
132 printf "(First run scan with --output-raw=<file>.)\n";
144 printf("If you are running a 32-bit architecture you may use:\n");
145 printf("\n\t--32-bit or --page-offset-32-bit=<page offset>\n\n");
147 my $archname = `uname -m`;
148 printf("Machine hardware name (`uname -m`): %s\n", $archname);
175 # Allow --32-bit or --page-offset-32-bit to override
185 state $arch = `uname -m`;
197 my $arch = `uname -m`;
227 # Allow --kernel-config-file to override.
230 } elsif (-R "/proc/config.gz") {
240 my $file = '/boot/config-' . `uname -r`;
254 system("rm -f $tmp_file");
324 # Allow --page-offset-32bit to override.
402 open my $cmd, '-|', 'dmesg';
403 while (<$cmd>) {
408 close $cmd;
433 local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required.
449 if (! -R $file) {
453 if (! -T $file) {
483 next if (!opendir(DIR, $pwd));
484 my @files = readdir(DIR);
485 closedir(DIR);
491 next if (-l $path);
494 next if (($path =~ /^\/proc\/[0-9]+$/) &&
501 if (-d $path) {
611 my $lines = $ref->{$_};
644 if (!$cache->{$key}) {
645 $cache->{$key} = ();
647 push @{$cache->{$key}}, $value;