static void connect_to_server(void) { int ret = 0; cci_conn_attribute_t attr = CCI_CONN_ATTR_RO; recv_uri(); again: ret = cci_connect(endpoint, server_uri, &opts, sizeof(opts), attr, NULL, 0, NULL); check_return(endpoint, "cci_connect", ret, 1); while (!connection) { cci_event_t *event = NULL; ret = cci_get_event(endpoint, &event); if (ret == CCI_SUCCESS) { assert(event->type == CCI_EVENT_CONNECT); connection = event->connect.connection; if (!connection) { cci_return_event(event); fprintf(stderr, "Connecting to %s failed\n", server_uri); attempt *= 2; sleep(attempt); goto again; } cci_return_event(event); } } return; }
int CubTest(){ int nColCount = 0, nLen = 0; int i = 0, nDB = 0, nRet = 0, nReq = 0; char *pszBuff = NULL; T_CCI_COL_INFO *pcciCol; T_CCI_SQLX_CMD cciCmdType; assert((nDB = cci_connect(DB_SERVER, DB_PORT, DB_NAME, DB_USER_ID, DB_USER_PW)) >= 0); assert((nReq = cci_prepare(nDB, "SELECT * FROM athlete", 0, &cciErr)) >= 0); assert((pcciCol = cci_get_result_info(nReq, &cciCmdType, &nColCount)) != NULL); for (i = 1; i <= nColCount; i++) { printf("%s\t", CCI_GET_RESULT_INFO_NAME(pcciCol, i)); } printf("\n"); assert(cci_execute(nReq, 0, 0, &cciErr) >= 0); while (1) { if ( cci_cursor(nReq, 1, CCI_CURSOR_CURRENT, &cciErr) == CCI_ER_NO_MORE_DATA ) break; assert(cci_fetch(nReq, &cciErr) >= 0); for (i = 1; i<= nColCount; i++) { assert(cci_get_data(nReq, i, CCI_A_TYPE_STR, &pszBuff, &nLen) >= 0); printf("%s\t", pszBuff); } printf("\n"); } assert(cci_close_req_handle(nReq) >= 0); assert(cci_disconnect(nDB, &cciErr) >= 0); return 0; }
int DbConnect(){ int nDB; nDB = cci_connect(DB_SERVER, DB_PORT, DB_NAME, DB_USER_ID, DB_USER_PW); if(nDB >= 0){ output("DB Connected\n"); char buf[128]; cci_get_db_version(nDB,buf,128); output("DB Version : Cubrid %s\n", buf); return nDB; } else{ output("DB Connect failed (%d)\n", nDB); char msg[256]; cci_get_error_msg(nDB,NULL,msg,256); output(msg); return -1; } }
VALUE cubrid_conn_new(char *host, int port, char *db, char *user, char *passwd) { VALUE conn; Connection *c; int handle; handle = cci_connect(host, port, db, user, passwd); if (handle < 0) { cubrid_handle_error(handle, NULL); return Qnil; } conn = Data_Make_Struct(cConnection, Connection, 0, cubrid_conn_free, c); c->handle = handle; strcpy(c->host, host); c->port = port; strcpy(c->db, db); strcpy(c->user, user); c->auto_commit = Qfalse; return conn; }
static inline void do_client (void) { int ret; ret = cci_connect (ctl_ep, server_uri, &ctl_opts, sizeof (ctl_opts), attr, NULL, 0, NULL); check_return (ctl_ep, "cci_connect", ret, 1); while (!done) { poll_ctl_events (); if (endpoint != NULL) poll_events(); } if (connection == NULL) { fprintf (stderr, "Connection Rejected -- Test Successful\n"); } else { fprintf (stderr, "Connection Accepted -- Test fails\n"); } sleep (1); return; }
static void do_client(void) { int ret; uint32_t min = 0, max; struct timeval start, end; char *func; char *header = "Done"; /* initiate connect */ ret = cci_connect(endpoint, server_uri, &opts, sizeof(opts), attr, NULL, 0, NULL); check_return(endpoint, "cci_connect", ret, 1); /* poll for connect completion */ while (!connect_done) poll_events(); if (!connection) { fprintf(stderr, "no connection\n"); return; } while (!ready) poll_events(); if (opts.method == MSGS) { func = "cci_send"; max = connection->max_send_size; } else { func = "cci_rma"; max = opts.max_rma_size; } ret = posix_memalign((void **)&buffer, 4096, max); check_return(endpoint, "memalign buffer", ret, 1); memset(buffer, 'b', max); if (opts.method != MSGS) { int flags = 0; /* for the client, we want the opposite of the opts.method. * when testing RMA WRITE, we only need READ access. * when testing RMA READ, we need WRITE access. */ if (opts.method == RMA_WRITE) flags = CCI_FLAG_READ; else if (opts.method == RMA_READ) flags = CCI_FLAG_WRITE; ret = cci_rma_register(endpoint, buffer, max, flags, &local_rma_handle); check_return(endpoint, "cci_rma_register", ret, 1); fprintf(stderr, "local_rma_handle is %p\n", (void*)local_rma_handle); min = 1; if (opts.method == RMA_WRITE) opts.flags |= CCI_FLAG_WRITE; else opts.flags |= CCI_FLAG_READ; } if (remote_completion) { rmt_comp_msg = header; rmt_comp_len = 4; } if (opts.method == MSGS) printf("Bytes\t\tLatency (one-way)\tThroughput\n"); else printf("Bytes\t\tLatency (round-trip)\tThroughput\n"); /* begin communication with server */ for (current_size = min; current_size <= max;) { double lat = 0.0; double bw = 0.0; if (opts.method == MSGS) ret = cci_send(connection, buffer, current_size, NULL, opts.flags); else ret = cci_rma(connection, rmt_comp_msg, rmt_comp_len, local_rma_handle, 0, &opts.rma_handle, 0, current_size, (void *)1, opts.flags); check_return(endpoint, func, ret, 1); while (count < warmup) poll_events(); gettimeofday(&start, NULL); while (count < warmup + iters) poll_events(); gettimeofday(&end, NULL); if (opts.method == MSGS) lat = usecs(start, end) / (double)iters / 2.0; else lat = usecs(start, end) / (double)iters; bw = (double)current_size / lat; printf("%8d\t%8.2f us\t\t%8.2f MB/s\n", current_size, lat, bw); count = 0; if (current_size == 0) current_size++; else current_size *= 2; if (current_size >= 64 * 1024) { if (iters >= 32) iters /= 2; if (warmup >= 4) warmup /= 2; } } ret = cci_send(connection, "bye", 3, (void *)0xdeadbeef, opts.flags); check_return(endpoint, "cci_send", ret, 0); while (!done) poll_events(); if (opts.method != MSGS) { ret = cci_rma_deregister(endpoint, local_rma_handle); check_return(endpoint, "cci_rma_deregister", ret, 1); } printf("client done\n"); sleep(1); return; }
static void do_client(void) { int ret; uint32_t min = 1; /* initiate connect */ msg.request.type = MSG_CONTROL; ret = cci_connect(endpoint, server_uri, &msg, sizeof(msg.generic), attr, (void*)(uintptr_t)CONTROL, 0, NULL); check_return(endpoint, "cci_connect", ret, 1); msg.request.type = MSG_CONN_REQ; msg.request.opts = opts; ret = cci_connect(endpoint, server_uri, &msg, sizeof(msg.request), attr, (void*)(uintptr_t)TEST, 0, NULL); check_return(endpoint, "cci_connect", ret, 1); /* poll for connect completion */ while (!connect_done) poll_events(); if (!test) { fprintf(stderr, "no connection\n"); return; } while (!ready) poll_events(); ret = posix_memalign((void **)&buffer, 4096, opts.reg_len); check_return(endpoint, "memalign buffer", ret, 1); memset(buffer, 0xaa, opts.reg_len); init_buffer(1); print_buffer(buffer, (int) opts.reg_len); /* for the client, we do not need remote access flags */ ret = cci_rma_register(endpoint, buffer, opts.reg_len, 0, &local_rma_handle); check_return(endpoint, "cci_rma_register", ret, 1); if (opts.method == RMA_WRITE) opts.flags = CCI_FLAG_WRITE; else opts.flags = CCI_FLAG_READ; /* begin communication with server */ for (current_size = min; current_size <= length;) { void *ptr = (void*)((uintptr_t)buffer + local_offset); msg.check.type = MSG_RMA_CHK; msg.check.offset = remote_offset; msg.check.len = current_size; /* Compute the CRC only on a valid buffer */ if (current_size + local_offset <= opts.reg_len) msg.check.crc = crc32(0, ptr, current_size); else msg.check.crc = 0; msg_len = sizeof(msg.check); print_buffer(ptr, current_size); fprintf(stderr, "Testing length %9u ... ", current_size); ret = cci_rma(test, &msg, msg_len, local_rma_handle, local_offset, &remote_rma_handle, remote_offset, current_size, NULL, opts.flags); check_return(endpoint, "cci_rma", ret, 1); while (count < iters) poll_events(); if (test) fprintf(stderr, "success.\n"); else goto out; count = 0; current_size *= 2; if (current_size >= 64 * 1024) { if (iters >= 32) iters /= 2; } } out: ret = cci_send(control, "bye", 3, (void *)0xdeadbeef, 0); check_return(endpoint, "cci_send", ret, 0); while (!done) poll_events(); ret = cci_rma_deregister(endpoint, local_rma_handle); check_return(endpoint, "cci_rma_deregister", ret, 1); printf("client done\n"); sleep(1); return; }
static inline void poll_ctl_events (void) { cci_event_t *event; int ret; ret = cci_get_event (ctl_ep, &event); if (ret == CCI_SUCCESS) { switch (event->type) { case CCI_EVENT_CONNECT_REQUEST: ctl_opts = *((options_t *) event->request.data_ptr); ret = cci_accept (event, NULL); check_return (ctl_ep, "cci_accept", ret, 1); break; case CCI_EVENT_ACCEPT: ctl_conn = event->accept.connection; break; case CCI_EVENT_RECV: if (is_server && strncmp (event->recv.ptr, "start", 5) == 0) { printf ("Connection accepted, creating endpoint for testing...\n"); ret = cci_create_endpoint(NULL, 0, &endpoint, NULL); if (ret) { fprintf(stderr, "cci_create_endpoint() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } ret = cci_get_opt(endpoint, CCI_OPT_ENDPT_URI, &test_uri); if (ret) { fprintf(stderr, "cci_get_opt() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } ret = cci_send (ctl_conn, test_uri, strlen (test_uri), (void*)0xdeadfeeb, ctl_opts.flags); check_return(ctl_ep, "cci_send", ret, 0); printf("Opened %s\n", test_uri); } if (is_server && strncmp (event->recv.ptr, "bye", 3) == 0) { done = 1; } if (!is_server) { test_uri = strdup (event->recv.ptr); printf ("Opening a connection to %s\n", test_uri); ret = cci_create_endpoint(NULL, 0, &endpoint, NULL); if (ret) { fprintf(stderr, "cci_create_endpoint() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } ret = cci_get_opt(endpoint, CCI_OPT_ENDPT_URI, &uri); if (ret) { fprintf(stderr, "cci_get_opt() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } ret = cci_connect (endpoint, test_uri, &opts, sizeof (opts), attr, NULL, 0, NULL); check_return (endpoint, "cci_connect", ret, 1); } break; case CCI_EVENT_CONNECT: if (!is_server) { ctl_conn = event->connect.connection; printf ("Control connection established, simulating a conn_reject now...\n"); /* Send the start message */ ret = cci_send (ctl_conn, "start", 5, (void*)0xdeadbeed, ctl_opts.flags); check_return(ctl_ep, "cci_send", ret, 0); } break; case CCI_EVENT_SEND: break; default: fprintf (stderr, "Ignoring event type %d\n", event->type); } cci_return_event (event); } }
int main(int argc, char *argv[]) { cci_os_handle_t *fd = NULL; //endpoint 생성시, process를 block하는데 사용 cci_endpoint_t *endpoint = NULL; cci_connection_t *connection = NULL; int ret, c, ft_start = 0 , done = 0, i = 0, connect = 0; pthread_t send; uint32_t caps = 0;//?? char *server_uri = NULL; char id[16]=""; t_data thread_data; while ((c = getopt(argc, argv, "h:c:b")) != -1) { //client 실행시 option check switch (c) { case 'h': server_uri = strdup(optarg);//-h에 대한 인자를 가리키는 optarg 포인터가 생김 http://weed2758.tistory.com/entry/Linux-C-getopt-%ED%95%A8%EC%88%98 break; case 'c': if (strncasecmp ("ru", optarg, 2) == 0) attr = CCI_CONN_ATTR_RU; else if (strncasecmp ("ro", optarg, 2) == 0) attr = CCI_CONN_ATTR_RO; else if (strncasecmp ("uu", optarg, 2) == 0) attr = CCI_CONN_ATTR_UU; break; case 'b': flags |= CCI_FLAG_BLOCKING; break; default: fprintf(stderr, "usage: %s -h <server_uri> [-c <type>]\n", argv[0]); fprintf(stderr, "\t-c\tConnection type (UU, RU, or RO) " "set by client; RO by default\n"); exit(EXIT_FAILURE); } } if (!server_uri) { fprintf(stderr, "usage: %s -h <server_uri> [-c <type>]\n", argv[0]); fprintf(stderr, "\t-c\tConnection type (UU, RU, or RO) " "set by client; RO by default\n"); exit(EXIT_FAILURE); } ret = cci_init(CCI_ABI_VERSION, 0, &caps); if (ret) { fprintf(stderr, "cci_init() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } /* create an endpoint */ ret = cci_create_endpoint(NULL, 0, &endpoint, fd); if (ret) { fprintf(stderr, "cci_create_endpoint() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } if (ret) { fprintf(stderr, "cci_set_opt() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } /* initiate connect */ ret = cci_connect(endpoint, server_uri, "Connect request", 15, attr, CONNECT_CONTEXT, 0, NULL); if (ret) { fprintf(stderr, "cci_connect() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } while (!done) poll_events(endpoint, &connection, &done, id); if (!connection) exit(0); done = 0; thread_data.connection=connection; thread_data.flag=flags; thread_data.id=id; pthread_create(&send,NULL,send_msg,&thread_data); while(!done) poll_events(endpoint, &connection, &done, id); pthread_join(send,NULL); /* clean up */ ret = cci_destroy_endpoint(endpoint); if (ret) { fprintf(stderr, "cci_destroy_endpoint() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } ret = cci_finalize(); if (ret) { fprintf(stderr, "cci_finalize() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } return 0; }
int main(int argc, char *argv[]) { int done = 0, ret, i = 0, c; uint32_t caps = 0; char *server_uri = NULL; /* ip://1.2.3.4 */ char *uri = NULL; cci_os_handle_t fd; cci_endpoint_t *endpoint = NULL; cci_connection_t *connection = NULL; uint32_t timeout_us = 30 * 1000000; /* microseconds */ proc_name = argv[0]; while ((c = getopt(argc, argv, "h:")) != -1) { switch (c) { case 'h': server_uri = strdup(optarg); break; default: usage(); } } /* init */ ret = cci_init(CCI_ABI_VERSION, 0, &caps); if (ret) { fprintf(stderr, "cci_init() returned %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } /* create an endpoint */ ret = cci_create_endpoint(NULL, 0, &endpoint, &fd); if (ret) { fprintf(stderr, "cci_create_endpoint() returned %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } ret = cci_get_opt(endpoint, CCI_OPT_ENDPT_URI, &uri); if (ret) { fprintf(stderr, "cci_get_opt() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } printf("Opened %s\n", uri); /* set endpoint tx timeout */ cci_set_opt(endpoint, CCI_OPT_ENDPT_SEND_TIMEOUT, &timeout_us); if (ret) { fprintf(stderr, "cci_set_opt() returned %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } /* initiate connect */ ret = cci_connect(endpoint, server_uri, "Hello World!", 12, CCI_CONN_ATTR_UU, NULL, 0, NULL); if (ret) { fprintf(stderr, "cci_connect() returned %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } /* poll for connect completion */ while (!done) poll_events(endpoint, &connection, &done); if (!connection) { fprintf(stderr, "no connection\n"); exit(EXIT_FAILURE); } /* begin communication with server */ char *data; int max = connection->max_send_size; data = (char*)malloc(max); memset(data, 1, sizeof(data)); int len = 128; int repeat = 1000; while (len <= max) { s = cci_get_time(); for (i = 0; i < repeat; i++) { /* ret = cci_send(connection, data, (uint32_t) strlen(data), */ /* (void *)(uintptr_t) i, 0); */ ret = cci_send(connection, data, len, (void *)(uintptr_t) i, 0); if (ret > 0) { fprintf(stderr, "send %d returned %s\n", i, cci_strerror(endpoint, ret)); exit(1); } done = 0; while (!done) poll_events(endpoint, &connection, &done); } e = cci_get_time(); fprintf(stderr, "%d %f %f\n", len, (e - s) / repeat, (len / (e - s)) * repeat); len = len << 1; sleep(1); } /* clean up */ ret = cci_disconnect(connection); if (ret) { fprintf(stderr, "cci_disconnect() returned %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } ret = cci_destroy_endpoint(endpoint); if (ret) { fprintf(stderr, "cci_destroy_endpoint() returned %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } /* add cci_finalize() here */ return 0; }
int main(int argc, char *argv[]) { int done = 0, ret, i = 0, c; uint32_t caps = 0; char *server_uri = NULL; cci_os_handle_t *fd = NULL; cci_endpoint_t *endpoint = NULL; cci_connection_t *connection = NULL; uint32_t timeout = 30 * 1000000; while ((c = getopt(argc, argv, "h:c:b")) != -1) { switch (c) { case 'h': server_uri = strdup(optarg); break; case 'c': if (strncasecmp ("ru", optarg, 2) == 0) attr = CCI_CONN_ATTR_RU; else if (strncasecmp ("ro", optarg, 2) == 0) attr = CCI_CONN_ATTR_RO; else if (strncasecmp ("uu", optarg, 2) == 0) attr = CCI_CONN_ATTR_UU; break; case 'b': flags |= CCI_FLAG_BLOCKING; break; default: fprintf(stderr, "usage: %s -h <server_uri> [-c <type>]\n", argv[0]); fprintf(stderr, "\t-c\tConnection type (UU, RU, or RO) " "set by client; RO by default\n"); exit(EXIT_FAILURE); } } if (!server_uri) { fprintf(stderr, "usage: %s -h <server_uri> [-c <type>]\n", argv[0]); fprintf(stderr, "\t-c\tConnection type (UU, RU, or RO) " "set by client; RO by default\n"); exit(EXIT_FAILURE); } ret = cci_init(CCI_ABI_VERSION, 0, &caps); if (ret) { fprintf(stderr, "cci_init() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } /* create an endpoint */ ret = cci_create_endpoint(NULL, 0, &endpoint, fd); if (ret) { fprintf(stderr, "cci_create_endpoint() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } /* set conn tx timeout */ cci_set_opt(endpoint, CCI_OPT_ENDPT_SEND_TIMEOUT, &timeout); if (ret) { fprintf(stderr, "cci_set_opt() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } /* initiate connect */ ret = cci_connect(endpoint, server_uri, "Hello World!", 12, attr, CONNECT_CONTEXT, 0, NULL); if (ret) { fprintf(stderr, "cci_connect() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } /* poll for connect completion */ while (!done) poll_events(endpoint, &connection, &done); if (!connection) exit(0); done = 0; /* begin communication with server */ for (i = 0; i < iters; i++) { char data[128]; memset(data, 0, sizeof(data)); sprintf(data, "%4d", i); sprintf(data + 4, "Hello World!"); ret = cci_send(connection, data, (uint32_t) strlen(data) + 4, (void *)(uintptr_t) i, flags); if (ret) fprintf(stderr, "send %d failed with %s\n", i, cci_strerror(endpoint, ret)); if (flags & CCI_FLAG_BLOCKING) fprintf(stderr, "send %d completed with %d\n", i, ret); } if (flags == CCI_FLAG_BLOCKING) send_done = iters; while (!done) poll_events(endpoint, &connection, &done); ret = cci_send(connection, "bye", 3, (void *)(uintptr_t) iters, flags); if (ret) fprintf(stderr, "sending \"bye\" failed with %s\n", cci_strerror(endpoint, ret)); if (flags & CCI_FLAG_BLOCKING) done = 2; while (done != 2) poll_events(endpoint, &connection, &done); /* clean up */ ret = cci_destroy_endpoint(endpoint); if (ret) { fprintf(stderr, "cci_destroy_endpoint() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } ret = cci_finalize(); if (ret) { fprintf(stderr, "cci_finalize() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } return 0; }
void client(char *server_uri) { int num_connect = 0, ret, i = 0, c; uint32_t caps = 0; cci_os_handle_t *fd = NULL; cci_endpoint_t *endpoint = NULL; cci_connection_t *connection = NULL; uint32_t timeout = 10 * 1000000; int context[3] = {0, 1, 2}; struct timeval wait; ret = cci_init(CCI_ABI_VERSION, 0, &caps); if (ret) { fprintf(stderr, "cci_init() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } /* create an endpoint */ ret = cci_create_endpoint(NULL, 0, &endpoint, fd); if (ret) { fprintf(stderr, "cci_create_endpoint() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } /* set conn tx timeout */ cci_set_opt(endpoint, CCI_OPT_ENDPT_SEND_TIMEOUT, &timeout); if (ret) { fprintf(stderr, "cci_set_opt() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } ret = cci_connect(endpoint, server_uri, "Happy", 5, CCI_CONN_ATTR_UU, (int *) &context[0], 0, NULL); if (ret) { fprintf(stderr, "cci_connect(0) failed with %s\n", cci_strerror(endpoint, ret)); } ret = cci_connect(endpoint, server_uri, "New", 3, CCI_CONN_ATTR_UU, (int *) &context[1], 0, NULL); if (ret) { fprintf(stderr, "cci_connect(1) failed with %s\n", cci_strerror(endpoint, ret)); } wait.tv_sec = 2; wait.tv_usec = 0; ret = cci_connect(endpoint, server_uri, "Year", 4, CCI_CONN_ATTR_UU, (int *) &context[2], 0, &wait); if (ret) { fprintf(stderr, "cci_connect(2) failed with %s\n", cci_strerror(endpoint, ret)); } /* poll for connect completion */ //while (num_connect < 3) while (num_connect < 1) /* connect timeouts are not registering */ poll_events(endpoint, &connection, &num_connect); printf("test passed\n"); fflush(stdout); /* server has to close first to avoid hang */ sleep(5); client_cleanup: ret = cci_destroy_endpoint(endpoint); if (ret) { fprintf(stderr, "cci_destroy_endpoint() failed with %s\n", cci_strerror(endpoint, ret)); exit(EXIT_FAILURE); } ret = cci_finalize(); if (ret) { fprintf(stderr, "cci_finalize() failed with %s\n", cci_strerror(NULL, ret)); exit(EXIT_FAILURE); } }