chiark / gitweb /
[PATCH] klibc: update v0.205
[elogind.git] / klibc / klibc / llseek.c
1 /*
2  * llseek.c
3  *
4  * On 32-bit platforms, we need to use the _llseek() system call
5  * rather than lseek(), to be able to handle large disks.  _llseek()
6  * isn't just a normal syscall which takes a 64-bit argument; it needs
7  * to return a 64-bit value and so takes an extra pointer.
8  */
9
10 #include <unistd.h>
11 #include <sys/syscall.h>
12 #include <bitsize.h>
13
14 #if _BITSIZE == 32
15
16 extern int __llseek(int fd, unsigned long hi, unsigned long lo, off_t *res, int whence);
17
18 off_t lseek(int fd, off_t offset, int whence)
19 {
20   off_t result;
21   int rv;
22
23   rv = __llseek(fd, (unsigned long)(offset >> 32), (unsigned long)offset,
24                 &result, whence);
25   
26   return rv ? (off_t)-1 : result;
27 }
28
29 #endif
30