1 1544f909 2004-12-25 devnull #include <u.h>
2 1544f909 2004-12-25 devnull #include <unistd.h>
3 1544f909 2004-12-25 devnull #include <fcntl.h>
4 1544f909 2004-12-25 devnull #include <libc.h>
5 1544f909 2004-12-25 devnull #include <fcall.h>
6 1544f909 2004-12-25 devnull #include <thread.h>
7 1544f909 2004-12-25 devnull #include "ioproc.h"
9 1544f909 2004-12-25 devnull static long
10 1544f909 2004-12-25 devnull _ioclose(va_list *arg)
14 1544f909 2004-12-25 devnull fd = va_arg(*arg, int);
15 1544f909 2004-12-25 devnull return close(fd);
18 1544f909 2004-12-25 devnull ioclose(Ioproc *io, int fd)
20 1544f909 2004-12-25 devnull return iocall(io, _ioclose, fd);
23 1544f909 2004-12-25 devnull static long
24 1544f909 2004-12-25 devnull _iodial(va_list *arg)
26 1544f909 2004-12-25 devnull char *addr, *local, *dir;
27 1544f909 2004-12-25 devnull int *cdfp, fd;
29 1544f909 2004-12-25 devnull addr = va_arg(*arg, char*);
30 1544f909 2004-12-25 devnull local = va_arg(*arg, char*);
31 1544f909 2004-12-25 devnull dir = va_arg(*arg, char*);
32 1544f909 2004-12-25 devnull cdfp = va_arg(*arg, int*);
34 1544f909 2004-12-25 devnull fd = dial(addr, local, dir, cdfp);
35 1544f909 2004-12-25 devnull return fd;
38 1544f909 2004-12-25 devnull iodial(Ioproc *io, char *addr, char *local, char *dir, int *cdfp)
40 1544f909 2004-12-25 devnull return iocall(io, _iodial, addr, local, dir, cdfp);
43 1544f909 2004-12-25 devnull static long
44 1544f909 2004-12-25 devnull _ioopen(va_list *arg)
46 1544f909 2004-12-25 devnull char *path;
47 1544f909 2004-12-25 devnull int mode;
49 1544f909 2004-12-25 devnull path = va_arg(*arg, char*);
50 1544f909 2004-12-25 devnull mode = va_arg(*arg, int);
51 1544f909 2004-12-25 devnull return open(path, mode);
54 1544f909 2004-12-25 devnull ioopen(Ioproc *io, char *path, int mode)
56 1544f909 2004-12-25 devnull return iocall(io, _ioopen, path, mode);
59 1544f909 2004-12-25 devnull static long
60 1544f909 2004-12-25 devnull _ioread(va_list *arg)
66 1544f909 2004-12-25 devnull fd = va_arg(*arg, int);
67 1544f909 2004-12-25 devnull a = va_arg(*arg, void*);
68 1544f909 2004-12-25 devnull n = va_arg(*arg, long);
69 1544f909 2004-12-25 devnull return read(fd, a, n);
72 1544f909 2004-12-25 devnull ioread(Ioproc *io, int fd, void *a, long n)
74 1544f909 2004-12-25 devnull return iocall(io, _ioread, fd, a, n);
77 1544f909 2004-12-25 devnull static long
78 1544f909 2004-12-25 devnull _ioreadn(va_list *arg)
84 1544f909 2004-12-25 devnull fd = va_arg(*arg, int);
85 1544f909 2004-12-25 devnull a = va_arg(*arg, void*);
86 1544f909 2004-12-25 devnull n = va_arg(*arg, long);
87 1544f909 2004-12-25 devnull n = readn(fd, a, n);
88 1544f909 2004-12-25 devnull return n;
91 1544f909 2004-12-25 devnull ioreadn(Ioproc *io, int fd, void *a, long n)
93 1544f909 2004-12-25 devnull return iocall(io, _ioreadn, fd, a, n);
96 1544f909 2004-12-25 devnull static long
97 1544f909 2004-12-25 devnull _iosleep(va_list *arg)
101 1544f909 2004-12-25 devnull n = va_arg(*arg, long);
102 1544f909 2004-12-25 devnull return sleep(n);
105 1544f909 2004-12-25 devnull iosleep(Ioproc *io, long n)
107 1544f909 2004-12-25 devnull return iocall(io, _iosleep, n);
110 1544f909 2004-12-25 devnull static long
111 1544f909 2004-12-25 devnull _iowrite(va_list *arg)
114 1544f909 2004-12-25 devnull void *a;
115 1544f909 2004-12-25 devnull long n, nn;
117 1544f909 2004-12-25 devnull fd = va_arg(*arg, int);
118 1544f909 2004-12-25 devnull a = va_arg(*arg, void*);
119 1544f909 2004-12-25 devnull n = va_arg(*arg, long);
120 1544f909 2004-12-25 devnull nn = write(fd, a, n);
121 1544f909 2004-12-25 devnull return nn;
124 1544f909 2004-12-25 devnull iowrite(Ioproc *io, int fd, void *a, long n)
126 af89fc10 2005-01-06 devnull n = iocall(io, _iowrite, fd, a, n);
127 af89fc10 2005-01-06 devnull return n;
130 1544f909 2004-12-25 devnull static long
131 1544f909 2004-12-25 devnull _iosendfd(va_list *arg)
133 1544f909 2004-12-25 devnull int n, fd, fd2;
135 1544f909 2004-12-25 devnull fd = va_arg(*arg, int);
136 1544f909 2004-12-25 devnull fd2 = va_arg(*arg, int);
137 1544f909 2004-12-25 devnull n = sendfd(fd, fd2);
138 1544f909 2004-12-25 devnull return n;
141 1544f909 2004-12-25 devnull iosendfd(Ioproc *io, int fd, int fd2)
143 1544f909 2004-12-25 devnull return iocall(io, _iosendfd, fd, fd2);
146 1544f909 2004-12-25 devnull static long
147 1544f909 2004-12-25 devnull _iorecvfd(va_list *arg)
149 1544f909 2004-12-25 devnull int n, fd;
151 1544f909 2004-12-25 devnull fd = va_arg(*arg, int);
152 1544f909 2004-12-25 devnull n = recvfd(fd);
153 1544f909 2004-12-25 devnull return n;
156 1544f909 2004-12-25 devnull iorecvfd(Ioproc *io, int fd)
158 1544f909 2004-12-25 devnull return iocall(io, _iorecvfd, fd);
161 1544f909 2004-12-25 devnull static long
162 1544f909 2004-12-25 devnull _ioread9pmsg(va_list *arg)
165 1544f909 2004-12-25 devnull void *a;
169 1544f909 2004-12-25 devnull fd = va_arg(*arg, int);
170 1544f909 2004-12-25 devnull a = va_arg(*arg, void*);
171 1544f909 2004-12-25 devnull n = va_arg(*arg, int);
172 1544f909 2004-12-25 devnull r = read9pmsg(fd, a, n);
173 1544f909 2004-12-25 devnull return n;
176 1544f909 2004-12-25 devnull ioread9pmsg(Ioproc *io, int fd, void *a, int n)
178 1544f909 2004-12-25 devnull return iocall(io, _ioread9pmsg, fd, a, n);