2 * llseek.c -- stub calling the llseek system call
4 * Copyright (C) 1994, 1995, 1996 Theodore Ts'o.
7 * This file may be redistributed under the terms of the GNU Public
12 #include <sys/types.h>
18 #include "et/com_err.h"
19 #include "ext2fs/io.h"
29 #else /* HAVE_LLSEEK */
35 #else /* !__alpha__ */
37 #include <linux/unistd.h>
40 #define __NR__llseek 140
43 static int _llseek (unsigned int, unsigned long,
44 unsigned long, ext2_loff_t *, unsigned int);
46 static _syscall5(int,_llseek,unsigned int,fd,unsigned long,offset_high,
47 unsigned long, offset_low,ext2_loff_t *,result,
50 static ext2_loff_t llseek (unsigned int fd, ext2_loff_t offset,
56 retval = _llseek (fd, ((unsigned long long) offset) >> 32,
57 ((unsigned long long) offset) & 0xffffffff,
59 return (retval == -1 ? (ext2_loff_t) retval : result);
62 #endif /* HAVE_LLSEEK */
64 #endif /* __alpha__ */
66 ext2_loff_t ext2fs_llseek (unsigned int fd, ext2_loff_t offset,
70 static int do_compat = 0;
72 if ((sizeof(off_t) >= sizeof(ext2_loff_t)) ||
73 (offset < ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1))))
74 return lseek(fd, (off_t) offset, origin);
81 result = llseek (fd, offset, origin);
82 if (result == -1 && errno == ENOSYS) {
84 * Just in case this code runs on top of an old kernel
85 * which does not support the llseek system call
95 ext2_loff_t ext2fs_llseek (unsigned int fd, ext2_loff_t offset,
98 if ((sizeof(off_t) < sizeof(ext2_loff_t)) &&
99 (offset >= ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1)))) {
103 return lseek (fd, (off_t) offset, origin);