Lines Matching +full:sub +full:- +full:function
2 # SPDX-License-Identifier: GPL-2.0
18 my $jobs = {}; # child process pid -> file handle
20 my $results = {}; # object index -> [ { level, secname }, ... ]
24 sub get_online_processors {
39 sub write_results {
45 my $level = $initcalls->{$counter}->{'level'};
47 # section name for the initcall function
48 my $secname = $initcalls->{$counter}->{'module'} . '__' .
50 $initcalls->{$counter}->{'line'} . '_' .
51 $initcalls->{$counter}->{'function'};
58 sub read_results{
83 if (!exists($results->{$index})) {
84 $results->{$index} = [];
87 push (@{$results->{$index}}, {
97 sub find_initcalls {
100 die "$0: ERROR: file $file doesn't exist?" if (! -f $file);
102 open(my $fh, "\"$nm\" --defined-only \"$file\" 2>/dev/null |")
122 /[a-z]\s+__initcall__(\S*)__(\d+)_(\d+)_(.*)$/;
135 my ($function, $level) = $symbol =~
136 /^(.*)((early|rootfs|con|[0-9])s?)$/;
139 if (!defined($function) || !defined($level));
141 $initcalls->{$counter} = {
144 'function' => $function,
155 sub wait_for_results {
161 foreach my $fh ($select->can_read(0)) {
167 $pid = waitpid(-1, WNOHANG);
169 if (!exists($jobs->{$pid})) {
173 my $fh = $jobs->{$pid};
174 $select->remove($fh);
181 delete($jobs->{$pid});
188 sub process_files {
191 my $select = IO::Select->new();
195 my $pid = open(my $fh, '-|');
201 $select->add($fh);
202 $jobs->{$pid} = $fh;
205 STDOUT->autoflush(1);
224 sub generate_initcall_lds() {
227 my $sections = {}; # level -> [ secname, ...]
232 foreach my $result (@{$results->{$index}}) {
233 my $level = $result->{'level'};
235 if (!exists($sections->{$level})) {
236 $sections->{$level} = [];
239 push(@{$sections->{$level}}, $result->{'secname'});
260 foreach my $secname (@{$sections->{$level}}) {