Commit d80e4186 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] remove will_become_orphaned_pgrp()

Patch from William Lee Irwin III <wli@holomorphy.com>

will_become_orphaned_pgrp()'s sole use is is_orphaned_pgrp().  Fold its body
into is_orphaned_pgrp(), rename __will_become_orphaned_pgrp(), and adjust
callers.  Code shrinkage plus some relief from underscore-itis.
parent 226a4aef
...@@ -156,7 +156,7 @@ int session_of_pgrp(int pgrp) ...@@ -156,7 +156,7 @@ int session_of_pgrp(int pgrp)
* *
* "I ask you, have you ever known what it is to be an orphan?" * "I ask you, have you ever known what it is to be an orphan?"
*/ */
static int __will_become_orphaned_pgrp(int pgrp, task_t *ignored_task) static int will_become_orphaned_pgrp(int pgrp, task_t *ignored_task)
{ {
struct task_struct *p; struct task_struct *p;
struct list_head *l; struct list_head *l;
...@@ -177,22 +177,17 @@ static int __will_become_orphaned_pgrp(int pgrp, task_t *ignored_task) ...@@ -177,22 +177,17 @@ static int __will_become_orphaned_pgrp(int pgrp, task_t *ignored_task)
return ret; /* (sighing) "Often!" */ return ret; /* (sighing) "Often!" */
} }
static int will_become_orphaned_pgrp(int pgrp, struct task_struct * ignored_task) int is_orphaned_pgrp(int pgrp)
{ {
int retval; int retval;
read_lock(&tasklist_lock); read_lock(&tasklist_lock);
retval = __will_become_orphaned_pgrp(pgrp, ignored_task); retval = will_become_orphaned_pgrp(pgrp, NULL);
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);
return retval; return retval;
} }
int is_orphaned_pgrp(int pgrp)
{
return will_become_orphaned_pgrp(pgrp, 0);
}
static inline int has_stopped_jobs(int pgrp) static inline int has_stopped_jobs(int pgrp)
{ {
int retval = 0; int retval = 0;
...@@ -495,7 +490,7 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced) ...@@ -495,7 +490,7 @@ static inline void reparent_thread(task_t *p, task_t *father, int traced)
(p->session == father->session)) { (p->session == father->session)) {
int pgrp = p->pgrp; int pgrp = p->pgrp;
if (__will_become_orphaned_pgrp(pgrp, 0) && has_stopped_jobs(pgrp)) { if (will_become_orphaned_pgrp(pgrp, NULL) && has_stopped_jobs(pgrp)) {
__kill_pg_info(SIGHUP, (void *)1, pgrp); __kill_pg_info(SIGHUP, (void *)1, pgrp);
__kill_pg_info(SIGCONT, (void *)1, pgrp); __kill_pg_info(SIGCONT, (void *)1, pgrp);
} }
...@@ -579,7 +574,7 @@ static void exit_notify(void) ...@@ -579,7 +574,7 @@ static void exit_notify(void)
if ((t->pgrp != current->pgrp) && if ((t->pgrp != current->pgrp) &&
(t->session == current->session) && (t->session == current->session) &&
__will_become_orphaned_pgrp(current->pgrp, current) && will_become_orphaned_pgrp(current->pgrp, current) &&
has_stopped_jobs(current->pgrp)) { has_stopped_jobs(current->pgrp)) {
__kill_pg_info(SIGHUP, (void *)1, current->pgrp); __kill_pg_info(SIGHUP, (void *)1, current->pgrp);
__kill_pg_info(SIGCONT, (void *)1, current->pgrp); __kill_pg_info(SIGCONT, (void *)1, current->pgrp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment