diff options
author | axel <axel@liljencrantz.se> | 2006-11-20 23:12:24 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2006-11-20 23:12:24 +1000 |
commit | bc1efb1556d84ed62fdfd48a3f44988ac0312678 (patch) | |
tree | bebdd37781e249526527f8c017fa11a0cf7dacb6 /proc.c | |
parent | 7b5649097f182a1f5f6270cb3d6719d13aa3f34f (diff) |
Minor code edit - move a bit of code into its own function
darcs-hash:20061120131224-ac50b-974496cc800377e4e06475491f89998b9640fbba.gz
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 34 |
1 files changed, 34 insertions, 0 deletions
@@ -301,6 +301,40 @@ int job_get_flag( job_t *j, int flag ) return j->flags&flag?1:0; } +int job_signal( job_t *j, int signal ) +{ + pid_t my_pid = getpid(); + int res = 0; + + if( j->pgid != my_pid ) + { + res = killpg( j->pgid, SIGHUP ); + } + else + { + process_t *p; + + for( p = j->first_process; p; p=p->next ) + { + if( ! p->completed ) + { + if( p->pid ) + { + if( kill( p->pid, SIGHUP ) ) + { + res = -1; + break; + } + } + } + } + + } + + return res; + +} + /** Store the status of the process pid that was returned by waitpid. |