[PATCH] fix impossible case with waitpid(2) in truss

Garrett Cooper yanegomi at gmail.com
Tue Feb 15 14:12:06 UTC 2011


On Tue, Feb 15, 2011 at 4:41 AM, John Baldwin <jhb at freebsd.org> wrote:
> On Monday, February 14, 2011 11:12:02 pm Garrett Cooper wrote:
>> Hi,
>>     waitpid(2) returns a value in the set { -1, 0, <pid> } (-1 in the
>> event of an ERROR, 0 when WNOHANG is specified, <pid> when the process
>> exits according to wait(2)); it never returns a value < -1.
>>     If someone could commit this patch it would be appreciated.
>> Thanks,
>> -Garrett
>
> I went with '< 0' to match the style used for ptrace() invocations in other
> parts of truss.  All four calls to waitpid() in truss were broken in this
> fashion.

    Oops. I just spotted the one issue because I was looking for a
reasonable example for how to do ptrace as I needed to clean off some
related cobwebs for $JOB.
Thanks for finding the rest of the issues!
-Garrett


More information about the freebsd-hackers mailing list