Back to index

glibc  2.9
Functions
sigintr.c File Reference
#include <stddef.h>
#include <signal.h>
#include <errno.h>

Go to the source code of this file.

Functions

int siginterrupt (int sig, int interrupt)

Function Documentation

int siginterrupt ( int  sig,
int  interrupt 
)

Definition at line 27 of file sigintr.c.

{
#ifdef SA_RESTART
  extern sigset_t _sigintr attribute_hidden;     /* Defined in signal.c.  */
  struct sigaction action;

  if (__sigaction (sig, (struct sigaction *) NULL, &action) < 0)
    return -1;

  if (interrupt)
    {
      __sigaddset (&_sigintr, sig);
      action.sa_flags &= ~SA_RESTART;
    }
  else
    {
      __sigdelset (&_sigintr, sig);
      action.sa_flags |= SA_RESTART;
    }

  if (__sigaction (sig, &action, (struct sigaction *) NULL) < 0)
    return -1;

  return 0;
#else
  __set_errno (ENOSYS);
  return -1;
#endif
}