Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JnVix-0003RL-JK for qemu-devel@nongnu.org; Sun, 20 Apr 2008 05:20:39 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JnViu-0003QJ-DV for qemu-devel@nongnu.org; Sun, 20 Apr 2008 05:20:37 -0400 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JnVit-0003Q5-Oe for qemu-devel@nongnu.org; Sun, 20 Apr 2008 05:20:36 -0400 Received: from [77.75.163.100] (helo=smtp.hotelhot.dk) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JnVit-0000Q3-Bg for qemu-devel@nongnu.org; Sun, 20 Apr 2008 05:20:35 -0400 From: Anders Melchiorsen Date: Sun, 20 Apr 2008 11:20:28 +0200 Message-Id: <12086832303963-git-send-email-mail@flac.kalibalik.dk> In-Reply-To: <12086832292508-git-send-email-mail@flac.kalibalik.dk> References: <12086832292508-git-send-email-mail@flac.kalibalik.dk> Subject: [Qemu-devel] [PATCH] Use SIGALRM even for timers delivered over a fd Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Anders Melchiorsen This ensures that all timers use the same signal, no matter how the underlying timer is implemented. It also frees up SIGIO for real I/O events. The patch is only relevant for Linux, hpet and rtc timers. Signed-off-by: Anders Melchiorsen diff --git a/vl.c b/vl.c index 78486cf..ad4f6ef 100644 --- a/vl.c +++ b/vl.c @@ -1241,7 +1241,7 @@ static uint64_t qemu_next_deadline(void) #define RTC_FREQ 1024 -static void enable_sigio_timer(int fd) +static void enable_sigalrm(int fd) { struct sigaction act; @@ -1250,8 +1250,9 @@ static void enable_sigio_timer(int fd) act.sa_flags = 0; act.sa_handler = host_alarm_handler; - sigaction(SIGIO, &act, NULL); + sigaction(SIGALRM, &act, NULL); fcntl(fd, F_SETFL, O_ASYNC); + fcntl(fd, F_SETSIG, SIGALRM); fcntl(fd, F_SETOWN, getpid()); } @@ -1288,7 +1289,7 @@ static int hpet_start_timer(struct qemu_alarm_timer *t) if (r < 0) goto fail; - enable_sigio_timer(fd); + enable_sigalrm(fd); t->priv = (void *)(long)fd; return 0; @@ -1326,7 +1327,7 @@ static int rtc_start_timer(struct qemu_alarm_timer *t) return -1; } - enable_sigio_timer(rtc_fd); + enable_sigalrm(rtc_fd); t->priv = (void *)(long)rtc_fd; -- 1.5.2.5