Date: Mon, 18 Oct 1999 15:58:54 +0200 From: Marcel Moolenaar <marcel@scc.nl> To: emulation@FreeBSD.org Subject: Re: duplicate filenames under Linux emulation Message-ID: <380B279E.D4786BEB@scc.nl> References: <380A9278.638D7FC2@freenet.co.uk>, <199910180253.MAA73538@gizmo.internode.com.au>
next in thread | previous in thread | raw e-mail | index | archive | help
Mark Newton wrote: > > Alex wrote: > > > 444964 -rw-r--r-- 1 ak users 102042 Oct 17 20:23 > > bxutils-c.c > > 444964 -rw-r--r-- 1 ak users 102042 Oct 17 20:23 > > bxutils-c.c > > For what it's worth, I have this bug in the to-do list for the > SVR4 emulator too. It's caused by the fact that dirent structures > for BSD and SysVR4 are of different sizes, so svr4_getdents() > (and svr4_getdents64(), its 64-bit counterpart) fetches a buffer > full of BSD dirent structures from disk (usually more than the number > which have actually been requested) with VOP_READDIR(), rewrites them > into another buffer full of svr4_dirent structures, and returns the > contents of the second buffer to userspace. Next time getdents() is > called the emulated version continues from where it left off in the > first buffer until it has been exhaused, at which point it issues another > VOP_READDIR() call to refresh it. The Linuxulator doesn't have that problem. Linux binaries suffer from the duplicate name because glibc (libc5 too?) explicitly calls lseek on the fd of the open directory: Linux-emul(42254): lseek(3, 0, 1) getdents: nbytes=492, off=0 getdents: 29 cookies: 12 24 40 60 72 88 100 120 136 156 176 192 208 228 244 260 280 300 320 336 356 384 400 420 440 456 476 492 512 0(0) - . 12(12) - .. 24(28) - Archive 40(48) - .netscape 60(68) - SCC 72(84) - linux 88(100) - bin 100(116) - Drumming 120(136) - .emacs 136(156) - .Xauthority 156(180) - .signature 176(204) - Sites 192(220) - .ssh 208(236) - axhome 228(256) - GNUstep 244(276) - Docs 260(292) - .xsession 280(312) - Processors 300(336) - .wmmailrc 320(356) - .acrorc 336(376) - .prognet 356(396) - .xsession-errors 384(424) - Div 400(440) - FreeBSD 420(460) - .cvspass 440(12) Linux-emul(42254): lseek(3, 356, 0) Linux-emul(42254): lseek(3, 0, 1) getdents: nbytes=492, off=356 getdents: 29 cookies: 12 24 40 60 72 88 100 120 136 156 176 192 208 228 244 260 280 300 320 336 356 384 400 420 440 456 476 492 512 356(0) - .xsession-errors 384(28) - Div 400(44) - FreeBSD 420(64) - .cvspass 440(84) - .mailrc 456(104) - .profile 476(124) - .rhosts 492(144) - .ssh2 512(332) Linux-emul(42254): lseek(3, 0, 1) getdents: nbytes=492, off=512 getdents: 20 cookies: 532 552 576 592 612 628 648 668 688 708 748 772 804 824 84 8 900 928 960 992 1024 512(0) - .history 532(20) - .Xdefaults 552(44) - .ICEauthority 576(68) - .cshrc 592(88) - .autosave 612(108) - .login 628(128) - Words.aw 648(148) - .mime.types 668(172) - .mailcap 688(192) - Languages 708(212) - RT 748(228) - .xemacs-options 772(256) - .bash_history 804(280) - Repository 824(304) - oracle8i.txt 848(328) - .gimp-1.1 900(348) - odbc_linux.tar.gz 928(376) - Voorstel-1.doc 960(404) - .emacs-places 992(428) - .vacation.msg 1024(40) Linux-emul(42254): lseek(3, 960, 0) Linux-emul(42254): lseek(3, 0, 1) getdents: nbytes=492, off=960 getdents: 20 cookies: 532 552 576 592 612 628 648 668 688 708 748 772 804 824 84 8 900 928 960 992 1024 960(0) - .emacs-places 992(24) - .vacation.msg 1024(444) <<and so on and so forth>> \begin{details} X(Y) - Z X = file offset Y = offset in buffer passed to binary Z = filename X(Y) X = file offset at end of syscall Y = bytes remaining in user buffer The Linux binary showed .xsession-errors and .emacs-places twice. \end{details} > If it does, let me know and I'll fold the result into svr4_getdents() > as well :-) I don't know how it is implemented for svr4, but you may also suffer from lseeks... -- Marcel Moolenaar mailto:marcel@scc.nl SCC Internetworking & Databases http://www.scc.nl/ The FreeBSD project mailto:marcel@FreeBSD.org 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?380B279E.D4786BEB>