Back to index

glibc  2.9
llseek.c
Go to the documentation of this file.
00001 /* Long-long seek operation.
00002    Copyright (C) 1996-2000,2002,2003 Free Software Foundation, Inc.
00003    This file is part of the GNU C Library.
00004 
00005    The GNU C Library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Lesser General Public
00007    License as published by the Free Software Foundation; either
00008    version 2.1 of the License, or (at your option) any later version.
00009 
00010    The GNU C Library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Lesser General Public License for more details.
00014 
00015    You should have received a copy of the GNU Lesser General Public
00016    License along with the GNU C Library; if not, write to the Free
00017    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00018    02111-1307 USA.  */
00019 
00020 #include <errno.h>
00021 #include <sys/types.h>
00022 
00023 #include <sysdep.h>
00024 #include <sys/syscall.h>
00025 
00026 /* Seek to OFFSET on FD, starting from WHENCE.  */
00027 extern loff_t __llseek (int fd, loff_t offset, int whence);
00028 
00029 loff_t
00030 __llseek (int fd, loff_t offset, int whence)
00031 {
00032   loff_t retval;
00033 
00034   return (loff_t) (INLINE_SYSCALL (_llseek, 5, fd, (off_t) (offset >> 32),
00035                                (off_t) (offset & 0xffffffff),
00036                                __ptrvalue (&retval), whence) ?: retval);
00037 }
00038 weak_alias (__llseek, llseek)
00039 strong_alias (__llseek, __libc_lseek64)
00040 strong_alias (__llseek, __lseek64)
00041 weak_alias (__llseek, lseek64)
00042 
00043 /* llseek doesn't have a prototype.  Since the second parameter is a
00044    64bit type, this results in wrong behaviour if no prototype is
00045    provided.  */
00046 link_warning (llseek, "\
00047 the `llseek' function may be dangerous; use `lseek64' instead.")