freebsd-skq/sys/kern
ed 72727e8d9f 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
..
bus_if.m Allow device hints to wire the unit numbers of devices. 2008-11-18 21:01:54 +00:00
clock_if.m
cpufreq_if.m
device_if.m
genassym.sh refactor code so it can run in a chroot without having to have /dev/mounted 2008-01-18 17:02:14 +00:00
imgact_aout.c Add sv_flags field to struct sysentvec with intention to provide description 2008-11-22 12:36:15 +00:00
imgact_elf32.c
imgact_elf64.c
imgact_elf.c When a statically linked binary is executed (or at least, one without 2009-01-25 12:07:43 +00:00
imgact_gzip.c VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used in 2008-01-13 14:44:15 +00:00
imgact_shell.c Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed thread 2008-08-28 15:23:18 +00:00
inflate.c
init_main.c Rename three MAC entry points from _proc_ to _cred_ to reflect the fact 2008-10-28 11:33:06 +00:00
init_sysent.c Regenerate system call tables for r184789. 2008-11-09 10:48:06 +00:00
kern_acct.c Properly lock proctree_lock before locking the process while accounting. 2008-08-21 15:02:17 +00:00
kern_alq.c Use msleep_spin() instead of unlock/tsleep/lock. This was 2008-07-02 20:44:33 +00:00
kern_clock.c - Implement generic macros for producing KTR records that are compatible 2009-01-17 07:17:57 +00:00
kern_condvar.c - Don't do a WITNESS_SAVE() on the interlock if it is Giant in the condition 2008-09-25 13:42:19 +00:00
kern_conf.c Explicitely note that destroy_dev() sleeps. 2008-11-27 16:47:25 +00:00
kern_cons.c Reimplement the /dev/console device node. 2008-11-01 08:35:28 +00:00
kern_context.c Further system call comment cleanup: 2007-03-05 13:10:58 +00:00
kern_cpu.c If possible, try to obtain max_mhz on cpufreq attach instead of first request. 2008-12-16 01:24:05 +00:00
kern_cpuset.c MFp4: 2008-11-29 14:32:14 +00:00
kern_ctf.c Add the CTF source file which gets shared with link_elf.c and link_elf_obj.c. 2008-05-23 03:04:27 +00:00
kern_descrip.c Remove the printf's when the vnode to be exported for procstat is not a VDIR. 2009-02-14 21:55:09 +00:00
kern_dtrace.c Remove code that isn't required. It actually breaks the case where KDTRACE_HOOKS 2008-06-16 04:44:29 +00:00
kern_environment.c Implement the following macros for completeness: 2008-07-21 15:05:25 +00:00
kern_event.c Fix a number of style issues in the MALLOC / FREE commit. I've tried to 2008-10-23 20:26:15 +00:00
kern_exec.c Several threads in a process may do vfork() simultaneously. Then, all 2008-12-05 20:50:24 +00:00
kern_exit.c Several threads in a process may do vfork() simultaneously. Then, all 2008-12-05 20:50:24 +00:00
kern_fork.c Several threads in a process may do vfork() simultaneously. Then, all 2008-12-05 20:50:24 +00:00
kern_idle.c In keeping with style(9)'s recommendations on macros, use a ';' 2008-03-16 10:58:09 +00:00
kern_intr.c style(9) 2008-09-23 14:25:56 +00:00
kern_jail.c Don't allow creating a socket with a protocol family that the current 2009-02-05 14:15:18 +00:00
kern_kthread.c Kill a dead variable 2008-08-03 21:07:19 +00:00
kern_ktr.c
kern_ktrace.c Fix a credential reference leak. [1] 2008-12-03 15:54:35 +00:00
kern_linker.c Scanning all the formats for binary translation of modules loading can 2009-02-10 15:50:19 +00:00
kern_lock.c Tweak the output of VOP_PRINT/vn_printf() some. 2009-02-06 20:06:48 +00:00
kern_lockf.c Remove unused variable. 2008-11-27 04:40:37 +00:00
kern_malloc.c - Make the keg abstraction more complete. Permit a zone to have multiple 2009-01-25 09:11:24 +00:00
kern_mbuf.c Temporary workaround for the limitations of the mbuf flowid field: zero 2009-01-01 20:03:01 +00:00
kern_mib.c Mark most often used sysctl's as MPSAFE. 2009-01-28 19:58:05 +00:00
kern_module.c When the SYSINIT() to load a module invokes the MOD_LOAD event successfully, 2008-12-05 16:47:30 +00:00
kern_mtxpool.c Fix a number of style issues in the MALLOC / FREE commit. I've tried to 2008-10-23 20:26:15 +00:00
kern_mutex.c Teach WITNESS about the interlocks used with lockmgr. This removes a bunch 2008-09-10 19:13:30 +00:00
kern_ntptime.c In keeping with style(9)'s recommendations on macros, use a ';' 2008-03-16 10:58:09 +00:00
kern_osd.c Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. 2008-11-17 20:49:29 +00:00
kern_physio.c
kern_pmc.c Support sparsely numbered CPUs. 2008-09-22 10:37:02 +00:00
kern_poll.c Order #includes - also to reduce diffs with vimage branches in p4. 2008-12-11 16:09:31 +00:00
kern_priv.c Remove the suser(9) interface from the kernel. It has been replaced from 2008-09-17 15:49:44 +00:00
kern_proc.c - Add a function (fill_kinfo_aggregate()) which aggregates relevant 2009-02-18 21:52:13 +00:00
kern_prot.c The userland_sysctl() function retries sysctl_root() until returned 2008-12-12 12:06:28 +00:00
kern_resource.c Don't rearm callout if the process is exiting, it may leak a callout 2008-10-24 01:09:24 +00:00
kern_rmlock.c Teach WITNESS about the interlocks used with lockmgr. This removes a bunch 2008-09-10 19:13:30 +00:00
kern_rwlock.c add RW_SYSINIT_FLAGS macro and rw_sysinit_flags initialization function 2008-12-08 21:46:55 +00:00
kern_sdt.c Add kernel support for the Statically Defined Trace provider. 2008-05-18 19:32:36 +00:00
kern_sema.c
kern_shutdown.c It's possible that the dump device has gone away after it was 2008-11-23 21:05:22 +00:00
kern_sig.c Revert rev 184216 and 184199, due to the way the thread_lock works, 2008-11-05 03:01:23 +00:00
kern_subr.c Make ureadc() warn when holding any locks, just like uiomove(). 2008-08-28 19:34:58 +00:00
kern_switch.c fix typo in runz_fuzz 2008-05-12 06:42:06 +00:00
kern_sx.c Teach WITNESS about the interlocks used with lockmgr. This removes a bunch 2008-09-10 19:13:30 +00:00
kern_synch.c - Implement generic macros for producing KTR records that are compatible 2009-01-17 07:17:57 +00:00
kern_syscalls.c Various style fixes. 7 space indent is just odd. 2008-09-18 20:10:11 +00:00
kern_sysctl.c Expand the scope of the sysctllock sx lock to protect the sysctl tree itself. 2009-02-06 14:51:32 +00:00
kern_tc.c In keeping with style(9)'s recommendations on macros, use a ';' 2008-03-16 10:58:09 +00:00
kern_thr.c Add sv_flags field to struct sysentvec with intention to provide description 2008-11-22 12:36:15 +00:00
kern_thread.c Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. 2008-11-17 20:49:29 +00:00
kern_time.c In realtimer_delete(), clear timer's value and interval to tell 2008-10-20 02:37:53 +00:00
kern_timeout.c Add explicit static DTrace tracing to the callout mechanism, capturing 2009-01-24 10:22:49 +00:00
kern_umtx.c Add two commands to _umtx_op system call to allow a simple mutex to be 2008-06-24 07:32:12 +00:00
kern_uuid.c Rather than using hidden includes (with cicular dependencies), 2008-12-02 21:37:28 +00:00
kern_vimage.c Conditionally compile out V_ globals while instantiating the appropriate 2008-12-10 23:12:39 +00:00
kern_xxx.c Fix compilation. Also move ogetkerninfo() to kern_xxx.c. 2008-12-29 19:24:00 +00:00
ksched.c Commit 14/14 of sched_lock decomposition. 2007-06-05 00:00:57 +00:00
link_elf_obj.c Scanning all the formats for binary translation of modules loading can 2009-02-10 15:50:19 +00:00
link_elf.c Scanning all the formats for binary translation of modules loading can 2009-02-10 15:50:19 +00:00
linker_if.m Add the ctf_get method. 2008-05-23 04:06:49 +00:00
Make.tags.inc Catch up with the disappearance of sys/dev/hfa. 2008-12-01 14:34:42 +00:00
Makefile style.Makefile(5) 2007-12-14 21:30:51 +00:00
makesyscalls.sh Tidy up a few things with syscall generation: 2008-09-25 20:07:42 +00:00
md4c.c
md5c.c
p1003_1b.c Remove kernel support for M:N threading. 2008-03-12 10:12:01 +00:00
posix4_mib.c
sched_4bsd.c - Use __XSTRING where I want the define to be expanded. This resulted in 2009-01-25 07:35:10 +00:00
sched_ule.c - Use __XSTRING where I want the define to be expanded. This resulted in 2009-01-25 07:35:10 +00:00
serdev_if.m
stack_protector.c Fix a chicken-and-egg problem: this files implements SSP support, 2008-06-26 07:52:45 +00:00
subr_acl_posix1e.c Rename a variable missed in previous accmode_t-related commits. 2008-10-28 21:58:48 +00:00
subr_autoconf.c Prefer ANSI function definitions to K&R ones. 2009-02-03 07:52:07 +00:00
subr_blist.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
subr_bufring.c - bump __FreeBSD version to reflect added buf_ring, memory barriers, 2008-11-22 05:55:56 +00:00
subr_bus.c o Use NULL in pereference to 0 in pointer contexts. 2009-02-11 04:54:02 +00:00
subr_clist.c Remove a stale comment from the clists code. 2009-02-09 11:27:56 +00:00
subr_clock.c Now that all platforms use genclock, shuffle things around slightly 2008-04-22 19:38:30 +00:00
subr_devstat.c Use NULL in preference to 0 in pointer contexts. 2009-02-03 07:54:42 +00:00
subr_disk.c Clarify and reimplement the bioq API so that bioq_disksort() has 2009-02-13 11:36:32 +00:00
subr_eventhandler.c In keeping with style(9)'s recommendations on macros, use a ';' 2008-03-16 10:58:09 +00:00
subr_fattime.c
subr_firmware.c Use NULL in preference to 0 for pointers. 2009-02-03 07:51:11 +00:00
subr_hints.c
subr_kdb.c Expand kdb_alt_break a little, most commonly used with the option 2008-05-04 23:29:38 +00:00
subr_kobj.c Use NULL in preference to 0 in pointer contexts. 2009-02-03 07:54:42 +00:00
subr_lock.c - track maximum wait time 2008-07-27 21:45:20 +00:00
subr_log.c In keeping with style(9)'s recommendations on macros, use a ';' 2008-03-16 10:58:09 +00:00
subr_mbpool.c Add parens around *free in *free++ in mbp_count() so that mbp_count() 2007-05-27 17:38:36 +00:00
subr_mchain.c Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT. 2008-03-25 09:39:02 +00:00
subr_module.c
subr_msgbuf.c
subr_param.c Document the relationship between enum VM_GUEST and the vm_guest_sysctl_names 2008-12-30 23:49:54 +00:00
subr_pcpu.c - Implement generic macros for producing KTR records that are compatible 2009-01-17 07:17:57 +00:00
subr_power.c
subr_prf.c Use NULL in preference to 0 for pointers. 2009-02-03 07:51:11 +00:00
subr_prof.c Use ANSI function definition for profil. 2009-02-03 07:52:36 +00:00
subr_rman.c rman_debug should be static, so make it static. 2009-02-03 07:53:08 +00:00
subr_rtc.c int foo(void) is the proper ANSI function definition when there's no 2009-02-03 07:50:01 +00:00
subr_sbuf.c Switch to simplified BSD license (with phk's approval), plus whitespace 2008-08-09 10:26:21 +00:00
subr_scanf.c
subr_sleepqueue.c Revision 184199 had not been fully reverted, add missing piece. 2008-12-01 01:54:55 +00:00
subr_smp.c Whitespace tweak. 2009-01-26 15:32:39 +00:00
subr_stack.c Make it possible to compile kernel with KTR but without DDB. 2008-10-30 21:48:28 +00:00
subr_taskqueue.c Remove semicolon left in the last commit 2009-02-13 18:51:39 +00:00
subr_trap.c - Bug fix: prevent a thread from migrating between CPUs between the 2008-12-13 13:07:12 +00:00
subr_turnstile.c Make ddb command registration dynamic so modules can extend 2008-09-15 22:45:14 +00:00
subr_unit.c Since cdev mutex is after system map mutex in global lock order, free() 2007-07-04 06:56:58 +00:00
subr_witness.c o Use unsigned for bit fields. 2009-02-03 07:50:41 +00:00
sys_generic.c Fix select on platforms where sizeof(long) != sizeof(int). This used 2009-02-02 03:34:40 +00:00
sys_pipe.c Several cleanups related to pipe(2). 2008-11-11 14:55:59 +00:00
sys_process.c Revert rev 184216 and 184199, due to the way the thread_lock works, 2008-11-05 03:01:23 +00:00
sys_socket.c Lock receive socket buffer in soo_stat() rather than commenting that we 2008-10-07 07:10:28 +00:00
syscalls.c Regenerate system call tables for r184789. 2008-11-09 10:48:06 +00:00
syscalls.master Mark uname(), getdomainname() and setdomainname() with COMPAT_FREEBSD4. 2008-11-09 10:45:13 +00:00
systrace_args.c Regenerate system call tables for r184789. 2008-11-09 10:48:06 +00:00
sysv_ipc.c Eliminate now-unused SUSER_ALLOWJAIL arguments to priv_check_cred(); in 2007-06-12 00:12:01 +00:00
sysv_msg.c Merge first in a series of TrustedBSD MAC Framework KPI changes 2007-10-24 19:04:04 +00:00
sysv_sem.c Lock the semaphore identifier lock during semaphore initialization to 2009-01-15 12:15:46 +00:00
sysv_shm.c Make sure we restrict Linux only IPC calls from being executed 2008-02-12 20:55:03 +00:00
tty_compat.c Fix an awful bug inside our COMPAT_43TTY code. 2008-09-04 16:30:53 +00:00
tty_info.c If a process is a zombie and we couldn't identify another useful state, 2009-01-29 09:32:56 +00:00
tty_inq.c Slightly improve the design of the TTY buffer. 2009-02-03 19:58:28 +00:00
tty_outq.c Slightly improve the design of the TTY buffer. 2009-02-03 19:58:28 +00:00
tty_pts.c Squash some small bugs in pts(4). 2009-02-19 17:54:42 +00:00
tty_pty.c Remove unneeded use of device unit numbers from pty(4). 2009-01-25 08:27:11 +00:00
tty_tty.c Remove unneeded Giant locking of /dev/tty. 2008-06-03 12:38:00 +00:00
tty_ttydisc.c Don't forget to relock the TTY after uiomove() returns an error. 2008-11-12 09:04:44 +00:00
tty.c Serialize write() calls on TTYs. 2009-02-11 16:28:49 +00:00
uipc_accf.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
uipc_cow.c Extend the struct vm_page wire_count to u_int to avoid the overflow 2009-01-03 13:24:08 +00:00
uipc_debug.c Remove extra 'comma = 0' in socket state printing code, which otherwise 2009-02-09 18:19:58 +00:00
uipc_domain.c Remove Giant locking from domains list. 2009-01-04 19:22:53 +00:00
uipc_mbuf2.c Merge first in a series of TrustedBSD MAC Framework KPI changes 2007-10-24 19:04:04 +00:00
uipc_mbuf.c Teach m_copyback() to use trailing space of the last mbuf in chain. 2009-01-18 20:19:55 +00:00
uipc_mqueue.c Fix matching of message queues by name. 2008-11-28 14:53:18 +00:00
uipc_sem.c Rework the lifetime management of the kernel implementation of POSIX 2008-06-27 05:39:04 +00:00
uipc_shm.c Shared memory objects that have size which is not necessarily equal to 2008-12-01 22:33:50 +00:00
uipc_sockbuf.c Rewrite sbreserve_locked()'s comment on NULL thread pointers, eliminating 2008-10-07 09:51:39 +00:00
uipc_socket.c Don't allow creating a socket with a protocol family that the current 2009-02-05 14:15:18 +00:00
uipc_syscalls.c Retire the MALLOC and FREE macros. They are an abomination unto style(9). 2008-10-23 15:53:51 +00:00
uipc_usrreq.c White space and comment tweaks. 2009-01-01 20:03:22 +00:00
vfs_acl.c Add the support for the AT_FDCWD and fd-relative name lookups to the 2008-03-31 12:01:21 +00:00
vfs_aio.c Use the correct type for the timeout parameter to the 32-bit 2009-01-23 13:23:17 +00:00
vfs_bio.c Tweak the output of VOP_PRINT/vn_printf() some. 2009-02-06 20:06:48 +00:00
vfs_cache.c Enable caching of negative pathname lookups in the NFS client. To avoid 2009-02-19 22:28:48 +00:00
vfs_cluster.c - Complete part of the unfinished bufobj work by consistently using 2008-03-22 09:15:16 +00:00
vfs_default.c Add a new VOP, VOP_VPTOCNP, which translates a vnode to its component name 2008-12-12 00:57:38 +00:00
vfs_export.c drop rnh lock before destroying it 2008-12-28 14:32:27 +00:00
vfs_extattr.c Do not call namei() while having another user-controlled vnode 2009-01-08 12:47:30 +00:00
vfs_hash.c In keeping with style(9)'s recommendations on macros, use a ';' 2008-03-16 10:58:09 +00:00
vfs_init.c Expand the scope of the sysctllock sx lock to protect the sysctl tree itself. 2009-02-06 14:51:32 +00:00
vfs_lookup.c Do not return success and doomed vnode from lookup. LK_UPGRADE allows 2008-12-18 11:58:12 +00:00
vfs_mount.c Add more KTR_VFS logging point in order to have a more effective tracing. 2009-02-05 15:03:35 +00:00
vfs_subr.c Tweak the output of VOP_PRINT/vn_printf() some. 2009-02-06 20:06:48 +00:00
vfs_syscalls.c Don't make Linux stat() open character devices to resolve its name. 2009-02-20 13:05:29 +00:00
vfs_vnops.c Move the code from ufs_lookup.c used to do dotdot lookup, into 2009-01-21 14:51:38 +00:00
vnode_if.src Move the VA_MARKATIME flag for VOP_SETATTR() out into its own VOP: 2009-01-21 14:42:00 +00:00