Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Feb 2009 13:05:29 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        cvs-src-old@freebsd.org
Subject:   cvs commit: src/sys/compat/linux linux_stats.c src/sys/kern vfs_syscalls.c src/sys/sys syscallsubr.h
Message-ID:  <200902201307.n1KD71RY061860@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
ed          2009-02-20 13:05:29 UTC

  FreeBSD src repository

  Modified files:
    sys/compat/linux     linux_stats.c 
    sys/kern             vfs_syscalls.c 
    sys/sys              syscallsubr.h 
  Log:
  SVN rev 188849 on 2009-02-20 13:05:29Z by ed
  
  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!)
  
  Revision  Changes    Path
  1.95      +49 -47    src/sys/compat/linux/linux_stats.c
  1.472     +11 -4     src/sys/kern/vfs_syscalls.c
  1.53      +3 -0      src/sys/sys/syscallsubr.h



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200902201307.n1KD71RY061860>