home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / LIBC / LIBC-4.6 / LIBC-4 / libc-linux / sysdeps / linux / i386 / __sigact.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-30  |  787 b   |  39 lines

  1. #include <syscall.h>
  2. #include <signal.h>
  3. #include <errno.h>
  4.  
  5. extern void ___sig_restore();
  6. extern void ___masksig_restore();
  7.  
  8. int
  9. __sigaction(int sig,struct sigaction * new, struct sigaction * old)
  10. {
  11.     if (new) {
  12.         if (new->sa_flags & SA_NOMASK)
  13.             new->sa_restorer=___sig_restore;
  14.         else
  15.             new->sa_restorer=___masksig_restore;
  16.     }
  17.  
  18. #if defined(__PIC__) || defined (__pic__)
  19.     __asm__ volatile ("pushl %%ebx\n\t"
  20.               "movl %%edi,%%ebx\n\t"
  21.               "int $0x80\n\t"
  22.               "popl %%ebx"
  23.         :"=a" (sig)
  24.         :"0" (SYS_sigaction),"D" (sig),"c" (new),"d" (old));
  25. #else
  26.     __asm__("int $0x80":"=a" (sig)
  27.         :"0" (SYS_sigaction),"b" (sig),"c" (new),"d" (old));
  28. #endif
  29.     if (sig>=0)
  30.         return 0;
  31.     errno = -sig;
  32.     return -1;
  33. }
  34.  
  35. #include <gnu-stabs.h>
  36. #ifdef weak_alias
  37. weak_alias (__sigaction, sigaction);
  38. #endif
  39.