Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 9/08/2022
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Signal Handling on Linux* and macOS

A signal is an abnormal event generated by one of various sources, such as:

  • A user of a terminal.

  • Program or hardware error.

  • Request of another program.

  • When a process is stopped to allow access to the control terminal.

You can optionally set certain events to issue signals, for example:

  • When a process resumes after being stopped

  • When the status of a child process changes

  • When input is ready at the terminal

Some signals terminate the receiving process if no action is taken (optionally creating a core file), while others are simply ignored unless the process has requested otherwise.

Except for certain signals, calling the signal or sigaction routine allows specified signals to be ignored or causes an interrupt (transfer of control) to the location of a user-written signal handler.

You can establish one of the following actions for a signal with a call to signal:

  • Ignore the specified signal (identified by number).

  • Use the default action for the specified signal, which can reset a previously established action.

  • Transfer control from the specified signal to a procedure to receive the signal, specified by name.

Calling the signal routine lets you change the action for a signal, such as intercepting an operating system signal and preventing the process from being stopped.

The table below shows the signals that the Intel® Fortran RTL arranges to catch when a program is started:

Signal

Intel® Fortran RTL message

SIGFPE

Floating-point exception (number 75)

SIGINT

Process interrupted (number 69)

SIGIOT

IOT trap signal (number 76)

SIGQUIT

Process quit (number 79)

SIGSEGV

Segmentation fault (number 174)

SIGTERM

Process killed (number 78)

Calling the signal routine (specifying the numbers for these signals) results in overwriting the signal-handling facility set up by the Intel® Fortran RTL. The only way to restore the default action is to save the returned value from the first call to signal.

When using a debugger, it may be necessary to enter a command to allow the Intel® Fortran RTL to receive and handle the appropriate signals.