Exemplo n.º 1
0
static void helper_exited(libxl__egc *egc, libxl__ev_child *ch,
                          pid_t pid, int status)
{
    libxl__save_helper_state *shs = CONTAINER_OF(ch, *shs, child);
    STATE_AO_GC(shs->ao);

    /* Convenience aliases */
    const uint32_t domid = shs->domid;

    const char *what =
        GCSPRINTF("domain %"PRIu32" save/restore helper", domid);

    if (status) {
        libxl_report_child_exitstatus(CTX, XTL_ERROR, what, pid, status);
        shs->rc = ERROR_FAIL;
    }

    if (shs->need_results) {
        if (!shs->rc)
            LOG(ERROR,"%s exited without providing results",what);
        shs->rc = ERROR_FAIL;
    }

    if (!shs->completed) {
        if (!shs->rc)
            LOG(ERROR,"%s exited without signaling completion",what);
        shs->rc = ERROR_FAIL;
    }

    helper_done(egc, shs);
    return;
}
Exemplo n.º 2
0
static void helper_failed(libxl__egc *egc, libxl__save_helper_state *shs,
                          int rc)
{
    STATE_AO_GC(shs->ao);

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

    libxl__ev_fd_deregister(gc, &shs->readable);

    if (!libxl__save_helper_inuse(shs)) {
        helper_done(egc, shs);
        return;
    }

    libxl__kill(gc, shs->child.pid, SIGKILL, "save/restore helper");
}
Exemplo n.º 3
0
static void helper_failed(libxl__egc *egc, libxl__save_helper_state *shs,
                          int rc)
{
    STATE_AO_GC(shs->ao);

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

    libxl__ev_fd_deregister(gc, &shs->readable);

    if (!libxl__ev_child_inuse(&shs->child)) {
        helper_done(egc, shs);
        return;
    }

    int r = kill(shs->child.pid, SIGKILL);
    if (r) LOGE(WARN, "failed to kill save/restore helper [%lu]",
                (unsigned long)shs->child.pid);
}