Chapter Contents

Previous

Next
SIGSEGV

SIGSEGV



Memory Access Violation


Default handling
Ignoring the signal
Information returned by siginfo
Notes on defining a handler
The SIGSEGV signal is raised when you attempt to illegally access or modify memory. SIGSEGV is usually caused by using uninitialized or NULL pointer values or by memory overlays.


Default handling

By default, SIGSEGV causes program termination with an appropriate ABEND code (0C4 for a protection error or 0C5 for an addressing error).


Ignoring the signal

The SIGSEGV signal cannot be ignored. If you code SIG_IGN as the second argument to signal , the call to signal is rejected.


Information returned by siginfo

If you call siginfo in a handler for SIGSEGV , siginfo returns a pointer to a structure of type SEGV_t . This structure is defined as:

typedef struct {
   int int_code;  /* interrupt code                         */
   char *EPIE;    /* pointer to hardware program check info */
   } SEGV_t;

The fields in this structure are the same as those in the structure type ILL_t ; refer to the description of SIGILL for details on this structure.


Notes on defining a handler

If you define a handler for SIGSEGV , you can call siginfo and test the int_code field of the structure (returned by a call to siginfo ) to determine what error occurred. A handler for SIGSEGV cannot return to the point of interrupt; an attempt to do so causes the program to terminate, as described in the SIGSEGV section, Default handling.

Note:    If the program overlays library control blocks, the SIGSEGV signal may cause an immediate unrecoverable program ABEND, even when a signal handler has been defined.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.