Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256851
b: refs/heads/master
c: 53c8f9f
h: refs/heads/master
i:
  256849: 0ca7047
  256847: 069d60f
v: v3
  • Loading branch information
Oleg Nesterov committed Jun 27, 2011
1 parent 8bdb7cc commit e65783b
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 06d984737bac0545fe20bb5447ee488b95adb531
refs/heads/master: 53c8f9f199b239668e6b1a907735ee323a0d1ccd
4 changes: 2 additions & 2 deletions trunk/include/linux/sched.h
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,7 @@ static inline int dequeue_signal_lock(struct task_struct *tsk, sigset_t *mask, s
spin_unlock_irqrestore(&tsk->sighand->siglock, flags);

return ret;
}
}

extern void block_all_signals(int (*notifier)(void *priv), void *priv,
sigset_t *mask);
Expand All @@ -2160,7 +2160,7 @@ extern int kill_pid_info_as_uid(int, struct siginfo *, struct pid *, uid_t, uid_
extern int kill_pgrp(struct pid *pid, int sig, int priv);
extern int kill_pid(struct pid *pid, int sig, int priv);
extern int kill_proc_info(int, struct siginfo *, pid_t);
extern int do_notify_parent(struct task_struct *, int);
extern bool do_notify_parent(struct task_struct *, int);
extern void __wake_up_parent(struct task_struct *p, struct task_struct *parent);
extern void force_sig(int, struct task_struct *);
extern int send_sig(int, struct task_struct *, int);
Expand Down
9 changes: 6 additions & 3 deletions trunk/kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,7 @@ static void forget_original_parent(struct task_struct *father)
static void exit_notify(struct task_struct *tsk, int group_dead)
{
int signal;
bool autoreap;
void *cookie;

/*
Expand Down Expand Up @@ -858,17 +859,19 @@ static void exit_notify(struct task_struct *tsk, int group_dead)

signal = tracehook_notify_death(tsk, &cookie, group_dead);
if (signal >= 0)
signal = do_notify_parent(tsk, signal);
autoreap = do_notify_parent(tsk, signal);
else
autoreap = (signal == DEATH_REAP);

tsk->exit_state = signal == DEATH_REAP ? EXIT_DEAD : EXIT_ZOMBIE;
tsk->exit_state = autoreap ? EXIT_DEAD : EXIT_ZOMBIE;

/* mt-exec, de_thread() is waiting for group leader */
if (unlikely(tsk->signal->notify_count < 0))
wake_up_process(tsk->signal->group_exit_task);
write_unlock_irq(&tasklist_lock);

/* If the process is dead, release it - nobody will wait for it */
if (signal == DEATH_REAP)
if (autoreap)
release_task(tsk);
}

Expand Down
17 changes: 9 additions & 8 deletions trunk/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,15 +1577,15 @@ int send_sigqueue(struct sigqueue *q, struct task_struct *t, int group)
* Let a parent know about the death of a child.
* For a stopped/continued status change, use do_notify_parent_cldstop instead.
*
* Returns -1 if our parent ignored us and so we've switched to
* self-reaping, or else @sig.
* Returns true if our parent ignored us and so we've switched to
* self-reaping.
*/
int do_notify_parent(struct task_struct *tsk, int sig)
bool do_notify_parent(struct task_struct *tsk, int sig)
{
struct siginfo info;
unsigned long flags;
struct sighand_struct *psig;
int ret = sig;
bool autoreap = false;

BUG_ON(sig == -1);

Expand Down Expand Up @@ -1649,16 +1649,17 @@ int do_notify_parent(struct task_struct *tsk, int sig)
* is implementation-defined: we do (if you don't want
* it, just use SIG_IGN instead).
*/
ret = tsk->exit_signal = -1;
autoreap = true;
tsk->exit_signal = -1;
if (psig->action[SIGCHLD-1].sa.sa_handler == SIG_IGN)
sig = -1;
sig = 0;
}
if (valid_signal(sig) && sig > 0)
if (valid_signal(sig) && sig)
__group_send_sig_info(sig, &info, tsk->parent);
__wake_up_parent(tsk, tsk->parent);
spin_unlock_irqrestore(&psig->siglock, flags);

return ret;
return autoreap;
}

/**
Expand Down

0 comments on commit e65783b

Please sign in to comment.