mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
Avoid pthread_sigmask on Win32 platforms
Win32 doesn't have a concept of signal masks so disable that code. It is unclear how SIGINT is delivered (if at all) on Win32, so this might further work to provide an alternative to pthread_sigmask * tools/virsh.c: Avoid pthread_sigmask on Win32
This commit is contained in:
parent
eacb3bb02a
commit
100f4a63a2
@ -3489,15 +3489,17 @@ doMigrate (void *opaque)
|
|||||||
const char *migrateuri;
|
const char *migrateuri;
|
||||||
const char *dname;
|
const char *dname;
|
||||||
int flags = 0, found;
|
int flags = 0, found;
|
||||||
sigset_t sigmask, oldsigmask;
|
|
||||||
vshCtrlData *data = opaque;
|
vshCtrlData *data = opaque;
|
||||||
vshControl *ctl = data->ctl;
|
vshControl *ctl = data->ctl;
|
||||||
const vshCmd *cmd = data->cmd;
|
const vshCmd *cmd = data->cmd;
|
||||||
|
#if HAVE_PTHREAD_SIGMASK
|
||||||
|
sigset_t sigmask, oldsigmask;
|
||||||
|
|
||||||
sigemptyset(&sigmask);
|
sigemptyset(&sigmask);
|
||||||
sigaddset(&sigmask, SIGINT);
|
sigaddset(&sigmask, SIGINT);
|
||||||
if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
|
if (pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask) < 0)
|
||||||
goto out_sig;
|
goto out_sig;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!vshConnectionUsability (ctl, ctl->conn))
|
if (!vshConnectionUsability (ctl, ctl->conn))
|
||||||
goto out;
|
goto out;
|
||||||
@ -3563,8 +3565,10 @@ doMigrate (void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
#if HAVE_PTHREAD_SIGMASK
|
||||||
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
|
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
|
||||||
out_sig:
|
out_sig:
|
||||||
|
#endif
|
||||||
if (dom) virDomainFree (dom);
|
if (dom) virDomainFree (dom);
|
||||||
ignore_value(safewrite(data->writefd, &ret, sizeof(ret)));
|
ignore_value(safewrite(data->writefd, &ret, sizeof(ret)));
|
||||||
}
|
}
|
||||||
@ -3607,12 +3611,16 @@ cmdMigrate (vshControl *ctl, const vshCmd *cmd)
|
|||||||
struct sigaction old_sig_action;
|
struct sigaction old_sig_action;
|
||||||
virDomainJobInfo jobinfo;
|
virDomainJobInfo jobinfo;
|
||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
sigset_t sigmask, oldsigmask;
|
|
||||||
int timeout;
|
int timeout;
|
||||||
struct timeval start, curr;
|
struct timeval start, curr;
|
||||||
bool live_flag = false;
|
bool live_flag = false;
|
||||||
|
|
||||||
vshCtrlData data;
|
vshCtrlData data;
|
||||||
|
#if HAVE_PTHREAD_SIGMASK
|
||||||
|
sigset_t sigmask, oldsigmask;
|
||||||
|
|
||||||
|
sigemptyset(&sigmask);
|
||||||
|
sigaddset(&sigmask, SIGINT);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
if (!(dom = vshCommandOptDomain(ctl, cmd, NULL)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -3665,8 +3673,6 @@ cmdMigrate (vshControl *ctl, const vshCmd *cmd)
|
|||||||
pollfd.fd = p[0];
|
pollfd.fd = p[0];
|
||||||
pollfd.events = POLLIN;
|
pollfd.events = POLLIN;
|
||||||
pollfd.revents = 0;
|
pollfd.revents = 0;
|
||||||
sigemptyset(&sigmask);
|
|
||||||
sigaddset(&sigmask, SIGINT);
|
|
||||||
|
|
||||||
GETTIMEOFDAY(&start);
|
GETTIMEOFDAY(&start);
|
||||||
while (1) {
|
while (1) {
|
||||||
@ -3709,9 +3715,13 @@ repoll:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
|
#if HAVE_PTHREAD_SIGMASK
|
||||||
pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask);
|
pthread_sigmask(SIG_BLOCK, &sigmask, &oldsigmask);
|
||||||
|
#endif
|
||||||
ret = virDomainGetJobInfo(dom, &jobinfo);
|
ret = virDomainGetJobInfo(dom, &jobinfo);
|
||||||
|
#if HAVE_PTHREAD_SIGMASK
|
||||||
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
|
pthread_sigmask(SIG_SETMASK, &oldsigmask, NULL);
|
||||||
|
#endif
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
print_job_progress(jobinfo.dataRemaining, jobinfo.dataTotal);
|
print_job_progress(jobinfo.dataRemaining, jobinfo.dataTotal);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user