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 / m68k / __select.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-19  |  611 b   |  28 lines

  1. #include <errno.h>
  2. #include <sys/syscall.h>
  3. #include <sys/time.h>
  4.  
  5. int
  6. __select(int nd, fd_set * in, fd_set * out, fd_set * ex,
  7.     struct timeval * tv)
  8. {
  9.     register long __res asm ("d0") = SYS_select;
  10. #if defined(__PIC__) || defined (__pic__)
  11.     __asm__ volatile ("pushl %%ebx\n\t"
  12.               "movl %%ecx,%%ebx\n\t"
  13.               "int $0x80\n\t"
  14.               "popl %%ebx"
  15.         : "=a" (__res)
  16.         : "0" (SYS_select),"c" ((long) &nd));
  17. #else
  18.     __asm__ volatile ("movel %2,d1\n\t"
  19.               "trap  #0\n\t"
  20.         : "=g" (__res)
  21.         : "0" (SYS_select),"g" ((long) &nd) : "d0", "d1");
  22. #endif
  23.     if (__res >= 0)
  24.         return (int) __res;
  25.     errno = -__res;
  26.     return -1;
  27. }
  28.