Suggested by Linus Torvalds.
Introduce SIGQUEUE_CANCELLED flag. If it is set, the pending signal should be
ignored and collect_signal() should return 0.
Note that the new flag is completely orthogonal to SIGQUEUE_PREALLOC, and it
can be set without ->siglock held.
No users of this new flag yet, see the next patch.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
--- 25/include/linux/signal.h~5_INTRODUCE_CANCELLED 2008-03-04 21:43:25.000000000 +0300
+++ 25/include/linux/signal.h 2008-03-04 21:43:25.000000000 +0300
@@ -20,6 +20,7 @@ struct sigqueue {
/* flags values. */
#define SIGQUEUE_PREALLOC 1
+#define SIGQUEUE_CANCELLED 2
struct sigpending {
struct list_head list;
--- 25/kernel/signal.c~5_INTRODUCE_CANCELLED 2008-05-17 17:14:04.000000000 +0400
+++ 25/kernel/signal.c 2008-05-17 17:40:09.000000000 +0400
@@ -326,11 +326,13 @@ static int collect_signal(int sig, struc
}
}
if (first) {
- list_del_init(&first->list);
- copy_siginfo(info, &first->info);
- __sigqueue_free(first);
if (!still_pending)
sigdelset(&list->signal, sig);
+ if (unlikely(first->flags & SIGQUEUE_CANCELLED))
+ sig = 0;
+ copy_siginfo(info, &first->info);
+ list_del_init(&first->list);
+ __sigqueue_free(first);
} else {
/* Ok, it wasn't in the queue. This must be
@@ -344,7 +346,7 @@ static int collect_signal(int sig, struc
info->si_pid = 0;
info->si_uid = 0;
}
- return 1;
+ return sig;
}
static int __dequeue_signal(struct sigpending *pending, sigset_t *mask,
@@ -362,8 +364,7 @@ static int __dequeue_signal(struct sigpe
}
}
- if (!collect_signal(sig, pending, info))
- sig = 0;
+ sig = collect_signal(sig, pending, info);
}
return sig;
--
| Greg Kroah-Hartman | [PATCH 001/196] Chinese: Add the known_regression URI to the HOWTO |
| Cabot, Mason B | Ext3 vs NTFS performance |
| david | Re: Dual-Licensing Linux Kernel with GPL V2 and GPL V3 |
| Alan Cox | [PATCH 00/76] Queued TTY Patches |
git: | |
| Nguyen Thai Ngoc Duy | Re: VCS comparison table |
| Ken Pratt | Re: pack operation is thrashing my server |
| Wink Saville | Using git with Eclipse |
| Bill Lear | Meaning of "fatal: protocol error: bad line length character"? |
| Steve Shockley | Re: Real men don't attack straw men |
| Mayuresh Kathe | Re: What is our ultimate goal?? |
| frantisek holop | booting openbsd on eee without cd-rom |
| Didier Wiroth | how can I "find xyz | xargs tar" ... like gtar |
| David Miller | [GIT]: Networking |
| Sven Wegener | [PATCH 2/5] ipvs: Use ERR_PTR for returning errors from make_receive_sock() and ma... |
| Ingo Molnar | Re: [bug, netconsole, SLUB] BUG skbuff_head_cache: Poison overwritten |
| Herbert Xu | Re: [PATCH 2/3] [UDP]: Restore missing inDatagrams increments |
