Example #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;
}
static void report_spawn_intermediate_status(libxl_ctx *ctx,
                                 libxl__spawn_starting *for_spawn,
                                 int status)
{
    if (!WIFEXITED(status)) {
        char *intermediate_what;
        /* intermediate process did the logging itself if it exited */
        if ( asprintf(&intermediate_what,
                 "%s intermediate process (startup monitor)",
                 for_spawn->what) < 0 )
            intermediate_what = "intermediate process (startup monitor)";
        libxl_report_child_exitstatus(ctx, LIBXL__LOG_ERROR, intermediate_what,
                                      for_spawn->intermediate, status);
    }
}
Example #3
0
static void openpty_exited(libxl__egc *egc, libxl__ev_child *child,
                           pid_t pid, int status) {
    libxl__openpty_state *op = CONTAINER_OF(child, *op, child);
    STATE_AO_GC(op->ao);

    if (status) {
        /* Perhaps the child gave us the fds and then exited nonzero.
         * Well that would be odd but we don't really care. */
        libxl_report_child_exitstatus(CTX, op->rc ? LIBXL__LOG_ERROR
                                                  : LIBXL__LOG_WARNING,
                                      "openpty child", pid, status);
    }
    if (op->rc)
        openpty_cleanup(op);
    op->callback(egc, op);
}
Example #4
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);
}
Example #5
0
static void bootloader_finished(libxl__egc *egc, libxl__ev_child *child,
                                pid_t pid, int status)
{
    libxl__bootloader_state *bl = CONTAINER_OF(child, *bl, child);
    STATE_AO_GC(bl->ao);
    int rc;

    libxl__datacopier_kill(&bl->keystrokes);
    libxl__datacopier_kill(&bl->display);

    if (status) {
        if (bl->got_pollhup && WIFSIGNALED(status) && WTERMSIG(status)==SIGTERM)
            LOG(ERROR, "got POLLHUP, sent SIGTERM");
        LOG(ERROR, "bootloader failed - consult logfile %s", bl->logfile);
        libxl_report_child_exitstatus(CTX, XTL_ERROR, "bootloader",
                                      pid, status);
        rc = ERROR_FAIL;
        goto out;
    } else {
        LOG(DEBUG, "bootloader completed");
    }

    if (bl->rc) {
        /* datacopier went wrong */
        rc = bl->rc;
        goto out;
    }

    rc = parse_bootloader_result(egc, bl);
    if (rc) goto out;

    rc = 0;
    LOG(DEBUG, "bootloader execution successful");

out:
    bootloader_callback(egc, bl, rc);
}
Example #6
0
File: xl.c Project: Chong-Li/xen
void xl_report_child_exitstatus(xentoollog_level level,
                                xlchildnum child, pid_t pid, int status)
{
    libxl_report_child_exitstatus(ctx, level, children[child].description,
                                  pid, status);
}