Subject: svr4 waitsys support
To: None <tech-kern@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 07/03/2002 11:20:03
I've found 5 pieces of code that basically implement the wait4()
function.  The copies in the 'compat' are already missing a couple
of minor bug fixes and I was looking at trying to rationalise things.
(Partially because some changes I'm playing with seem to require
that all 5 copies be changed further.)

In any case the 3 'svr4' copies (irix/svr4/svr4_32) all contain
(in xxx_setinfo()):

        if (p) {
		i.si_pid = p->p_pid;
		if (p->p_stat == SZOMB) {
			i.si_stime = p->p_ru->ru_stime.tv_sec;
			i.si_utime = p->p_ru->ru_utime.tv_sec;
		} else {
			i.si_stime = p->p_stats->p_ru.ru_stime.tv_sec;
			i.si_utime = p->p_stats->p_ru.ru_utime.tv_sec;
		}
	}

(the p->p_stats->p_ru.xxx was added to stop panics dereferencing
deadbeef when a process stopped doing job control)

However proc.h contains the following:
    struct pstats   *p_stats;       /* Accounting/statistics (PROC ONLY) */
and:
  The process structure and the substructures
  are always addressible except for those marked "(PROC ONLY)" below, 
  which might be addressible only on a processor on which the process
  is running. 

This makes me think that the si_[su]time fields returned then
the process isn't a zombie (ie when it is being traced) are
likely to be complete gibberish.

If this is true (the comment is in all revisions of proc.h)
is there any way of obtaining the stats for a process other
that the current one?
If it isn't true should the comment be removed?

	David

-- 
David Laight: david@l8s.co.uk