ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Linux-AIO/AIO.xs
(Generate patch)

Comparing Linux-AIO/AIO.xs (file contents):
Revision 1.15 by root, Sat May 18 21:48:36 2002 UTC vs.
Revision 1.16 by root, Wed May 5 10:13:30 2004 UTC

10#include <sched.h> 10#include <sched.h>
11 11
12typedef void *InputStream; /* hack, but 5.6.1 is simply toooo old ;) */ 12typedef void *InputStream; /* hack, but 5.6.1 is simply toooo old ;) */
13typedef void *OutputStream; /* hack, but 5.6.1 is simply toooo old ;) */ 13typedef void *OutputStream; /* hack, but 5.6.1 is simply toooo old ;) */
14typedef void *InOutStream; /* hack, but 5.6.1 is simply toooo old ;) */ 14typedef void *InOutStream; /* hack, but 5.6.1 is simply toooo old ;) */
15
16#ifndef __NR_pread64
17# define __NR_pread64 __NR_pread
18#endif
19#ifndef __NR_pwrite64
20# define __NR_pwrite64 __NR_pwrite
21#endif
15 22
16#define STACKSIZE 1024 /* yeah */ 23#define STACKSIZE 1024 /* yeah */
17 24
18enum { REQ_QUIT, REQ_OPEN, REQ_CLOSE, REQ_READ, REQ_WRITE, REQ_STAT, REQ_LSTAT, REQ_FSTAT}; 25enum { REQ_QUIT, REQ_OPEN, REQ_CLOSE, REQ_READ, REQ_WRITE, REQ_STAT, REQ_LSTAT, REQ_FSTAT};
19 26
211 _syscall3(int,write,int,fd,char *,buf,size_t,count) 218 _syscall3(int,write,int,fd,char *,buf,size_t,count)
212 219
213 _syscall3(int,open,char *,pathname,int,flags,mode_t,mode) 220 _syscall3(int,open,char *,pathname,int,flags,mode_t,mode)
214 _syscall1(int,close,int,fd) 221 _syscall1(int,close,int,fd)
215 222
216 _syscall5(int,pread,int,fd,char *,buf,size_t,count,unsigned int,offset_lo,unsigned int,offset_hi) 223 _syscall5(int,pread64,int,fd,char *,buf,size_t,count,unsigned int,offset_lo,unsigned int,offset_hi)
217 _syscall5(int,pwrite,int,fd,char *,buf,size_t,count,unsigned int,offset_lo,unsigned int,offset_hi) 224 _syscall5(int,pwrite64,int,fd,char *,buf,size_t,count,unsigned int,offset_lo,unsigned int,offset_hi)
218 225
219 _syscall2(int,stat64, const char *, filename, struct stat64 *, buf) 226 _syscall2(int,stat64, const char *, filename, struct stat64 *, buf)
220 _syscall2(int,lstat64, const char *, filename, struct stat64 *, buf) 227 _syscall2(int,lstat64, const char *, filename, struct stat64 *, buf)
221 _syscall2(int,fstat64, int, fd, struct stat64 *, buf) 228 _syscall2(int,fstat64, int, fd, struct stat64 *, buf)
222 229
227 { 234 {
228 req->thread = thr; 235 req->thread = thr;
229 errno = 0; /* strictly unnecessary */ 236 errno = 0; /* strictly unnecessary */
230 237
231 if (req->type == REQ_READ) 238 if (req->type == REQ_READ)
232 req->result = pread (req->fd, req->dataptr, req->length, req->offset & 0xffffffff, req->offset >> 32); 239 req->result = pread64 (req->fd, req->dataptr, req->length, req->offset & 0xffffffff, req->offset >> 32);
233 else if (req->type == REQ_WRITE) 240 else if (req->type == REQ_WRITE)
234 req->result = pwrite(req->fd, req->dataptr, req->length, req->offset & 0xffffffff, req->offset >> 32); 241 req->result = pwrite64(req->fd, req->dataptr, req->length, req->offset & 0xffffffff, req->offset >> 32);
235 else if (req->type == REQ_OPEN) 242 else if (req->type == REQ_OPEN)
236 req->result = open (req->dataptr, req->fd, req->mode); 243 req->result = open (req->dataptr, req->fd, req->mode);
237 else if (req->type == REQ_CLOSE) 244 else if (req->type == REQ_CLOSE)
238 req->result = close (req->fd); 245 req->result = close (req->fd);
239 else if (req->type == REQ_STAT) 246 else if (req->type == REQ_STAT)
240 req->result = stat64 (req->dataptr, req->statdata); 247 req->result = stat64 (req->dataptr, req->statdata);
241 else if (req->type == REQ_LSTAT) 248 else if (req->type == REQ_LSTAT)
242 req->result = lstat64 (req->dataptr, req->statdata); 249 req->result = lstat64 (req->dataptr, req->statdata);
243 else if (req->type == REQ_FSTAT) 250 else if (req->type == REQ_FSTAT)
244 req->result = fstat64 (req->fd, req->statdata); 251 req->result = fstat64 (req->fd, req->statdata);
245 else 252 else
246 { 253 {
247 write (respipe[1], (void *)&req, sizeof (req)); 254 write (respipe[1], (void *)&req, sizeof (req));
248 break; 255 break;
249 } 256 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines