Back to index

glibc  2.9
Functions
pt-raise.c File Reference
#include <errno.h>
#include <signal.h>
#include <sysdep.h>
#include <tls.h>
#include <kernel-features.h>

Go to the source code of this file.

Functions

int raise (int sig)

Function Documentation

int raise ( int  sig)

Definition at line 28 of file pt-raise.c.

{
#if __ASSUME_TGKILL || defined __NR_tgkill
  /* raise is an async-safe function.  It could be called while the
     fork function temporarily invalidated the PID field.  Adjust for
     that.  */
  pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
  if (__builtin_expect (pid < 0, 0))
    pid = -pid;
#endif

#if __ASSUME_TGKILL
  return INLINE_SYSCALL (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid),
                      sig);
#else
# ifdef __NR_tgkill
  int res = INLINE_SYSCALL (tgkill, 3, pid, THREAD_GETMEM (THREAD_SELF, tid),
                         sig);
  if (res != -1 || errno != ENOSYS)
    return res;
# endif
  return INLINE_SYSCALL (tkill, 2, THREAD_GETMEM (THREAD_SELF, tid), sig);
#endif
}