lkml.org 
[lkml]   [2008]   [May]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/3] signals: introduce SIGQUEUE_CANCELLED
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;


\
 
 \ /
  Last update: 2008-05-17 17:19    [W:0.025 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site