Bug 427194

Summary: `__NR__llseek' undeclared
Product: Red Hat Enterprise Linux 4 Reporter: Shang Jie <shang.jie>
Component: 4SuiteAssignee: Miloslav Trmač <mitr>
Status: CLOSED NOTABUG QA Contact:
Severity: urgent Docs Contact:
Priority: low    
Version: 4.0   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-01-02 08:36:37 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shang Jie 2008-01-02 08:21:09 UTC
Description of problem:
When I complied softwarce(wrttien in C language), some errors were found as
following:

gcc  -I../../include -DSTDC -g    -c gcf_disk.c -o gcf_disk.o
gcf_disk.c: In function `_llseek':
gcf_disk.c:409: error: `__NR__llseek' undeclared (first use in this function)
gcf_disk.c:409: error: (Each undeclared identifier is reported only once
gcf_disk.c:409: error: for each function it appears in.)
make[1]: *** [gcf_disk.o] Error 1

How reproducible:
someway this is difficult to reproduce, but I should declare that the same
problem has been reported to debian Linux on Nov 2004 by someone else and I do
NOT know how they fixed it. I just put some relative code here for you to analyze:
#ifdef LINUX
/* this is a long long! */
loff_t res, byte_request;

int ret;
unsigned long off_high, off_low;
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res, uint, wh);
#endif

Steps to Reproduce:
Actual results:
Expected results:
Additional info:

Comment 1 Shang Jie 2008-01-02 08:27:53 UTC
linux/unistd.h has been included aready!

Comment 2 Miloslav Trmač 2008-01-02 08:36:37 UTC
llseek() does not make sense on a 64-bit platform.

You should use the system call functions provided by glibc; in this case, either
lseek64(), or just a plain lseek() (but note that on 32-bit platforms you'll
need to add preprocessor macros to make off_t 64-bit).

Comment 3 Shang Jie 2008-01-02 09:22:03 UTC
This is what I just find:
$cd /usr/include
$ grep "__NR__" */*.h
asm-i386/unistd.h:#define __NR__llseek          140
asm-i386/unistd.h:#define __NR__newselect               142
asm-i386/unistd.h:#define __NR__sysctl          149
asm-x86_64/unistd.h:#define __NR__sysctl                           156
bits/syscall.h:#define SYS__sysctl __NR__sysctl
bits/syscall.h:#define SYS__llseek __NR__llseek
bits/syscall.h:#define SYS__newselect __NR__newselec

So, why the __NR__llseek just not defined on x86_64 architecture, and which
value I should take? Or I should just find a new method to inplase the
_syscall5. Any ideas?

Comment 4 Shang Jie 2008-01-02 09:27:21 UTC
(In reply to comment #2)
> llseek() does not make sense on a 64-bit platform.
> 
> You should use the system call functions provided by glibc; in this case, either
> lseek64(), or just a plain lseek() (but note that on 32-bit platforms you'll
> need to add preprocessor macros to make off_t 64-bit).
I'm sorry that I haven't seen your reply.
Thank you! I'll have a try.