Subject: Re: netbsd-4 (and -current) - ps acting funny ?
To: None <>
From: Michael van Elst <>
List: current-users
Date: 07/29/2007 09:01:21 (Pavel Cahyna) writes:

>On Sat, Jul 28, 2007 at 06:27:28PM +0100, David Laight wrote:
>> On Sat, Jul 28, 2007 at 03:56:40PM +0000, Michael van Elst wrote:
>> > The p_stat of a sleeping process is seen as SDYING (3) because
>> > the kvm interface overwrites the value with l_stat == LSSLEEP (3).

>> This all appeared to work until a new 'p->p_stat' flag SDYING got
>> added reusing one of the old values (instead of reusing the value
>> that used to be SDEAD).

>Isn't it better to change the definition of SDYING, then?

That would be my suggestion. But it is not the only issue here.

For some uses p_stat is abused to carry l_stat values, as a workaround
for the ps command the original p_stat value is saved by kvm as p_realstat.
The fix for the time value problem again uses this workaround.

The only things involved in the base system are kernel, libkvm, ps
and systat. Cleaning up this mess therefore isn't that difficult,
but I guess it requires a version bump.

In the beginning however you have to define what 'process state'
means in the context of a threaded program.

                                Michael van Elst
                                "A potential Snark may lurk in every tree."