Jorgen Grahn
2/9/2011 9:33:00 PM
On Wed, 2011-02-09, Richie wrote:
> Howdee,
>
> I've inherited some early 90s code from an unknown Unix-type platform
> that I need to get running. There are lots of problems, but one that's
> bugging me is the following line, which shows up as the first line in main
> () for every executable I've got:
>
> signal(013,1); /* handle memory problems */
>
> I find the programs still regularly coredump and segfault, so whatever
> "handling" this line is doing, it aint working out for me.
>
> Anyone had to deal with this problem before?
Yes, in the sense that I've had to maintain code by long-gone people
who didn't really know what they were doing, but who wouldn't admit
it ;-)
This is probably offtopic because the details of signal(2) here are
Unix-specific, but:
- I suspect this call is more "cargo-cult programming" than something
which actually /helped/ against the "memory problems" (whatever that
means).
- On modern Linux, signal(013,1) is the same as signal(SIGSEGV,
SIG_IGN). I think you'll find these numbers have been stable over
most Unixes. So it's an attempt to ignore segmentation violations ...
- I frankly have no idea what happens if you try something like that,
or what used to happen 20 years ago. Signal handling has varied a bit
between the Unixes.
/Jorgen
--
// Jorgen Grahn <grahn@ Oo o. . .
\X/ snipabacken.se> O o .