* Copyright (C) 1994, 1995, 1996, 1997 Theodore Ts'o.
*
* %Begin-Header%
- * This file may be redistributed under the terms of the GNU Public
- * License.
+ * This file may be redistributed under the terms of the GNU Library
+ * General Public License, version 2.
* %End-Header%
*/
#define _LARGEFILE_SOURCE
#define _LARGEFILE64_SOURCE
+#include "config.h"
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#define my_llseek lseek64
-#elif defined(HAVE_LLSEEK)
+#else
+#if defined(HAVE_LLSEEK)
#include <syscall.h>
#ifndef HAVE_LLSEEK_PROTOTYPE
#else /* ! HAVE_LLSEEK */
-#if defined(__alpha__) || defined (__ia64__)
+#if SIZEOF_LONG == SIZEOF_LONG_LONG
#define llseek lseek
-#else /* !__alpha__ && !__ia64__*/
+#else /* SIZEOF_LONG != SIZEOF_LONG_LONG */
#include <linux/unistd.h>
#ifndef __i386__
retval = _llseek(fd, ((unsigned long long) offset) >> 32,
-#else
+#else
retval = syscall(__NR__llseek, fd, (unsigned long long) (offset >> 32),
#endif
((unsigned long long) offset) & 0xffffffff,
#endif /* __alpha__ || __ia64__ */
#endif /* HAVE_LLSEEK */
+#endif /* defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE) */
ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin)
{
errno = EINVAL;
return -1;
}
-
+
result = my_llseek (fd, offset, origin);
if (result == -1 && errno == ENOSYS) {
/*
ext2_loff_t ext2fs_llseek (int fd, ext2_loff_t offset, int origin)
{
+#if defined(HAVE_LSEEK64) && defined(HAVE_LSEEK64_PROTOTYPE)
+ return lseek64 (fd, offset, origin);
+#else
if ((sizeof(off_t) < sizeof(ext2_loff_t)) &&
(offset >= ((ext2_loff_t) 1 << ((sizeof(off_t)*8) -1)))) {
errno = EINVAL;
return -1;
}
return lseek (fd, (off_t) offset, origin);
+#endif
}
#endif /* linux */