2 * UCW Library -- Large File Support
4 * (c) 1999--2002 Martin Mares <mj@ucw.cz>
6 * This software may be freely distributed and used according to the terms
7 * of the GNU Lesser General Public License.
18 #define ucw_open open64
19 #define ucw_seek lseek64
20 #define ucw_pread pread64
21 #define ucw_pwrite pwrite64
22 #define ucw_ftruncate ftruncate64
23 #define ucw_mmap(a,l,p,f,d,o) mmap64(a,l,p,f,d,o)
24 #define ucw_pread pread64
25 #define ucw_pwrite pwrite64
26 #define ucw_stat stat64
27 #define ucw_fstat fstat64
28 typedef struct stat64 ucw_stat_t;
30 #else /* !CONFIG_LFS */
33 #define ucw_seek(f,o,w) lseek(f,o,w)
34 #define ucw_ftruncate(f,o) ftruncate(f,o)
35 #define ucw_mmap(a,l,p,f,d,o) mmap(a,l,p,f,d,o)
36 #define ucw_pread pread
37 #define ucw_pwrite pwrite
39 #define ucw_fstat fstat
40 typedef struct stat ucw_stat_t;
42 #endif /* !CONFIG_LFS */
44 #if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO > 0)
45 #define ucw_fdatasync fdatasync
47 #define ucw_fdatasync fsync
52 static inline ucw_off_t
53 ucw_file_size(const char *name)
55 int fd = ucw_open(name, O_RDONLY);
57 die("Cannot open %s: %m", name);
58 ucw_off_t len = ucw_seek(fd, 0, SEEK_END);
63 #endif /* !_UCW_LFS_H */