示例#1
0
文件: flux.c 项目: cigolabs/flux-core
flux_t builtin_get_flux_handle (optparse_t *p)
{
    flux_t h = NULL;
    if ((h = optparse_get_data (p, "flux_t")))
        flux_incref (h);
    else if ((h = flux_open (NULL, 0)) == NULL)
        log_err_exit ("flux_open");
    return h;
}
示例#2
0
flux_t *flux_clone (flux_t *orig)
{
    if (!orig) {
        errno = EINVAL;
        return NULL;
    }
    flux_t *h = calloc (1, sizeof (*h));
    if (!h)
        goto nomem;
    h->parent = orig;
    h->usecount = 1;
    h->flags = orig->flags | FLUX_O_CLONE;
    flux_incref (orig);
    return h;
nomem:
    free (h);
    errno = ENOMEM;
    return NULL;
}