Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JPId5-0005WL-Ku for qemu-devel@nongnu.org; Wed, 13 Feb 2008 09:30:31 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JPId3-0005W9-0L for qemu-devel@nongnu.org; Wed, 13 Feb 2008 09:30:31 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JPId2-0005W6-Pu for qemu-devel@nongnu.org; Wed, 13 Feb 2008 09:30:28 -0500 Received: from 0xc2c0b63d.fbbft3nxf1.bf-dhcp.tele.dk ([194.192.182.61] helo=smtp.hotelhot.dk) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JPId2-0005zR-Cq for qemu-devel@nongnu.org; Wed, 13 Feb 2008 09:30:28 -0500 Received: from smtp.hotelhot.dk (localhost [127.0.0.1]) by smtp.hotelhot.dk (Postfix) with ESMTP id 80707140C5 for ; Wed, 13 Feb 2008 15:30:25 +0100 (CET) Received: from kalibalik.dk (router.kalibalik.dk [192.168.0.1]) by smtp.hotelhot.dk (Postfix) with SMTP id 53880140C4 for ; Wed, 13 Feb 2008 15:30:24 +0100 (CET) From: Anders Melchiorsen Date: Wed, 13 Feb 2008 15:30:23 +0100 Message-ID: <87skzxornk.fsf@dylle.kalibalik.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Use SIGALRM for all timers 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 I wonder if this patch makes sense, using SIGALRM for all kinds of timers, even those expiring through a file descriptor? It seems more clean to me to always use SIGALRM for alarms, but the actual trigger for this change was to free up SIGIO for KVM. Unfortunately, I have been unable to test it myself yet, as the HPET and RTC timers both do not work on my system. If I get feedback that this approach is not good, I will not spend the time on getting those timers to behave. Best regards, Anders. diff --git a/vl.c b/vl.c index c87e8bc..d94302d 100644 --- a/vl.c +++ b/vl.c @@ -1240,7 +1240,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; @@ -1249,8 +1249,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()); } @@ -1287,7 +1288,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; @@ -1325,7 +1326,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;