Ask a Question related to PERL Miscellaneous, Design and Development.
-
bob #1
POSIX module sig handlers vs default
Hi,
I have been reading Interprocess Communication in the Camel book 3rd ed,
and doing a lot of experimenting with IO::Socket::INET in at least one
example I found it uses the POSIX module to create single handlers. Here
is one example I am using now that seems to work:
my $sigset = POSIX::SigSet->new();
my $action = POSIX::SigAction->new('sigHUP_handler',
$sigset,
&POSIX::SA_NODEFER);
my $action_alrm = POSIX::SigAction->new('sigALRM_handler',
$sigset,
&POSIX::SA_NODEFER);
POSIX::sigaction(&POSIX::SIGHUP, $action);
POSIX::sigaction(&POSIX::SIGALRM, $action_alrm);
sub sigHUP_handler {
print "got SIGHUP\n";
exec($SELF, @ARGV) or die "Couldn't restart: $!\n";
}
sub sigALRM_handler {
print "got ALARM timeout\n";
}
So my question is what is different, about this vs using the much more
simple looking example below?
$SIG{CHLD} = \&REAPER;
sub REAPER {
$SIG{CHLD} = \&REAPER; # loathe sysV
$waitedpid = wait;
logmsg "reaped $waitedpid" . ($? ? " with exit $?" : '');
}
I have made, as in Dr. Franenstiem made the below script, but I am not
sure if I should handle this child cleanup by this simpler looking way,
or the POSIX way. The other thing that worries me on this, is that the
simple method is from an example using Socket whereas I am using the
higherlevel IO::SOCKET. Does that matter? I mean a single is a single
right?
Thanks,
Eric
bob Guest
-
POSIX::ctermid()
Hi, I just installed a fresh 5.8.3 and noticed that POSIX::ctermid() does not seem to work (all tests were reported as successful during "make... -
POSIX::getchar
What am I doing wrong? Here are 3 attempts at trying to use getchar. It seems I am following the Usage, but I guess not. $ perl -e 'use... -
POSIX seteuid and similar
Hi, I am trying to create a small php program where I can control users processes. As far as I see I require Apache to run as root in order to... -
Posix queues
I have problems with removing queues. Manual says that mq_unlink does not remove named queue before all references are released. While developing my... -
Standard Posix
Hi! I'am working on Solaris 5.8. My bosss prohibited using comand compress because he said "It's not standard" , but wich standard ? He didn't say...



Reply With Quote

