chiark / gitweb /
[PATCH] added klibc version 0.82 (cvs tree) to the udev tree.
[elogind.git] / klibc / klibc / arch / alpha / pipe.c
1 #include <unistd.h>
2 #include <sys/syscall.h>
3
4 /* pipe() on alpha returns both file descriptors in registers --
5    $0 and $20 respectively.  This is unlike any other system call,
6    as far as I can tell. */
7
8 int pipe(int *fds)
9 {
10   register long sc_0 __asm__("$0");
11   register long sc_19 __asm__("$19");
12   register long sc_20 __asm__("$20");
13
14   sc_0 = __NR_pipe;
15   asm volatile("callsys" : "=r" (sc_0), "=r" (sc_19), "=r" (sc_20)
16                : "0" (sc_0)
17                : _syscall_clobbers);
18   
19   if ( sc_19 ) {
20     errno = sc_19;
21     return -1;
22   }
23
24   fds[0] = sc_0;
25   fds[1] = sc_20;
26
27   return 0;
28 }