[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] Odd code in cpus.c
From: |
Frediano Ziglio |
Subject: |
[Qemu-devel] Odd code in cpus.c |
Date: |
Fri, 29 Jul 2011 10:34:01 +0200 |
I don't know that much this code however qemu_kvm_init_cpu_signals
seems a bit strange and duplicate to me, in cpus.c
static void qemu_kvm_init_cpu_signals(CPUState *env)
{
int r;
sigset_t set;
struct sigaction sigact;
memset(&sigact, 0, sizeof(sigact));
sigact.sa_handler = dummy_signal;
sigaction(SIG_IPI, &sigact, NULL);
#ifdef CONFIG_IOTHREAD
pthread_sigmask(SIG_BLOCK, NULL, &set);
sigdelset(&set, SIG_IPI);
sigdelset(&set, SIGBUS);
r = kvm_set_signal_mask(env, &set);
if (r) {
fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
exit(1);
}
#else
sigemptyset(&set);
sigaddset(&set, SIG_IPI);
sigaddset(&set, SIGIO);
sigaddset(&set, SIGALRM);
pthread_sigmask(SIG_BLOCK, &set, NULL);
pthread_sigmask(SIG_BLOCK, NULL, &set);
sigdelset(&set, SIGIO);
sigdelset(&set, SIGALRM);
#endif
sigdelset(&set, SIG_IPI);
sigdelset(&set, SIGBUS);
r = kvm_set_signal_mask(env, &set);
if (r) {
fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
exit(1);
}
}
if CONFIG_IOTHREAD is set you get
static void qemu_kvm_init_cpu_signals(CPUState *env)
{
int r;
sigset_t set;
struct sigaction sigact;
memset(&sigact, 0, sizeof(sigact));
sigact.sa_handler = dummy_signal;
sigaction(SIG_IPI, &sigact, NULL);
pthread_sigmask(SIG_BLOCK, NULL, &set);
sigdelset(&set, SIG_IPI);
sigdelset(&set, SIGBUS);
r = kvm_set_signal_mask(env, &set);
if (r) {
fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
exit(1);
}
sigdelset(&set, SIG_IPI);
sigdelset(&set, SIGBUS);
r = kvm_set_signal_mask(env, &set);
if (r) {
fprintf(stderr, "kvm_set_signal_mask: %s\n", strerror(-r));
exit(1);
}
}
which seems to set kvm signal twice with same values (taking into
account that in kvm_set_signal_mask the set is copied before the call
to kvm_vcpu_ioctl).
Frediano
- [Qemu-devel] Odd code in cpus.c,
Frediano Ziglio <=