From: Jan Kiszka <jan.kiszka@siemens.com>
To: Steven Rostedt <srostedt@redhat.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-trace-users@vger.kernel.org
Subject: [PATCH] trace-cmd: Plug startup race between flush_threads and recorders
Date: Fri, 15 Oct 2010 13:50:51 +0200 [thread overview]
Message-ID: <4CB8401B.2020801@siemens.com> (raw)
As the SIGUSR1 handler is so far registered after forking the recorder
child, there is a small race window where a flush sent by the main
process can actually kill the child. Plug this by registering the signal
handlers before the fork. This also allows to unify SIGINT registration.
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
trace-cmd.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/trace-cmd.c b/trace-cmd.c
index 9cbe362..f8992a8 100644
--- a/trace-cmd.c
+++ b/trace-cmd.c
@@ -1089,6 +1089,8 @@ static int create_recorder(int cpu)
char *file;
int pid;
+ signal(SIGUSR1, flush);
+
pid = fork();
if (pid < 0)
die("fork");
@@ -1096,9 +1098,6 @@ static int create_recorder(int cpu)
if (pid)
return pid;
- signal(SIGINT, finish);
- signal(SIGUSR1, flush);
-
if (rt_prio)
set_prio(rt_prio);
@@ -1694,9 +1693,9 @@ int main (int argc, char **argv)
set_options();
if (record || extract) {
+ signal(SIGINT, finish);
if (!latency)
start_threads();
- signal(SIGINT, finish);
}
if (extract) {
--
1.7.1
next reply other threads:[~2010-10-15 11:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-15 11:50 Jan Kiszka [this message]
2010-10-15 16:33 ` [PATCH] trace-cmd: Plug startup race between flush_threads and recorders Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4CB8401B.2020801@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-trace-users@vger.kernel.org \
--cc=srostedt@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.