Date: Thu, 19 Feb 2009 21:56:54 +0100 From: Roman Divacky <rdivacky@FreeBSD.org> To: Ed Schouten <ed@80386.nl> Cc: freebsd-emulation@FreeBSD.org Subject: Re: Making Linux stat() less evil Message-ID: <20090219205653.GA78242@freebsd.org> In-Reply-To: <20090219205645.GF19161@hoeg.nl> References: <20090219205645.GF19161@hoeg.nl>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Feb 19, 2009 at 09:56:45PM +0100, Ed Schouten wrote: > Hi folks, > > I may have mentioned this earlier, but our Linuxolator's stat() > implementation calls kern_openat(), followed by an > translate_fd_major_minor() to perform a device major/minor number > lookup. This is very evil, because it causes random chardevs to be > opened when you run ls -l /dev. > > I propose the following patch: > > http://80386.nl/pub/linux-stat.diff > > I've copied kern_stat() into the Linuxolator. Not the ideal solution, > but it's better than what we have right now. Comments? why cant you use kern_statat() and perform this after it returns? + if (S_ISCHR(sb.st_mode) && nd.ni_vp->v_un.vu_cdev != NULL && + linux_driver_get_major_minor( + nd.ni_vp->v_un.vu_cdev->si_name, &major, &minor) == 0) { + sb.st_rdev = (major << 8 | minor); + }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090219205653.GA78242>