Jump to content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

Transition Impacts

Tru64 UNIX Software Transition Kit


» HP STK home
» Home
» Overview
» Tools
» Documentation
» Transition impacts
» Identifier types
» Impact list
» Porting to HP-UX
» Glossary
» Help
» Send us feedback
Site maps
» Tru64 UNIX STK
Content starts here

critical impact:

signal function - behavior difference (CrCh18)

SIG Impacts

Problem description

The behavior for the signal function is different on Tru64 UNIX and HP-UX.

HP-UX follows the traditional System V unreliable signal behavior. This differs from the default Tru64 UNIX behavior in the following ways:

  • On HP-UX, just before the signal handler is invoked, the action for the signal is reset to SIG_DFL. On Tru64 UNIX, the action is not reset. As a result, only the first signal is caught on HP-UX. Depending on the signal's default action, later signals are either ignored or terminate the process.

  • On HP-UX, while the signal handler is executing, other occurrences of the signal are not blocked. On Tru64 UNIX, the other occurrences are blocked. Because of this, you cannot solve the first problem by adding the following statement to the beginning of the signal handler:

    signal(sig, sighandler);

    There is a small window between when the signal handler is invoked and when the statement is actually executed when a second signal could arrive. That signal would trigger the default action and thus either be ignored or terminate the process.

When an application is built in the System V Habitat on Tru64 UNIX, signal follows the HP-UX behavior.

When an application is linked with libbsd on Tru64 UNIX, some system calls are automatically restarted when they are interrupted by the signal handler. They are not restarted with the default Tru64 UNIX signal function or the HP-UX signal function.


C/C++ Functionssignal          

See also

Solution description

Use the sigaction function.

New behavior

struct sigaction sa;
sa.sa_handler = handler;
sa.sa_flags = 0;
#ifdef _BSD
sa.sa_flags |= SA_RESTART;
if (sigaction(SIGCHLD, &sa, NULL) < 0)

See also

Problem summary

classifications source types OS release severity type
SIG C, C++ any HP-UX 11i version critical changed
Printable version
Privacy statement Using this site means you accept its terms Feedback to DSPP
© 2007 Hewlett-Packard Development Company, L.P.