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 / getprio.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  659 b   |  31 lines

  1. #include <errno.h>
  2. #include <sys/resource.h>
  3. #include <sys/syscall.h>
  4.  
  5. #define    PZERO    15
  6.  
  7. int
  8. getpriority(int which, int who)
  9. {
  10.         long res;
  11.  
  12. #if defined(__PIC__) || defined (__pic__)
  13.     __asm__ volatile ("pushl %%ebx\n\t"
  14.               "movl %%edx,%%ebx\n\t"
  15.               "int $0x80\n\t"
  16.               "popl %%ebx"
  17.                 :"=a" (res)
  18.                 :"0" (SYS_getpriority),"d" (which), "c" (who));
  19. #else
  20.         __asm__ volatile ("int $0x80"
  21.                 :"=a" (res)
  22.                 :"0" (SYS_getpriority),"b" (which), "c" (who));
  23. #endif
  24.         if (res >= 0) {
  25.         errno = 0;
  26.                 return (int) PZERO - res;
  27.         }
  28.         errno = -res;
  29.         return -1;
  30. }
  31.