summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoderick Schertler <roderick@gate.net>1997-01-06 15:42:04 -0500
committerChip Salzenberg <chip@atlantic.net>1997-01-08 11:52:00 +1200
commit84e96f2bcc509ba2fb5d2c9608a30cc3cfdea41a (patch)
tree237b23982a9a17b0f6c00bd61d1a42b76d2a0c87
parentb126116e5ae3d57fa007f8a42fd506805b35163b (diff)
downloadperl-84e96f2bcc509ba2fb5d2c9608a30cc3cfdea41a.tar.gz
sigaction() problems
Working out an example of non-restarting syscalls I found three problems. - sigaction warns if there are no flags in the SigAction structure. I think the SigAction constructor should treat the SigSet and flags args as optional. Minimalist patch appended. $ ./perl -MPOSIX=:signal_h -we ' sigaction 2, new POSIX::SigAction sub { }' Use of uninitialized value at -e line 1. $ ./perl -MPOSIX=:signal_h -we ' sigaction 2, new POSIX::SigAction sub { }, undef, 0' $ _ - POSIX::constant warns on an arg-less macro. $ ./perl -MPOSIX=:signal_h -lwe 'print SIGALRM' Use of uninitialized value at /usr/local/lib/perl5/POSIX.pm line 197. 14 $ ./perl -MPOSIX=:signal_h -lwe 'print SIGALRM(0)' 14 $ _ - sigaction doesn't actually work. $ ./perl -MPOSIX=:signal_h -we ' sigaction SIGALRM(0), new POSIX::SigAction sub { die "alarm\n" }, undef, 0; kill "ALRM", $$' SIGALRM handler "CODE(0x223970)" not defined. $ _ p5p-msgid: <12808.852583324@eeyore.ibcinc.com>
-rw-r--r--ext/POSIX/POSIX.pm2
-rw-r--r--ext/POSIX/POSIX.pod5
2 files changed, 4 insertions, 3 deletions
diff --git a/ext/POSIX/POSIX.pm b/ext/POSIX/POSIX.pm
index 22eed0283b..f99b9e7b59 100644
--- a/ext/POSIX/POSIX.pm
+++ b/ext/POSIX/POSIX.pm
@@ -231,7 +231,7 @@ sub unimpl {
package POSIX::SigAction;
sub new {
- bless {HANDLER => $_[1], MASK => $_[2], FLAGS => $_[3]};
+ bless {HANDLER => $_[1], MASK => $_[2], FLAGS => $_[3] || 0}, $_[0];
}
############################
diff --git a/ext/POSIX/POSIX.pod b/ext/POSIX/POSIX.pod
index 2bb8743262..0578d49915 100644
--- a/ext/POSIX/POSIX.pod
+++ b/ext/POSIX/POSIX.pod
@@ -1314,9 +1314,10 @@ Creates a new C<POSIX::SigAction> object which corresponds to the C
C<struct sigaction>. This object will be destroyed automatically when it is
no longer needed. The first parameter is the fully-qualified name of a sub
which is a signal-handler. The second parameter is a C<POSIX::SigSet>
-object. The third parameter contains the C<sa_flags>.
+object, it defaults to the empty set. The third parameter contains the
+C<sa_flags>, it defaults to 0.
- $sigset = POSIX::SigSet->new;
+ $sigset = POSIX::SigSet->new(SIGINT, SIGQUIT);
$sigaction = POSIX::SigAction->new( 'main::handler', $sigset, &POSIX::SA_NOCLDSTOP );
This C<POSIX::SigAction> object should be used with the C<POSIX::sigaction()>