blob: ff16917e2ee7b1edd4f6ebb9d95726425dcc31c1 [file] [log] [blame]
yuezonghe824eb0c2024-06-27 02:32:26 -07001/* vi: set sw=4 ts=4: */
2/*
3 * llseek/lseek64 syscall for uClibc
4 *
5 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
6 *
7 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
8 */
9
10#include <unistd.h>
11#include <sys/types.h>
12#include <sys/syscall.h>
13
14/* Newer kernel ports have llseek() instead of _llseek() */
15#if !defined __NR__llseek && defined __NR_llseek
16# define __NR__llseek __NR_llseek
17#endif
18
19#if defined __NR__llseek && defined __UCLIBC_HAS_LFS__
20
21loff_t lseek64(int fd, loff_t offset, int whence)
22{
23 loff_t result;
24 return (loff_t)(INLINE_SYSCALL(_llseek, 5, fd, (off_t) (offset >> 32),
25 (off_t) (offset & 0xffffffff), &result, whence) ?: result);
26}
27
28#else
29
30loff_t lseek64(int fd, loff_t offset, int whence)
31{
32 return (loff_t)(lseek(fd, (off_t) (offset), whence));
33}
34
35#endif
36
37#ifndef __LINUXTHREADS_OLD__
38libc_hidden_def(lseek64)
39#else
40libc_hidden_weak(lseek64)
41strong_alias(lseek64,__libc_lseek64)
42#endif