Exemplo n.º 1
0
Arquivo: tx.c Projeto: Kampbell/lixa
int tx_open(void)
{
    int txrc = TX_FAIL;
    lixa_tx_open(&txrc, FALSE);
    return txrc;
}
Exemplo n.º 2
0
int main(int argc, char **argv)
{
    LIXA_TRACE_INIT;
    LIXA_CRASH_INIT;

    LIXA_TRACE(("lixatpm/main: starting\n"));

    GOptionContext *option_context = g_option_context_new(
        "- LIXA transaction process monitor client");
    g_option_context_add_main_entries(option_context, entries, NULL);

    GError *error = NULL;
    if (!g_option_context_parse(option_context, &argc, &argv, &error)) {
        fprintf(stderr, "lixatpm/options: failed=%s\n",
                error->message);

        LIXA_TRACE(("lixatpm/main: exiting\n"));

        return EXIT_FAILURE;
    }

    g_option_context_free(option_context);

    if (!report) {
        LIXA_TRACE(("lixatpm/main: exiting\n"));

        return EXIT_FAILURE;
    }

    /* initialise libxml2 library */
    LIBXML_TEST_VERSION;

    /* open the resource managers for the current profile */
    int tx_rc;
    lixa_tx_open(&tx_rc, TRUE);
    if (TX_OK != tx_rc) {
        LIXA_TRACE(("lixatpm/lixa_tx_open: tx_rc=%d\n", tx_rc));

        lixa_tx_close(&tx_rc);
        LIXA_TRACE(("lixatpm/lixa_tx_close: tx_rc=%d\n", tx_rc));

        LIXA_TRACE(("lixatpm/main: exiting\n"));

        return EXIT_FAILURE;
    }

    int rc = LIXA_RC_OK;
    int ret_cod = EXIT_SUCCESS;
    GArray *xida = g_array_new(FALSE, FALSE, sizeof(char *));
    if (LIXA_RC_OK != (rc = lixa_tx_tpm(xida, TRUE, report, FALSE))) {
        LIXA_TRACE(("lixatpm/lixa_tx_tpm: rc=%d/%s\n", rc, lixa_strerror(rc)));

        ret_cod = EXIT_FAILURE;
    }
    g_array_free(xida, TRUE);

    lixa_tx_close(&tx_rc);
    LIXA_TRACE(("lixatpm/lixa_tx_close: tx_rc=%d\n", tx_rc));
    LIXA_TRACE(("lixatpm/main: exiting, ret_code=%d\n", ret_cod));

    return ret_cod;
}