Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   sigaction.3p    ( 3 )

изучить и изменить сигнальное действие (examine and change a signal action)

Примеры (Examples)

Establishing a Signal Handler
       The following example demonstrates the use of sigaction() to
       establish a handler for the SIGINT signal.

#include <signal.h>

static void handler(int signum) { /* Take appropriate actions for signal delivery */ }

int main() { struct sigaction sa;

sa.sa_handler = handler; sigemptyset(&sa.sa_mask); sa.sa_flags = SA_RESTART; /* Restart functions if interrupted by handler */ if (sigaction(SIGINT, &sa, NULL) == -1) /* Handle error */;

/* Further code */ }