1 /* vi: set sw=4 ts=4: */
3 * llseek/lseek64 syscall for uClibc
5 * Copyright (C) 2002 by Erik Andersen <andersen@codepoet.org>
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Library General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
12 * This program is distributed in the hope that it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License
17 * You should have received a copy of the GNU Library General Public License
18 * along with this program; if not, write to the Free Software Foundation,
19 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #define _LARGEFILE64_SOURCE
27 /* We absolutely do _NOT_ want interfaces silently
28 * renamed under us or very bad things will happen... */
29 #ifdef __USE_FILE_OFFSET64
30 # undef __USE_FILE_OFFSET64
33 #include <sys/types.h>
34 #include <sys/syscall.h>
36 #if defined __NR__llseek && defined __UCLIBC_HAS_LFS__
38 #ifndef INLINE_SYSCALL
39 #define INLINE_SYSCALL(name, nr, args...) __syscall_llseek (args)
40 #define __NR___syscall_llseek __NR__llseek
41 static inline _syscall5(int, __syscall_llseek, int, fd, off_t, offset_hi,
42 off_t, offset_lo, loff_t *, result, int, whence);
45 loff_t __libc_lseek64(int fd, loff_t offset, int whence)
48 return(loff_t)(INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32),
49 (off_t) (offset & 0xffffffff), &result, whence) ?: result);
52 extern __off_t __libc_lseek(int fildes, off_t offset, int whence);
53 libc_hidden_proto(__libc_lseek)
54 loff_t __libc_lseek64(int fd, loff_t offset, int whence)
56 return(loff_t)(__libc_lseek(fd, (off_t) (offset), whence));
59 strong_alias(__libc_lseek64,lseek64)
60 libc_hidden_proto(lseek64)
61 libc_hidden_def(lseek64)
62 //strong_alias(__libc_lseek64,_llseek)