2011年3月15日 星期二

building lmbench

Missing llseek
http://lists.busybox.net/pipermail/uclibc/2006-May/036273.html

> >> I've just been trying to build lmbench[1] with uClibc. The build fails
> >> with an undefined reference to "llseek". uClibc doesn't provide this
> >> symbol, and I'm not sure if it should do as it isn't in any header
> >> file. Does anyone have an opinion on whether or not uClibc should
> >> provide this?
> >
> >uClibc provides it under the name lseek64.
>
> That doesn't answer my question. I know how to get at the
> functionality, but lmbench and therefore perhaps others, expect it to
> be called "llseek". Is this a bug?
It's a bug in lmbench. The program should use lseek and the compiler
options (as reported by confstr()) to make sure file offsets are 64bit
or larger. Both lseek64 and llseek are nonstandard and incorrect to
use.


http://blackfin.uclinux.org/gf/project/uclinux-dist/scmsvn/?action=browse&path=%2Ftrunk%2Fuser%2Fblkfin-apps%2Flmbench3%2Fsrc%2Fdisk.c&r1=1516&r2=5279
--- trunk/user/blkfin-apps/lmbench3/src/disk.c 2005/11/16 09:47:07 1516
+++ trunk/user/blkfin-apps/lmbench3/src/disk.c 2007/05/15 04:02:24 5279
@@ -285,12 +285,28 @@

#define BIGSEEK (1<<30)

+#ifdef __linux__
+
+#ifndef __NR__llseek
+#define __NR__llseek 140
+#endif
+
+static loff_t llseek (int fd, loff_t offset, int origin)
+{
+ loff_t result;
+ int retval;
+
+ retval = syscall(__NR__llseek, fd, (unsigned long long) (offset >> 32),
+ ((unsigned long long) offset) & 0xffffffff,
+ &result, origin);
+ return (retval == -1 ? (loff_t) retval : result);
+}
+#endif
+
int
seekto(int fd, uint64 off)
{
#ifdef __linux__
- extern loff_t llseek(int, loff_t, int);
-
if (llseek(fd, (loff_t)off, SEEK_SET) == (loff_t)-1) {
return(-1);
}

http://blackfin.uclinux.org/gf/project/uclinux-dist/scmsvn/?action=browse&path=%2Fbranches%2F2007R1%2Fuser%2Fblkfin-apps%2Flmbench3%2Fsrc%2Fdisk.c&r1=5035&r2=5280

沒有留言: