freebsd-skq/sys/compat/svr4
jhb ce2d3f89af Rework how we store process times in the kernel such that we always store
the raw values including for child process statistics and only compute the
system and user timevals on demand.

- Fix the various kern_wait() syscall wrappers to only pass in a rusage
  pointer if they are going to use the result.
- Add a kern_getrusage() function for the ABI syscalls to use so that they
  don't have to play stackgap games to call getrusage().
- Fix the svr4_sys_times() syscall to just call calcru() to calculate the
  times it needs rather than calling getrusage() twice with associated
  stackgap, etc.
- Add a new rusage_ext structure to store raw time stats such as tick counts
  for user, system, and interrupt time as well as a bintime of the total
  runtime.  A new p_rux field in struct proc replaces the same inline fields
  from struct proc (i.e. p_[isu]ticks, p_[isu]u, and p_runtime).  A new p_crux
  field in struct proc contains the "raw" child time usage statistics.
  ruadd() has been changed to handle adding the associated rusage_ext
  structures as well as the values in rusage.  Effectively, the values in
  rusage_ext replace the ru_utime and ru_stime values in struct rusage.  These
  two fields in struct rusage are no longer used in the kernel.
- calcru() has been split into a static worker function calcru1() that
  calculates appropriate timevals for user and system time as well as updating
  the rux_[isu]u fields of a passed in rusage_ext structure.  calcru() uses a
  copy of the process' p_rux structure to compute the timevals after updating
  the runtime appropriately if any of the threads in that process are
  currently executing.  It also now only locks sched_lock internally while
  doing the rux_runtime fixup.  calcru() now only requires the caller to
  hold the proc lock and calcru1() only requires the proc lock internally.
  calcru() also no longer allows callers to ask for an interrupt timeval
  since none of them actually did.
- calcru() now correctly handles threads executing on other CPUs.
- A new calccru() function computes the child system and user timevals by
  calling calcru1() on p_crux.  Note that this means that any code that wants
  child times must now call this function rather than reading from p_cru
  directly.  This function also requires the proc lock.
- This finishes the locking for rusage and friends so some of the Giant locks
  in exit1() and kern_wait() are now gone.
- The locking in ttyinfo() has been tweaked so that a shared lock of the
  proctree lock is used to protect the process group rather than the process
  group lock.  By holding this lock until the end of the function we now
  ensure that the process/thread that we pick to dump info about will no
  longer vanish while we are trying to output its info to the console.

Submitted by:	bde (mostly)
MFC after:	1 month
2004-10-05 18:51:11 +00:00
..
imgact_svr4.c Cast variable-sized (based on platform) quantities before printing out. 2004-06-24 02:21:17 +00:00
Makefile
svr4_acl.h
svr4_dirent.h
svr4_errno.h
svr4_exec.h
svr4_fcntl.c Fix the ABI wrappers to use kern_fcntl() rather than calling fcntl() 2004-08-24 20:21:21 +00:00
svr4_fcntl.h
svr4_filio.c Locking for the per-process resource limits structure. 2004-02-04 21:52:57 +00:00
svr4_filio.h
svr4_fuser.h
svr4_hrt.h
svr4_ioctl.c Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES. 2004-06-21 22:57:16 +00:00
svr4_ioctl.h
svr4_ipc.c
svr4_ipc.h
svr4_misc.c Rework how we store process times in the kernel such that we always store 2004-10-05 18:51:11 +00:00
svr4_mman.h
svr4_proto.h Regenerate after fcntl() wrappers were marked MP safe. 2004-08-24 20:24:34 +00:00
svr4_resource.c Locking for the per-process resource limits structure. 2004-02-04 21:52:57 +00:00
svr4_resource.h
svr4_siginfo.h
svr4_signal.c
svr4_signal.h
svr4_socket.c Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
svr4_socket.h Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
svr4_sockio.c
svr4_sockio.h
svr4_sockmod.h
svr4_stat.c
svr4_stat.h
svr4_statvfs.h
svr4_stream.c Fix the ABI wrappers to use kern_fcntl() rather than calling fcntl() 2004-08-24 20:21:21 +00:00
svr4_stropts.h
svr4_syscall.h Regenerate after fcntl() wrappers were marked MP safe. 2004-08-24 20:24:34 +00:00
svr4_syscallnames.c Regenerate after fcntl() wrappers were marked MP safe. 2004-08-24 20:24:34 +00:00
svr4_sysconfig.h
svr4_sysent.c Regenerate after fcntl() wrappers were marked MP safe. 2004-08-24 20:24:34 +00:00
svr4_systeminfo.h
svr4_sysvec.c Do a pass over all modules in the kernel and make them return EOPNOTSUPP 2004-07-15 08:26:07 +00:00
svr4_termios.c
svr4_termios.h
svr4_time.h
svr4_timod.h
svr4_ttold.c Put the pre FreeBSD-2.x tty compat code under BURN_BRIDGES. 2004-06-21 22:57:16 +00:00
svr4_ttold.h
svr4_types.h Second half of the dev_t cleanup. 2004-06-17 17:16:53 +00:00
svr4_ucontext.h
svr4_ulimit.h
svr4_ustat.h
svr4_util.h
svr4_utsname.h
svr4_wait.h
svr4.h
syscalls.conf GC unused 'syshide' override to /dev/null. This was here to disable 2003-12-24 00:32:07 +00:00
syscalls.master Fix the ABI wrappers to use kern_fcntl() rather than calling fcntl() 2004-08-24 20:21:21 +00:00