Operating System - OpenVMS
1754849 Members
5560 Online
108827 Solutions
New Discussion юеВ

Re: OpenVMS Perl signals incorrect

 
SOLVED
Go to solution
Tim Yeung_1
Frequent Advisor

OpenVMS Perl signals incorrect

The Perl signals USR1 and USR2 conflict with the ones in DEC C signal.h, so it is difficult for a C program to pass signals to Perl, and vice versa.

For example, in signal.h, USR1 and USR2 signals are defined with values 16 and 17 for DEC C. But the following Perl script shows them to be 17 and 18 instead. The config.pm modules seems to be correct, but for some unknown reason, the USR1 and USR2 signals in Perl ended up with values 17 and 18.

Perl script to list available signals:

#!/usr/bin/perl

use Config;
defined $Config{sig_name} or die "No sigs?";
$i = 0;

foreach $name(split(' ',$Config{sig_name}))
{
$signo{$name} = $i;
$signame{$i} = $name;
print "Sig # ",$i," is named: ",$name,"\n";
$i++;
}

exit(0);
5 REPLIES 5
Joseph Huber_1
Honored Contributor

Re: OpenVMS Perl signals incorrect

In my Perl 5.8.6 config.pm I see USR1 and USR2
as 17 and 18:
sig_name='ZERO HUP INT QUIT ILL TRAP IOT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM ABRT USR1 USR2'

So to make Your C program correctly interacting with Perl, probably config.pm has to be changed:
I would replace IOT by ABRT, and remove ABRT from place 16.
IOT is the BSD name, ABRT is the ANSI C name.
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor

Re: OpenVMS Perl signals incorrect

The essential seems to be in config.pm to also remove the second ",6" in the sig_num and sig_num_init arrays. Here is where the signal-name to number association occurs.
http://www.mpp.mpg.de/~huber
Tim Yeung_1
Frequent Advisor

Re: OpenVMS Perl signals incorrect

What you have described (i.e., modifying config.pm) is essentially what I did to get USR1 and USR2 signals to be 16 and 17. I am wondering if there is a problem with the VMS Perl kit that requires this manual fix-up.

Thanks

Tim
Joseph Huber_1
Honored Contributor

Re: OpenVMS Perl signals incorrect

Not being an expert nor even heavy user,
I don't know if the ABRT signal at sig_num[16]
is intended or not.

config.pm is built from the definitions in the VMS-specific configure.com .

I suggest You go to the vmsperl mailing list and discuss with the experts ?
http://lists.cpan.org/showlist.cgi?name=vmsperl
http://www.mpp.mpg.de/~huber
Joseph Huber_1
Honored Contributor
Solution

Re: OpenVMS Perl signals incorrect


Make all my previous answers VOID !

I think Your (and the config.pm examples) script should not print as "sig #", what in fact is just the index into the sig_name array.
At this index in $Config{sig_num} is the corresponding signal number , which is in sync with DECCs signal.h .
At index 16, name=ABRT is sig_num 6,
index 17, name=USR1 is sig_num 16
index 18, name=USR2 is sig_num 17
All is o.k., and just the legend in the test-script should be changed.
http://www.mpp.mpg.de/~huber