シグナルの到着を待つシステムコールです。シグナルを受信するまでプロセスは停止します。
#include < signal.h >
#include < unistd.h >
#include < stdio.h >
#include < string.h >
static void func_int() {}
int main()
{
struct sigaction act;
sigset_t set;
memset(&act, 0, sizeof act);
act.sa_handler = func_int;
if (sigaction(SIGINT, &act, NULL) < 0){
perror("sigaction");
return 1;
}
sigemptyset(&set);
sigsuspend(&set);
write(2, "SIGINT\n", 7);
return 0;
}