PowerAda Interrupts

From OC Systems Wiki!
< PowerAda:Implementation Details
Revision as of 00:35, 25 April 2019 by imported>WikiVisor (Text replacement - """ to """)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The PowerAda compiler supports interrupt entries through the AIX signal mechanism. In the Ada language, interrupts are treated as if they are rendezvous. An Ada task waits at an accept statement that has been previously linked to a given signal. When the signal is sent, the program causes a rendezvous with the task, just as if another Ada task had called the entry.

AIX signals may also be attached to protected subprograms using the Ada95 pragmas Interrupt_Handler and Attach_Handler. This is the preferred mechanism for handling signals in Ada95.

AIX Interrupts

The AIX operating system Version 4 provides 63 signals that have predefined meanings, as described under the signal system call in AIX Calls and Subroutines Reference for IBM RISC System/6000.

POSIX Signals

PowerAda supports interrupt handlers as protected procedure handlers (see Annex C of the Ada95 Reference Manual) or as interrupt task entries. In AIX, signals are equivalent to interrupts.

The Signal names to use in attaching a signal to a protected procedure are defined in the package Ada.Interrupts.Names and correspond to the AIX names for the signals (e.g., SIGINT, SIGQUIT, SIGUSR1, etc).

A task entry may be associated with a single AIX signal, by providing an address clause for the entry. The proper interrupt entry addresses for each POSIX signal is provided in the package POSIX_Signals.

For the signal SIGABRT, use POSIX_Signals.Signal_Abort_Ref.
For the signal SIGHUP, use POSIX_Signals.Signal_Hangup_Ref.
For the signal SIGINT, use POSIX_Signals.Signal_Interrupt_Ref.
For the signal SIGPIPE, use POSIX_Signals.Signal_Pipe_Write_Ref.
For the signal SIGQUIT, use POSIX_Signals.Signal_Quit_Ref.
For the signal SIGTERM, use POSIX_Signals.Signal_Terminate_Ref.
For the signal SIGUSR1, use POSIX_Signals.Signal_User_1_Ref.
For the signal SIGUSR2, use POSIX_Signals.Signal_User_2_Ref.
For the signal SIGCHLD, use POSIX_Signals.Signal_Child_Ref.
For the signal SIGCONT, use POSIX_Signals.Signal_Continue_Ref.
For the signal SIGTSTP, use POSIX_Signals.Signal_Terminal_Stop_Ref.
For the signal SIGTTIN, use POSIX_Signals.Signal_Terminal_Input_Ref.
For the signal SIGTTOU, use POSIX_Signals.Signal_Terminal_Output_Ref.

For example, to declare an interrupt entry to handle the SIGINT interrupt signal:

entry HANDLE_INTERRUPT_REQUEST;
for HANDLE_INTERRUPT_REQUEST
  use at POSIX_SIGNALS.SIGNAL_INTERRUPT_REF;

In addition to the named address constants for interrupt entries, the package POSIX_Signals provides:

  • constants that identify individual POSIX signals,
  • services for sending signals to POSIX processes, and
  • services for blocking, unblocking, and ignoring signals.

A complete specification of the package POSIX_Signals may be found in Posix Ada Language Interfaces (IEEE Std 1003.5-1992), and Appendix B, "POSIX/Ada Packages"