@@ -597,10 +597,37 @@ off_t sys_lseek(int fd, off_t offset, int whence)
597
597
#endif
598
598
}
599
599
600
+ static __attribute__((unused ))
601
+ int sys_llseek (int fd , unsigned long offset_high , unsigned long offset_low ,
602
+ __kernel_loff_t * result , int whence )
603
+ {
604
+ #ifdef __NR_llseek
605
+ return my_syscall5 (__NR_llseek , fd , offset_high , offset_low , result , whence );
606
+ #else
607
+ return __nolibc_enosys (__func__ , fd , offset_high , offset_low , result , whence );
608
+ #endif
609
+ }
610
+
600
611
static __attribute__((unused ))
601
612
off_t lseek (int fd , off_t offset , int whence )
602
613
{
603
- return __sysret (sys_lseek (fd , offset , whence ));
614
+ __kernel_loff_t loff = 0 ;
615
+ off_t result ;
616
+ int ret ;
617
+
618
+ result = sys_lseek (fd , offset , whence );
619
+ if (result == - ENOSYS ) {
620
+ /* Only exists on 32bit where nolibc off_t is also 32bit */
621
+ ret = sys_llseek (fd , 0 , offset , & loff , whence );
622
+ if (ret < 0 )
623
+ result = ret ;
624
+ else if (loff != (off_t )loff )
625
+ result = - EOVERFLOW ;
626
+ else
627
+ result = loff ;
628
+ }
629
+
630
+ return __sysret (result );
604
631
}
605
632
606
633
0 commit comments