From: Anders Melchiorsen <mail@flac.kalibalik.dk>
To: qemu-devel@nongnu.org
Cc: Anders Melchiorsen <mail@flac.kalibalik.dk>
Subject: [Qemu-devel] [PATCH] Use SIGALRM even for timers delivered over a fd
Date: Sun, 20 Apr 2008 11:20:28 +0200 [thread overview]
Message-ID: <12086832303963-git-send-email-mail@flac.kalibalik.dk> (raw)
In-Reply-To: <12086832292508-git-send-email-mail@flac.kalibalik.dk>
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 <mail@flac.kalibalik.dk>
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
next prev parent reply other threads:[~2008-04-20 9:20 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-20 9:20 [Qemu-devel] Linux SIGIO handling changes Anders Melchiorsen
2008-04-20 9:20 ` Anders Melchiorsen [this message]
2008-04-20 9:20 ` [Qemu-devel] [PATCH] Use SIGIO in Linux host Anders Melchiorsen
2008-04-20 22:04 ` [Qemu-devel] Linux SIGIO handling changes Anthony Liguori
2008-04-21 13:37 ` Avi Kivity
2008-04-21 15:43 ` Anthony Liguori
2008-04-21 16:13 ` Paul Brook
2008-04-21 18:48 ` Anthony Liguori
2008-04-22 8:02 ` Avi Kivity
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=12086832303963-git-send-email-mail@flac.kalibalik.dk \
--to=mail@flac.kalibalik.dk \
--cc=qemu-devel@nongnu.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).