Beispiel #1
0
static void
printWalkHistory (
    c_object o,
    c_iterActionArg arg)
{
    c_type type;
    c_char *name, *ename;

    if (o) {
        type = c_getType(o);
        name = c_metaScopedName(c_metaObject(type));
        printf("<0x%x> %s",(HEXVALUE)o,name);
        if (c_checkType(o, "v_entity") == o) {
            ename = v_entityName(o);
            if (ename != NULL) {
                printf(" /* %s */", ename);
            }
        } else if (c_checkType(o, "c_metaObject") == o) {
            ename = c_metaScopedName(o);
            if (ename != NULL) {
                printf(" /* %s */", ename);
                os_free(ename);
            }
        }
        printf("\n");
    } else {
        printf("<0x0>\n");
    }
}
Beispiel #2
0
d_storeMMFKernel
d_storeMMFKernelAttach (
    c_base base,
    const c_char *name)
{
    d_storeMMFKernel kernel = NULL;

    if (name == NULL) {
        OS_REPORT(OS_ERROR,
                  "d_storeMMFKernelAttach",0,
                  "Failed to lookup kernel, specified kernel name = <NULL>");
    } else {
        kernel = c_lookup(base,name);
        if (kernel == NULL) {
            OS_REPORT_1(OS_ERROR,
                        "d_storeMMFKernelAttach",0,
                        "Failed to lookup kernel '%s' in Database",
                        name);
        } else if (c_checkType(kernel,"d_storeMMFKernel") != kernel) {
            c_free(kernel);
            kernel = NULL;
            OS_REPORT_1(OS_ERROR,
                        "d_storeMMFKernelAttach",0,
                        "Object '%s' is apparently not of type 'd_storeMMFKernel'",
                        name);
        }
    }
    return kernel;
}
Beispiel #3
0
v_kernel
v_kernelAttach(
    c_base base,
    const c_char *name)
{
    v_kernel kernel = NULL;
    os_uint32 attachCount;

    if (name == NULL) {
        OS_REPORT(OS_ERROR,
                  "v_kernelAttach",0,
                  "Failed to lookup kernel, specified kernel name = <NULL>");
    } else {
        kernel = c_lookup(base,name);
        if (kernel == NULL) {
            OS_REPORT_1(OS_ERROR,
                        "v_kernelAttach",0,
                        "Failed to lookup kernel '%s' in Database",
                        name);
        } else if (c_checkType(kernel,"v_kernel") != kernel) {
            c_free(kernel);
            kernel = NULL;
            OS_REPORT_1(OS_ERROR,
                        "v_kernelAttach",0,
                        "Object '%s' is apparently not of type 'v_kernel'",
                        name);
        } else {
            attachCount = pa_increment(&kernel->userCount);
            if(attachCount == 1){
                /* Result of the attach may NEVER be 1, as that would mean that an
                 * attach to an unreferenced kernel succeeded. If it happens, undo
                 * increment and free reference to returned kernel. */
                pa_decrement(&kernel->userCount);
                c_free(kernel);
                kernel = NULL;
                OS_REPORT_1(OS_ERROR,
                            "v_kernelAttach",0,
                            "Operation aborted: Object '%s' is apparently an "
                            "unreferenced kernel object.",
                            name);
            }
        }
    }

    return kernel;
}
Beispiel #4
0
static void
printHistory (
    c_iter history,
    c_long cursor)
{
    c_type type;
    c_object o;
    c_char *name, *ename;

    o = c_iterObject(history,cursor-1);
    type = c_getType(o);
    name = c_metaScopedName(c_metaObject(type));
    printf("<0x%x> %s",(HEXVALUE)o,name);
    if (c_checkType(o, "v_entity") == o) {
        ename = v_entityName(o);
        if (ename != NULL) {
            printf(" /* %s */", ename);
        }
    }
    printf("\n");
}