Date: Sat, 23 Sep 2000 13:37:21 -0700 From: Marcel Moolenaar <marcel@cup.hp.com> To: "Mark W. Krentel" <krentel@dreamscape.com> Cc: kuriyama@imgsrc.co.jp, freebsd-emulation@FreeBSD.ORG Subject: Re: Strange phenomen accessing a CDROM contents under linuxerator Message-ID: <39CD1481.993009D2@cup.hp.com> References: <200009232002.QAA37726@dreamscape.com>
next in thread | previous in thread | raw e-mail | index | archive | help
"Mark W. Krentel" wrote: > > I can exhibit the bug with just a loop of readdir(3). This works on > FFS, but on ext2fs and cdrom, readdir prematurely returns NULL. So, I > tried calling getdents(2) directly, and that works. I tried various > buffer sizes from 200 to 20,000 bytes, and they all worked. I even > verified that it wasn't overrunning the buffer. readdir(3) ultimately uses getdents. readdir(2) uses getdents as well. There's some tricky logic in glibc2 WRT readdir(3) that works around incompatibilies in the getdents syscall (IIRC) > So, Marcel, how confident are you that the bug is in linux_getdents? Not. I was still in the "hunch" phase. > I can't find anything wrong in what getdents(2) returns. I think you need to look at the glibc sources. > I don't know > how filesystem cookies work. Is it possible that misuse of cookies > could corrupt something behind the scenes but still have getdents > return a correct buffer? I don't think so. I believe getdents is a read-only operation on the various datastructures. > Since getdents(2) works and readdir(3) doesn't, you'd suspect the > readdir library. But I looked at the source and couldn't find > anything. And /compat/linux/lib and Linux's /lib have identical > libc-2.1.2.so (both based on RH 6.1), and the programs work inside > Linux. It all works on Linux. If it doesn't work for us, we have a problem. > So, I'm really perplexed about where to look. Any suggestions? Try debugging the glibc sources (ie copy the readdir(3) code to some test program and step through it. It will show you where it's returning the NULL prematurely and also why. This will automaticly tell you what the Linuxulator is setting (or resetting) differently than expected. -- Marcel Moolenaar mail: marcel@cup.hp.com / marcel@FreeBSD.org tel: (408) 447-4222 To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-emulation" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?39CD1481.993009D2>