• Roland McGrath's avatar
    [PATCH] Make sys_wait4() more readable · 202b74eb
    Roland McGrath authored
    I cleaned up sys_wait4; it was straightforward and I think a definite
    improvement.  While at it, I noticed that one of the races I fixed in the
    TASK_STOPPED case actually can happen earlier.  Between read_unlock and
    write_lock_irq, another thread could reap the process and make P invalid,
    so now I do get_task_struct before read_unlock and then the existing race
    checks catch all scenarios.
    
    Aside from the aforementioned race tweak, the code should be the same as
    in the previous patch (that Ingo and I have tested more thoroughly)
    modulo being moved into functions and some reformatting and comment
    changes.
    
    Oh, my old patch had one case where it failed to retake the read lock after
    a race bailout that I just noticed reading over it.  That's fixed too.
    
    These exit fixes were something I noticed incidentally and spent less time
    on than the signals changes.  Another few passes of eyeballs over them are
    certainly warranted.  (In particular, there are code paths like that one
    that check for specific races that have probably never been seen in
    practice, so those code paths have never run once.)
    202b74eb
exit.c 25.5 KB