… | |
… | |
203 | { |
203 | { |
204 | aio_thread *thr = thr_arg; |
204 | aio_thread *thr = thr_arg; |
205 | aio_req req; |
205 | aio_req req; |
206 | int errno; |
206 | int errno; |
207 | |
207 | |
|
|
208 | /* this is very much x86 and kernel-specific :(:(:( */ |
208 | /* we rely on gcc's ability to create closures. */ |
209 | /* we rely on gcc's ability to create closures. */ |
209 | _syscall3(int,read,int,fd,char *,buf,size_t,count) |
210 | _syscall3(int,read,int,fd,char *,buf,size_t,count) |
210 | _syscall3(int,write,int,fd,char *,buf,size_t,count) |
211 | _syscall3(int,write,int,fd,char *,buf,size_t,count) |
211 | |
212 | |
212 | _syscall3(int,open,char *,pathname,int,flags,mode_t,mode) |
213 | _syscall3(int,open,char *,pathname,int,flags,mode_t,mode) |
213 | _syscall1(int,close,int,fd) |
214 | _syscall1(int,close,int,fd) |
214 | |
215 | |
215 | _syscall4(int,pread,int,fd,char *,buf,size_t,count,off_t,offset) |
216 | _syscall5(int,pread,int,fd,char *,buf,size_t,count,unsigned int,offset_lo,unsigned int,offset_hi) |
216 | _syscall4(int,pwrite,int,fd,char *,buf,size_t,count,off_t,offset) |
217 | _syscall5(int,pwrite,int,fd,char *,buf,size_t,count,unsigned int,offset_lo,unsigned int,offset_hi) |
217 | |
218 | |
218 | _syscall2(int,stat64, const char *, filename, struct stat64 *, buf) |
219 | _syscall2(int,stat64, const char *, filename, struct stat64 *, buf) |
219 | _syscall2(int,lstat64, const char *, filename, struct stat64 *, buf) |
220 | _syscall2(int,lstat64, const char *, filename, struct stat64 *, buf) |
220 | _syscall2(int,fstat64, int, fd, struct stat64 *, buf) |
221 | _syscall2(int,fstat64, int, fd, struct stat64 *, buf) |
221 | |
222 | |
… | |
… | |
226 | { |
227 | { |
227 | req->thread = thr; |
228 | req->thread = thr; |
228 | errno = 0; /* strictly unnecessary */ |
229 | errno = 0; /* strictly unnecessary */ |
229 | |
230 | |
230 | if (req->type == REQ_READ) |
231 | if (req->type == REQ_READ) |
231 | req->result = pread (req->fd, req->dataptr, req->length, req->offset); |
232 | req->result = pread (req->fd, req->dataptr, req->length, req->offset & 0xffffffff, req->offset >> 32); |
232 | else if (req->type == REQ_WRITE) |
233 | else if (req->type == REQ_WRITE) |
233 | req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); |
234 | req->result = pwrite(req->fd, req->dataptr, req->length, req->offset & 0xffffffff, req->offset >> 32); |
234 | else if (req->type == REQ_OPEN) |
235 | else if (req->type == REQ_OPEN) |
235 | req->result = open (req->dataptr, req->fd, req->mode); |
236 | req->result = open (req->dataptr, req->fd, req->mode); |
236 | else if (req->type == REQ_CLOSE) |
237 | else if (req->type == REQ_CLOSE) |
237 | req->result = close (req->fd); |
238 | req->result = close (req->fd); |
238 | else if (req->type == REQ_STAT) |
239 | else if (req->type == REQ_STAT) |