qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 2/2] block: avoid SIGUSR2


From: Frediano Ziglio
Subject: [Qemu-devel] [PATCH 2/2] block: avoid SIGUSR2
Date: Mon, 19 Sep 2011 13:54:17 +0200

Signed-off-by: Frediano Ziglio <address@hidden>
---
 cpus.c             |    5 -----
 posix-aio-compat.c |   14 ++++----------
 2 files changed, 4 insertions(+), 15 deletions(-)

diff --git a/cpus.c b/cpus.c
index 54c188c..d0cfe91 100644
--- a/cpus.c
+++ b/cpus.c
@@ -380,11 +380,6 @@ static int qemu_signal_init(void)
     int sigfd;
     sigset_t set;
 
-    /* SIGUSR2 used by posix-aio-compat.c */
-    sigemptyset(&set);
-    sigaddset(&set, SIGUSR2);
-    pthread_sigmask(SIG_UNBLOCK, &set, NULL);
-
     /*
      * SIG_IPI must be blocked in the main thread and must not be caught
      * by sigwait() in the signal thread. Otherwise, the cpu thread will
diff --git a/posix-aio-compat.c b/posix-aio-compat.c
index 7ea63a1..72c6dbb 100644
--- a/posix-aio-compat.c
+++ b/posix-aio-compat.c
@@ -308,6 +308,8 @@ static ssize_t handle_aiocb_rw(struct qemu_paiocb *aiocb)
     return nbytes;
 }
 
+static void posix_aio_notify_event(void);
+
 static void *aio_thread(void *unused)
 {
     pid_t pid;
@@ -380,7 +382,7 @@ static void *aio_thread(void *unused)
         aiocb->ret = ret;
         mutex_unlock(&lock);
 
-        if (kill(pid, SIGUSR2)) die("kill failed");
+        posix_aio_notify_event();
     }
 
     cur_threads--;
@@ -547,7 +549,7 @@ static int posix_aio_flush(void *opaque)
 
 static PosixAioState *posix_aio_state;
 
-static void aio_signal_handler(int signum)
+static void posix_aio_notify_event(void)
 {
     if (posix_aio_state) {
         char byte = 0;
@@ -557,8 +559,6 @@ static void aio_signal_handler(int signum)
         if (ret < 0 && errno != EAGAIN)
             die("write()");
     }
-
-    qemu_service_io();
 }
 
 static void paio_remove(struct qemu_paiocb *acb)
@@ -662,7 +662,6 @@ BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,
 
 int paio_init(void)
 {
-    struct sigaction act;
     PosixAioState *s;
     int fds[2];
     int ret;
@@ -672,11 +671,6 @@ int paio_init(void)
 
     s = g_malloc(sizeof(PosixAioState));
 
-    sigfillset(&act.sa_mask);
-    act.sa_flags = 0; /* do not restart syscalls to interrupt select() */
-    act.sa_handler = aio_signal_handler;
-    sigaction(SIGUSR2, &act, NULL);
-
     s->first_aio = NULL;
     if (qemu_pipe(fds) == -1) {
         fprintf(stderr, "failed to create pipe\n");
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]