]> mj.ucw.cz Git - libucw.git/blob - lib/lfs.h
ab9d8e7188de3ddec612196278fd76246a674f00
[libucw.git] / lib / lfs.h
1 /*
2  *      Sherlock Library -- Large File Support
3  *
4  *      (c) 1999 Martin Mares, <mj@atrey.karlin.mff.cuni.cz>
5  */
6
7 #ifndef _SHERLOCK_LFS_H
8 #define _SHERLOCK_LFS_H
9
10 #ifdef SHERLOCK_CONFIG_LFS
11
12 #ifndef O_LARGEFILE
13 #if defined(__linux__) && defined(__i386__)
14 #define O_LARGEFILE 0100000
15 #else
16 #error O_LARGEFILE unknown
17 #endif
18 #endif
19
20 #if 0
21
22 /* A "do it yourself" solution */
23
24 #include <asm/unistd.h>
25 #include <errno.h>
26
27 _syscall5(int, _llseek, int, fd, int, hi, int, lo, loff_t *, result, int, whence);
28
29 extern inline loff_t sh_seek(int fd, sh_off_t pos, int whence)
30 {
31   loff_t result;
32   int err;
33
34   err = _llseek(fd, pos >> 32, pos, &result, whence);
35   return (err < 0) ? err : result;
36 }
37 #else
38
39 /* Touching hidden places in glibc */
40 extern loff_t llseek(int fd, loff_t pos, int whence);
41 #define sh_seek(f,o,w) llseek(f,o,w)
42
43 #endif
44
45 #else   /* !SHERLOCK_CONFIG_LFS */
46
47 #define sh_seek(f,o,w) lseek(f,o,w)
48
49 #endif  /* !SHERLOCK_CONFIG_LFS */
50 #endif  /* !_SHERLOCK_LFS_H */