freebsd-dev/sys/compat
Ed Schouten 0eee862a54 Don't make Linux stat() open character devices to resolve its name.
The existing code calls kern_open() to resolve the vnode of a pathname
right after a stat(). This is not correct, because it causes random
character devices to be opened in /dev. This means ls'ing a tape
streamer will cause it to rewind, for example. Changes I have made:

- Add kern_statat_vnhook() to allow binary emulators to `post-process'
  struct stat, using the proper vnode.

- Remove unneeded printf's from stat() and statfs().

- Make the Linuxolator use kern_statat_vnhook(), replacing
  translate_path_major_minor_at().

- Let translate_fd_major_minor() use vp->v_rdev instead of
  vp->v_un.vu_cdev.

Result:

	crw-rw-rw- 1 root root   0, 14 Feb 20 13:54 /dev/ptmx
	crw--w---- 1 root adm  136,  0 Feb 20 14:03 /dev/pts/0
	crw--w---- 1 root adm  136,  1 Feb 20 14:02 /dev/pts/1
	crw--w---- 1 ed   tty  136,  2 Feb 20 14:03 /dev/pts/2

Before this commit, ptmx also had a major number of 136, because it
silently allocated and deallocated a pseudo-terminal. Device nodes that
cannot be opened now have proper major/minor-numbers.

Reviewed by:	kib, netchild, rdivacky (thanks!)
2009-02-20 13:05:29 +00:00
..
freebsd32 Push down Giant inside sysctl. Also add some more assertions to the code. 2008-12-29 12:58:45 +00:00
ia32 Add sv_flags field to struct sysentvec with intention to provide description 2008-11-22 12:36:15 +00:00
linprocfs Fix a bug in the previous change to the mtab handler: use the path returned 2009-02-13 15:32:03 +00:00
linsysfs Add a pn_destroy field to pfs_node. This field points to a destructor 2007-03-12 12:16:52 +00:00
linux Don't make Linux stat() open character devices to resolve its name. 2009-02-20 13:05:29 +00:00
ndis Change some movl's to mov's. Newer GAS no longer accept 'movl' instructions 2009-01-31 11:37:21 +00:00
netbsd Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00
svr4 Use shared vnode locks when invoking VOP_READDIR(). 2009-02-13 18:18:14 +00:00