Red Hat Bugzilla – Bug 427194
Last modified: 2008-01-02 04:27:21 EST
Description of problem:
When I complied softwarce(wrttien in C language), some errors were found as
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: *** [gcf_disk.o] Error 1
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:
/* this is a long long! */
loff_t res, byte_request;
unsigned long off_high, off_low;
_syscall5(int, _llseek, uint, fd, ulong, hi, ulong, lo, loff_t *, res, uint, wh);
Steps to Reproduce:
linux/unistd.h has been included aready!
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).
This is what I just find:
$ 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?
(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.