Mailing List Archive

Signal names (Was: Perl 5.001m on HP-UX)
On Mon, 16 Oct 1995, Larry Wall wrote:

> : One thing that you could do is to build a huge list of all the signal
> : names and write a small C program to test what is available, like what
> : is done for the cpp symbols...
>
> You probably want to use as many sources of signal names as you can get
> your hands on, in addition to the "known" signals. A kill -l is likely
> to at least mention any signals not in your list, even if you don't
> know enough about its format to deduce the signal numbers from it.
>
> Then there's strings -3 /bin/kill. Or od -s /bin/kill.

That's pretty twisted, but maybe not as twisted as what I've tried. You
may have to hand edit cppstdin, cppflags, cppminus, and fieldn for your
system, but probably not. Of course, Configure figures them out for you.
This is just a test script.

I've tested this on SunOS 4.1.3. Could folks with other systems check it
out and let me know if it prints a reasonable list of possible symbols. If
this fails, I'll fall back on a big list of signal names.

Then, I'll pass the list of signal names through a script from Raphael to
check which ones are really defined on a particular system with particular
compiler options.

Andy Dougherty doughera@lafcol.lafayette.edu

#!/bin/sh
if test -x /usr/local/bin/cppstdin; then
cppstdin=/usr/local/bin/cppstdin
else
cppstdin='cc -E'
fi
cppminus='-'
cppflags=''
fieldn=3
cat=cat
grep=grep
awk=awk
sed=sed
sort=sort
uniq=uniq

: Generate a list of possible signal names. First, trace out the
: Files included by signal.h, then look for SIGxxx names.
files=` echo '#include <signal.h>' |
$cppstdin $cppminus $cppflags 2>/dev/null |
$grep "^[ ]*#.*include" |
$awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sort | $uniq`

xxx=`awk '
$1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/{
print substr($2, 4, 20)
}
$1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ {
print substr($3, 4, 20)
}' $files`

echo $xxx
Re: Signal names (Was: Perl 5.001m on HP-UX) [ In reply to ]
> I've tested this on SunOS 4.1.3. Could folks with other systems check it
> out and let me know if it prints a reasonable list of possible symbols. If
> this fails, I'll fall back on a big list of signal names.

On HP-UX 9.05, it misses only RESERVE. Strange that it should miss that one.

Jeff
Re: Signal names (Was: Perl 5.001m on HP-UX) [ In reply to ]
On Tue, 17 Oct 1995, Andy Dougherty wrote:

> On Mon, 16 Oct 1995, Larry Wall wrote:
>
> > : One thing that you could do is to build a huge list of all the signal
> > : names and write a small C program to test what is available, like what
> > : is done for the cpp symbols...
> >
> > You probably want to use as many sources of signal names as you can get
> > your hands on, in addition to the "known" signals. A kill -l is likely
> > to at least mention any signals not in your list, even if you don't
> > know enough about its format to deduce the signal numbers from it.
> >
> > Then there's strings -3 /bin/kill. Or od -s /bin/kill.
>
> That's pretty twisted, but maybe not as twisted as what I've tried. You
> may have to hand edit cppstdin, cppflags, cppminus, and fieldn for your
> system, but probably not. Of course, Configure figures them out for you.
> This is just a test script.
>
> I've tested this on SunOS 4.1.3. Could folks with other systems check it
> out and let me know if it prints a reasonable list of possible symbols. If
> this fails, I'll fall back on a big list of signal names.
>
> Then, I'll pass the list of signal names through a script from Raphael to
> check which ones are really defined on a particular system with particular
> compiler options.
>
> Andy Dougherty doughera@lafcol.lafayette.edu

Works on Linux 1.2.x. But note that both CLD and CHLD are included in the
output.

--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
Re: Signal names (Was: Perl 5.001m on HP-UX) [ In reply to ]
Thanks for all the feedback folks.

Just to appease a few worries:

My script printed out B<possible> signal names. A subsequent C program
will check which ones are actually available.

I've modified the script to pick up Solaris thread things such as
RTMAX-1.

Don't worry about the CLD/CHLD stuff. Perl internally handles this anyway.
(Check the lines above the comment /* gag */ in mg.c. :-)

I've decided to modify mg.c to handle multiple names for the same signal
(e.g. ABRT and IOT, POLL and IO, etc.). It looks like that'll be
easier than deciding which name to keep.

Andy Dougherty doughera@lafcol.lafayette.edu
--
To subscribe or unsubscribe, send your request (subscribe, unsubscribe)
in the BODY of a message to perl5-porters-request@africa.nicoh.com.
Re: Signal names (Was: Perl 5.001m on HP-UX) [ In reply to ]
On Wed, 18 Oct 1995, Andy Dougherty wrote:

> Thanks for all the feedback folks.
>
> Just to appease a few worries:
>
> My script printed out B<possible> signal names. A subsequent C program
> will check which ones are actually available.
>
> I've modified the script to pick up Solaris thread things such as
> RTMAX-1.
>
> Don't worry about the CLD/CHLD stuff. Perl internally handles this anyway.
> (Check the lines above the comment /* gag */ in mg.c. :-)
>
> I've decided to modify mg.c to handle multiple names for the same signal
> (e.g. ABRT and IOT, POLL and IO, etc.). It looks like that'll be
> easier than deciding which name to keep.

Thank you. That makes me feel more comfortable. And will "gaps" also be
allowed, so signal numbers don't have to be contiguous?

> Andy Dougherty doughera@lafcol.lafayette.edu
> --
> To subscribe or unsubscribe, send your request (subscribe, unsubscribe)
> in the BODY of a message to perl5-porters-request@africa.nicoh.com.
>
>

--
Kenneth Albanowski (kjahds@kjahds.com, CIS: 70705,126)
Re: Signal names (Was: Perl 5.001m on HP-UX) [ In reply to ]
On Wed, 18 Oct 1995, Kenneth Albanowski wrote:

> Thank you. That makes me feel more comfortable. And will "gaps" also be
> allowed, so signal numbers don't have to be contiguous?

Yes.

Andy Dougherty doughera@lafcol.lafayette.edu