kernel - Make numerous proc accesses use p->p_token instead of proc_token.
authorMatthew Dillon <dillon@apollo.backplane.com>
Mon, 14 Feb 2011 04:57:32 +0000 (20:57 -0800)
committerMatthew Dillon <dillon@apollo.backplane.com>
Mon, 14 Feb 2011 05:07:12 +0000 (21:07 -0800)
commit58c2553a79a1ecfcbfd3ab0cb8e383052af37406
tree0ef05e4b6e53c0aaf1702cb2f09a68d0abd2a670
parent5e240fae72c14e57daf01d4e588ec1eee4f7a11c
kernel - Make numerous proc accesses use p->p_token instead of proc_token.

* pfind() zpfind() now returns a referenced proc structure, callers must
  release the proc with PRELE().  Callers no longer need to hold proc_token
  for stable access.

* Enhance pgrp, adding pgrp->pg_token and pgrp->pg_refs in addition to
  pgrp->pg_lock.  The lock is used to interlock races between fork() and
  signals while the token and refs are used to control access.

* Add pfindn(), a version of pfind() which does not ref the returned proc.
  Some code still uses it (linux emulation) ---> needs work.

* Add pgref() and pgrel() to mess with the pgrp's pg_refs.  pgrel()
  automatically destroys the pgrp when the last reference goes away.

* Most process group operations now use the per-process token instead of
  proc_token, though pgfind() still needs it temporarily.

* pgfind() now returns a referenced pgrp or NULL.

* Interlock signal handling with p->p_token instead of proc_token.

* Adjust most nice/priority functions to use the per-process token.

* Add protective PHOLD()s in various places in the signal code, the
  ptrace code, and procfs.

* Change funsetown() to take the address of the sigio pointer to match
  fsetown(), add sanity assertions.

* pgrp's in tty sessions are now ref-counted.
37 files changed:
sys/dev/drm/drm_drv.c
sys/dev/misc/syscons/scmouse.c
sys/dev/misc/syscons/syscons.c
sys/emulation/linux/i386/linprocfs/linprocfs.h
sys/emulation/linux/i386/linprocfs/linprocfs_vnops.c
sys/emulation/linux/i386/linux_machdep.c
sys/emulation/linux/i386/linux_ptrace.c
sys/emulation/linux/linux_futex.c
sys/emulation/linux/linux_misc.c
sys/emulation/linux/linux_signal.c
sys/kern/init_main.c
sys/kern/kern_descrip.c
sys/kern/kern_event.c
sys/kern/kern_exit.c
sys/kern/kern_fork.c
sys/kern/kern_ktrace.c
sys/kern/kern_p1003_1b.c
sys/kern/kern_proc.c
sys/kern/kern_prot.c
sys/kern/kern_resource.c
sys/kern/kern_sig.c
sys/kern/subr_log.c
sys/kern/sys_pipe.c
sys/kern/sys_process.c
sys/kern/tty.c
sys/kern/uipc_socket.c
sys/kern/uipc_syscalls.c
sys/net/bpf.c
sys/net/tap/if_tap.c
sys/net/tun/if_tun.c
sys/platform/pc32/i386/db_trace.c
sys/sys/filedesc.h
sys/sys/proc.h
sys/vfs/procfs/procfs.h
sys/vfs/procfs/procfs_ctl.c
sys/vfs/procfs/procfs_subr.c
sys/vfs/procfs/procfs_vnops.c