• Andrew Morton's avatar
    [PATCH] move job control fields from task_struct to · 1bd563fd
    Andrew Morton authored
    From: Roland McGrath <roland@redhat.com>
    
    This patch completes what was started with the `process_group' accessor
    function, moving all the job control-related fields from task_struct into
    signal_struct and using process_foo accessor functions to read them.  All
    these things are per-process in POSIX, none per-thread.  Off hand it's hard
    to come up with the hairy MT scenarios in which the existing code would do
    insane things, but trust me, they're there.  At any rate, all the uses
    being done via inline accessor functions now has got to be all good.
    
    I did a "make allyesconfig" build and caught the few random drivers and
    whatnot that referred to these fields.  I was surprised to find how few
    references to ->tty there really were to fix up.  I'm sure there will be a
    few more fixups needed in non-x86 code.  The only actual testing of a
    running kernel with these patches I've done is on my normal minimal x86
    config.  Everything works fine as it did before as far as I can tell.
    
    One issue that may be of concern is the lack of any locking on multiple
    threads diddling these fields.  I don't think it really matters, though
    there might be some obscure races that could produce inconsistent job
    control results.  Nothing shattering, I'm sure; probably only something
    like a multi-threaded program calling setsid while its other threads do tty
    i/o, which never happens in reality.  This is the same situation we get by
    using ->group_leader->foo without other synchronization, which seemed to be
    the trend and noone was worried about it.
    1bd563fd
tty_io.c 61.7 KB