---
name: "stsignal"
section: "3"
platform: "linux"
package: "atfs-dev"
version: "1.4pl6-15+b1"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/stsignal"
---

# stsignal(3)

signal handling

## NAME

stCatchSigs, stInterruptAction, stQuitAction, stTermAction, stCleanup, stExit - signal handling

## SYNOPSIS

\#include \<config.h\>\
 \#include \<sttk.h\>

void	stCatchSigs (void);

Sfunc\_t	(\*stInterruptAction)();

Sfunc\_t	(\*stQuitAction)();

Sfunc\_t	(\*stTermAction)();

void	stCleanup (void);

void	stExit (int exitCode);

## DESCRIPTION

*stCatchSigs* activates a number of interrupt handlers, defined internally in the ShapeTools toolkit library. Interrupt handlers are defined for the signals SIGINT, SIGQUIT, SIGFPE, SIGBUS, SIGSEGV, and SIGTERM. All interrupt handlers, except the one for SIGINT, cause program termination after having done some cleanup work. The cleanup consists of removing all temporary files by calling [stRmRegisteredFiles(3)](/stRmRegisteredFiles/3.md).

Some of the signal handlers are capable to execute functions defined by the application, while handling the interrupt. This mechanism is activated by assigning a functions address to the appropriate variable. The following is a complete List.

- Signal

  Variable

- SIGINT

  *stInterruptAction*

- SIGQUIT

  *stQuitAction*

- SIGTERM

  *stTermAction*

*stCleanup* calls [stRmRegisteredFiles(3)](/stRmRegisteredFiles/3.md) to remove all temporary files and the AtFS function [af\_cleanup(3)](/af_cleanup/3.md) that orders AtFS's affairs.

*stExit* does the same as stCleanup and additionally end the program execution returning *exitCode*.

## SEE ALSO

signal (3), [stRmRegisteredFiles(3)](/stRmRegisteredFiles/3.md), [af\_cleanup(3)](/af_cleanup/3.md).
