[<prev] [next>] [day] [month] [year] [list]
Message-ID: <4F16221F.6060304@ixiacom.com>
Date: Tue, 17 Jan 2012 17:36:31 -0800
From: Earl Chew <echew@...acom.com>
To: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Advice for 32 bit compatibility problem with pread(2) on x86_64
pread(2) in 32 bit mode (x86_64) seems to leave the file in a crummy state
causing the next pread(2) to fail.
I'd like a hint as to where to look for the root cause.
I'm running:
Linux ixbu-lnxbld-vm 2.6.32-33-generic #72-Ubuntu SMP Fri Jul 29 21:07:13 UTC 2011 x86_64 GNU/Linux
Here is the test program (use syscall() to try give glibc an alibi):
> #include <fcntl.h>
> #include <sys/syscall.h>
>
>
> int main()
> {
> char buf[8192];
> int fd = open("/proc/self/maps", O_RDONLY);
>
> syscall(SYS_pread64, fd, buf, 8192, 0, 0);
> syscall(SYS_pread64, fd, buf, 8192, 0, 0);
>
> return 0;
> }
Compiling with -m32 and running with strace(), the 2nd pread() return zero !
> open("/proc/self/maps", O_RDONLY) = 3
> pread64(3, "08048000-08049000 r-xp 00000000 "..., 8192, 0) = 1189
> pread64(3, "", 8192, 0) = 0
Compiling for 64 bit I get the expected:
> open("/proc/self/maps", O_RDONLY) = 3
> pread(3, "00400000-00401000 r-xp 00000000 "..., 8192, 0) = 1332
> pread(3, "00400000-00401000 r-xp 00000000 "..., 8192, 0) = 1332
Huh ?
Earl
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists