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 / __fcntl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-19  |  526 b   |  26 lines

  1. #include <fcntl.h>
  2. #include <errno.h>
  3. #include <sys/syscall.h>
  4. #include <stdarg.h>
  5.  
  6. int
  7. __fcntl(int fildes, int cmd, ...)
  8. {
  9.     register int res asm ("d0") = SYS_fcntl;
  10.     va_list arg;
  11.  
  12.     va_start(arg,cmd);
  13.     __asm__("movel %2,d1\n\t"
  14.                 "movel %3,d2\n\t"
  15.                 "movel %4,d3\n\t"
  16.                 "trap #0\n\t"
  17.         :"=g" (res)
  18.         :"0" (SYS_fcntl),"g" (fildes),"g" (cmd), "d" (va_arg(arg,int))
  19.                 : "d0", "d1", "d2", "d3");
  20.     if (res>=0)
  21.         return res;
  22.     errno = -res;
  23.     va_end (arg);
  24.     return -1;
  25. } /*  */
  26.