Exemple #1
0
static void switch_logdirty_done(libxl__egc *egc,
                                 libxl__logdirty_switch *lds,
                                 int rc)
{
    STATE_AO_GC(lds->ao);

    libxl__ev_xswatch_deregister(gc, &lds->watch);
    libxl__ev_time_deregister(gc, &lds->timeout);

    lds->callback(egc, lds, rc);
}
Exemple #2
0
static void occurs(libxl__egc *egc, libxl__ev_time *ev,
                   const struct timeval *requested_abs)
{
    EGC_GC;
    int i;

    int off = ev - &et[0][0];
    LOG(DEBUG,"occurs[%d][%d] seq=%d", off/NTIMES, off%NTIMES, seq);

    switch (seq) {
    case 0:
        assert(ev == &et[0][1]);
        libxl__ev_time_deregister(gc, &et[0][0]);
        libxl__ev_time_deregister(gc, &et[0][2]);
        regs(gc, 1);
        libxl__ev_time_deregister(gc, &et[0][1]);
        break;

    case 1:
    case 2:
        assert(ev == &et[1][seq-1]);
        break;
        
    case 3:
        assert(ev == &et[1][2]);
        for (i=0; i<NTIMES; i++) {
            assert(!libxl__ev_time_isregistered(&et[0][i]));
            assert(!libxl__ev_time_isregistered(&et[1][i]));
        }
        libxl__ao_complete(egc, tao, 0);
        return;

    default:
        abort();
    }

    seq++;
}
Exemple #3
0
static void async_exec_done(libxl__egc *egc,
                            libxl__ev_child *child,
                            pid_t pid, int status)
{
    libxl__async_exec_state *aes = CONTAINER_OF(child, *aes, child);
    STATE_AO_GC(aes->ao);

    libxl__ev_time_deregister(gc, &aes->time);

    if (status) {
        if (!aes->rc)
            libxl_report_child_exitstatus(CTX, LIBXL__LOG_ERROR,
                                          aes->what, pid, status);
    }

    aes->callback(egc, aes, aes->rc, status);
}
Exemple #4
0
static void async_exec_timeout(libxl__egc *egc,
                               libxl__ev_time *ev,
                               const struct timeval *requested_abs,
                               int rc)
{
    libxl__async_exec_state *aes = CONTAINER_OF(ev, *aes, time);
    STATE_AO_GC(aes->ao);

    if (!aes->rc)
        aes->rc = rc;

    libxl__ev_time_deregister(gc, &aes->time);

    assert(libxl__ev_child_inuse(&aes->child));
    LOG(ERROR, "killing execution of %s because of timeout", aes->what);

    if (kill(aes->child.pid, SIGKILL)) {
        LOGEV(ERROR, errno, "unable to kill %s [%ld]",
              aes->what, (unsigned long)aes->child.pid);
    }

    return;
}
Exemple #5
0
void libxl__xswait_stop(libxl__gc *gc, libxl__xswait_state *xswa)
{
    libxl__ev_time_deregister(gc, &xswa->time_ev);
    libxl__ev_xswatch_deregister(gc, &xswa->watch_ev);
}