Making Linux stat() less evil

Ed Schouten ed at 80386.nl
Thu Feb 19 13:10:02 PST 2009


* Roman Divacky <rdivacky at FreeBSD.org> wrote:
> 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);
> +		}

Because I want to use the vnode used by kern_statat() directly. If we
perform a second lookup after the call to kern_statat(), it's a race.
There is no guarantee you're looking at the same vnode.

-- 
 Ed Schouten <ed at 80386.nl>
 WWW: http://80386.nl/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-emulation/attachments/20090219/a702a6eb/attachment.pgp


More information about the freebsd-emulation mailing list