… | |
… | |
8 | #include <sys/stat.h> |
8 | #include <sys/stat.h> |
9 | #include <unistd.h> |
9 | #include <unistd.h> |
10 | #include <fcntl.h> |
10 | #include <fcntl.h> |
11 | #include <signal.h> |
11 | #include <signal.h> |
12 | #include <sched.h> |
12 | #include <sched.h> |
|
|
13 | #include <endian.h> |
13 | |
14 | |
14 | typedef void *InputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
15 | typedef void *InputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
15 | typedef void *OutputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
16 | typedef void *OutputStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
16 | typedef void *InOutStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
17 | typedef void *InOutStream; /* hack, but 5.6.1 is simply toooo old ;) */ |
17 | |
18 | |
… | |
… | |
233 | |
234 | |
234 | #undef errno |
235 | #undef errno |
235 | #include <asm/unistd.h> |
236 | #include <asm/unistd.h> |
236 | #include <sys/prctl.h> |
237 | #include <sys/prctl.h> |
237 | |
238 | |
|
|
239 | #if BYTE_ORDER == LITTLE_ENDIAN |
|
|
240 | # define LONG_LONG_PAIR(HI, LO) LO, HI |
|
|
241 | #elif BYTE_ORDER == BIG_ENDIAN |
|
|
242 | # define LONG_LONG_PAIR(HI, LO) HI, LO |
|
|
243 | #endif |
|
|
244 | |
238 | #if __alpha || __ia64 || __hppa || __sparc64__ || __v850__ |
245 | #if __alpha || __ia64 || __hppa || __v850__ |
239 | # define stat kernelstat |
246 | # define stat kernelstat |
240 | # define stat64 kernelstat64 |
247 | # define stat64 kernelstat64 |
241 | # include <asm/stat.h> |
248 | # include <asm/stat.h> |
242 | # undef stat |
249 | # undef stat |
243 | # undef stat64 |
250 | # undef stat64 |
… | |
… | |
275 | |
282 | |
276 | _syscall3(int,open,char *,pathname,int,flags,mode_t,mode) |
283 | _syscall3(int,open,char *,pathname,int,flags,mode_t,mode) |
277 | _syscall1(int,close,int,fd) |
284 | _syscall1(int,close,int,fd) |
278 | |
285 | |
279 | #if __NR_pread64 |
286 | #if __NR_pread64 |
280 | _syscall5(int,pread64,int,fd,char *,buf,size_t,count,unsigned int,offset_lo,unsigned int,offset_hi) |
287 | _syscall5(int,pread64,int,fd,char *,buf,size_t,count,unsigned int,offset_lh,unsigned int,offset_hl) |
281 | _syscall5(int,pwrite64,int,fd,char *,buf,size_t,count,unsigned int,offset_lo,unsigned int,offset_hi) |
288 | _syscall5(int,pwrite64,int,fd,char *,buf,size_t,count,unsigned int,offset_lh,unsigned int,offset_hl) |
282 | #elif __NR_pread |
289 | #elif __NR_pread |
283 | _syscall4(int,pread,int,fd,char *,buf,size_t,count,offset_t,offset) |
290 | _syscall4(int,pread,int,fd,char *,buf,size_t,count,offset_t,offset) |
284 | _syscall4(int,pwrite,int,fd,char *,buf,size_t,count,offset_t,offset) |
291 | _syscall4(int,pwrite,int,fd,char *,buf,size_t,count,offset_t,offset) |
285 | #else |
292 | #else |
286 | # error "neither pread nor pread64 defined" |
293 | # error "neither pread nor pread64 defined" |
… | |
… | |
311 | errno = 0; /* strictly unnecessary */ |
318 | errno = 0; /* strictly unnecessary */ |
312 | |
319 | |
313 | switch (req->type) |
320 | switch (req->type) |
314 | { |
321 | { |
315 | #if __NR_pread64 |
322 | #if __NR_pread64 |
316 | case REQ_READ: req->result = pread64 (req->fd, req->dataptr, req->length, req->offset & 0xffffffff, req->offset >> 32); break; |
323 | case REQ_READ: req->result = pread64 (req->fd, req->dataptr, req->length, |
|
|
324 | LONG_LONG_PAIR (req->offset >> 32, req->offset & 0xffffffff)); break; |
317 | case REQ_WRITE: req->result = pwrite64(req->fd, req->dataptr, req->length, req->offset & 0xffffffff, req->offset >> 32); break; |
325 | case REQ_WRITE: req->result = pwrite64(req->fd, req->dataptr, req->length, |
|
|
326 | LONG_LONG_PAIR (req->offset >> 32, req->offset & 0xffffffff)); break; |
318 | #else |
327 | #else |
319 | case REQ_READ: req->result = pread (req->fd, req->dataptr, req->length, req->offset); break; |
328 | case REQ_READ: req->result = pread (req->fd, req->dataptr, req->length, req->offset); break; |
320 | case REQ_WRITE: req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); break; |
329 | case REQ_WRITE: req->result = pwrite (req->fd, req->dataptr, req->length, req->offset); break; |
321 | #endif |
330 | #endif |
322 | #if __NR_stat64 |
331 | #if __NR_stat64 |