Perl/sigprocmask.pm

filter: Statementstmt 100% 28 / 28 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 100% 3 / 3 totaltotal 100% 43 / 43 CC 2 SCAR 1.7
CC
2
Cov
100%
_do
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« Perl/Pointer.pm ↑ Summary Perl/TimeSpec.pm »
1 package Linux::Perl::sigprocmask;
2  
3 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 =encoding utf-8
7  
8 =head1 NAME
9  
10 Linux::Perl::sigprocmask
11  
12 =head1 SYNOPSIS
13  
14 # These all return the complete former signal mask (as numbers)
15 # when called in list context.
16 @oldlist = Linux::Perl::sigprocmask->block( 2, 'USR1' );
17  
18 Linux::Perl::sigprocmask->block( 2, 'USR1' );
19  
20 Linux::Perl::sigprocmask->unblock( 2, 'USR1' );
21  
22 Linux::Perl::sigprocmask->set( 2, 'USR1' );
23  
24 =head1 DESCRIPTION
25  
26 An implementation of the kernel’s logic to set the signal mask.
27  
28 =cut
29  
30 6 ▶use parent 'Linux::Perl::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
31  
32 6 ▶use Linux::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 6 ▶use Linux::Perl::SigSet;
Subroutine BEGIN: called CC=1 SCAR=0.0
34  
35 6 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
36 6 _SIG_BLOCK => 0,
37 _SIG_UNBLOCK => 1,
38 _SIG_SETMASK => 2,
39 6 };
40  
41 #----------------------------------------------------------------------
42  
43 =head1 METHODS
44  
45 =head2 I<CLASS>->block( @SIGNALS )
46  
47 Add to the list of currently blocked signals.
48  
49 The return in list context is the group of signals that,
50 prior to this function call, were blocked. (Signals are
51 referenced by number only.)
52  
53 =cut
54  
55 8 ▶sub block {
Subroutine block: called CC=1 SCAR=0.0
Pod documented
56 8 return $_[0]->_do(
57 _SIG_BLOCK(),
58 @_[ 1 .. $#_ ],
59 );
60 }
61  
62 #----------------------------------------------------------------------
63  
64 =head2 I<CLASS>->unblock( @SIGNALS )
65  
66 The inverse of C<block()>.
67  
68 =cut
69  
70 2 ▶sub unblock {
Subroutine unblock: called CC=1 SCAR=0.0
Pod documented
71 2 return $_[0]->_do(
72 _SIG_UNBLOCK(),
73 @_[ 1 .. $#_ ],
74 );
75 }
76  
77 #----------------------------------------------------------------------
78  
79 =head2 I<CLASS>->set( @SIGNALS )
80  
81 Like C<block()> and C<unblock()> but sets/clobbers the entire set
82 of blocked signals.
83  
84 =cut
85  
86 6 ▶sub set {
Subroutine set: called CC=1 SCAR=0.0
Pod documented
87 6 return $_[0]->_do(
88 _SIG_SETMASK(),
89 @_[ 1 .. $#_ ],
90 );
91 }
92  
93 #----------------------------------------------------------------------
94  
95 16 ▶sub _do {
Subroutine _do: called CC=2 SCAR=6.9
96 16 my ($class, $how, @signals) = @_;
97  
98 16 my $mask = Linux::Perl::SigSet::from_list(@signals);
99  
100 16 my $oldmask = "\0" x length($mask);
101  
102 16 my $arch_module = $class->_get_arch_module();
103  
104 16 Linux::Perl::call(
105 $arch_module->NR_rt_sigprocmask(),
106 0 + $how,
107 $mask,
108 $oldmask,
109 length $mask,
110 );
111  
112 16 ▶ return wantarray ? Linux::Perl::SigSet::to_list($oldmask) : undef;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 6 10 16
113 }
114  
115  
116 6 1;
« Perl/Pointer.pm ↑ Summary Perl/TimeSpec.pm »