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

  1. #include <fcntl.h>
  2. #include <errno.h>
  3. #include <sys/syscall.h>
  4. #include <stdarg.h>
  5.  
  6. int
  7. __open(const char * filename, int flag, ...)
  8. {
  9.     register int res asm ("d0") = SYS_open;
  10.     va_list arg;
  11.  
  12.     va_start(arg,flag);
  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_open),"g" (filename),"g" (flag),
  19.                  "d" (va_arg(arg,int))
  20.                 : "d0", "d1", "d2", "d3");
  21.     if (res>=0)
  22.         return res;
  23.     errno = -res;
  24.     va_end(arg);
  25.     return -1;
  26. }
  27.