From 0da33d97a8c20125922b5967988a2849d801ca0c Mon Sep 17 00:00:00 2001 From: Allain Legacy Date: Fri, 28 Sep 2018 02:28:30 +0800 Subject: --- libparted/arch/linux.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c index 6e78faf..27f706b 100644 --- a/libparted/arch/linux.c +++ b/libparted/arch/linux.c @@ -1673,12 +1673,14 @@ _device_close (PedDevice* dev) #if SIZEOF_OFF_T < 8 +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) static _syscall5(int,_llseek, unsigned int, fd, unsigned long, offset_high, unsigned long, offset_low, loff_t*, result, unsigned int, origin) +#endif loff_t llseek (unsigned int fd, loff_t offset, unsigned int whence) @@ -1686,11 +1688,20 @@ llseek (unsigned int fd, loff_t offset, unsigned int whence) loff_t result; int retval; +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) retval = _llseek(fd, ((unsigned long long)offset) >> 32, ((unsigned long long)offset) & 0xffffffff, &result, whence); +#else + retval = syscall(__NR__llseek, fd, + ((unsigned long long)offset) >> 32, + ((unsigned long long)offset) & 0xffffffff, + &result, + whence); +#endif + return (retval==-1 ? (loff_t) retval : result); } -- 2.7.4