/* * Synchronous method function for * operation 'CEERCV_SystemMessage' */ extern "C" void CEERCV_SystemMessage_sme_( /* In */ CEE_tag_def objtag_ , /* In */ const CEE_handle_def *call_id_ , /* Out */ CEERCV_SystemMessage_exc_ *exception_ , /* In */ const FS_Receiveinfo_Type *receiveInfo , /* In */ const CEERCV_SystemMessage_request_seq_ *request , /* Out */ IDL_short *error , /* Out */ CEERCV_SystemMessage_reply_seq_ *reply ) { exception_->exception_nr = CEERCV_SystemMessage_decline_exn_; *error = 0; reply->_length = 0; reply->_buffer = NULL; if( receiveInfo->io_type == 0 ) // System messages { if( request->_buffer[0] == XZSYS_VAL_SMSG_SHUTDOWN ) { #if !defined(NSK_ODBC_SRVR) && !defined(NSK_CFGSRVR) && !defined(NSK_AS) file_mon_process_shutdown(); exit(0); #endif #if defined(NSK_ODBC_SRVR) terminateThreads(0); exit(0); #endif #if defined(NSK_AS) terminateThreads(0); file_mon_process_shutdown(); exit(0); #endif } else if( request->_buffer[0] == ZSYS_VAL_SMSG_PROCDEATH ) { DISPATCH_PROCDEATH_SMessage( objtag_, call_id_, exception_, receiveInfo, request, error, reply ); } else if( request->_buffer[0] == ZSYS_VAL_SMSG_CPUUP) { DISPATCH_CPUUP_SMessage( objtag_, call_id_, exception_, receiveInfo, request, error, reply ); } else if( request->_buffer[0] == ZSYS_VAL_SMSG_CPUDOWN ) { DISPATCH_CPUDOWN_SMessage( objtag_, call_id_, exception_, receiveInfo, request, error, reply ); } else if( request->_buffer[0] == ZSYS_VAL_SMSG_OPEN ) { DISPATCH_OPEN_SMessage( objtag_, call_id_, exception_, receiveInfo, request, error, reply ); } else if( request->_buffer[0] == ZSYS_VAL_SMSG_CLOSE ) { DISPATCH_CLOSE_SMessage( objtag_, call_id_, exception_, receiveInfo, request, error, reply ); } } }
void my_mpi_fclose() { #ifdef MPI_ /* msg_mon_close_process(msg_get_phandle("$SYSTEM")); msg_mon_close_process(msg_get_phandle("$DATA"));*/ file_mon_process_shutdown(); #endif }
int main(int argc, char *argv[]) { _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; int ferr; short filenumr; short filenums[MAXSRV]; int inxl; int inxs; int loop = 10; int maxsp = 2; bool verbose = false; xzsys_ddl_smsg_def *sys_msg = (xzsys_ddl_smsg_def *) recv_buffer; struct timeval t_elapsed_close; struct timeval t_elapsed_closem1; struct timeval t_elapsed_open; struct timeval t_elapsed_openm1; struct timeval t_start_close; struct timeval t_start_closem1; struct timeval t_start_open; struct timeval t_start_openm1; struct timeval t_stop_close; struct timeval t_stop_closem1; struct timeval t_stop_open; struct timeval t_stop_openm1; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-maxsp", TA_Int, MAXSRV, &maxsp }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); if (client) { util_time_timer_start(&t_start_open); for (inxs = 0; inxs < maxsp; inxs++) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenums[inxs], 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); if (inxs == 0) util_time_timer_start(&t_start_openm1); } util_time_timer_stop(&t_stop_open); util_time_timer_stop(&t_stop_openm1); for (inxs = 0; inxs < maxsp; inxs++) { for (inxl = 0; inxl < loop; inxl++) { sprintf(send_buffer, "hello, greetings %d from %s, inx=%d", inxs, my_name, inxl); cc = XWRITEREADX(filenums[inxs], send_buffer, (unsigned short) (strlen(send_buffer) + 1), // cast BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); printf("%s\n", send_buffer); } } util_time_timer_start(&t_start_close); util_time_timer_start(&t_start_closem1); for (inxs = 0; inxs < maxsp; inxs++) { if (inxs == (maxsp - 1)) util_time_timer_stop(&t_stop_closem1); ferr = XFILE_CLOSE_(filenums[inxs], 0); TEST_CHK_FEOK(ferr); } util_time_timer_stop(&t_stop_close); util_time_elapsed(&t_start_open, &t_stop_open, &t_elapsed_open); util_time_elapsed(&t_start_openm1, &t_stop_openm1, &t_elapsed_openm1); util_time_elapsed(&t_start_close, &t_stop_close, &t_elapsed_close); util_time_elapsed(&t_start_closem1, &t_stop_closem1, &t_elapsed_closem1); print_elapsed(" (open)", &t_elapsed_open); print_elapsed(" (open-1st)", &t_elapsed_openm1); print_elapsed(" (close)", &t_elapsed_close); print_elapsed(" (close-lst)", &t_elapsed_closem1); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenumr, 0, 0, 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); // process opens for (inxs = 0; inxs < maxsp; inxs++) { cc = XREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCNE(cc); if (verbose) { int mt = sys_msg->u_z_msg.z_msgnumber[0]; printf("inx=%d, type=%d\n", inxs, mt); } cc = XREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } for (inxs = 0; inxs < maxsp; inxs++) { for (inxl = 0; inxl < loop; inxl++) { cc = XREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (unsigned short) (strlen(recv_buffer) + 1); // cast cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } } // process closes for (inxs = 0; inxs < maxsp; inxs++) { cc = XREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCNE(cc); if (verbose) { int mt = sys_msg->u_z_msg.z_msgnumber[0]; printf("inx=%d, type=%d\n", inxs, mt); } cc = XREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } ferr = XFILE_CLOSE_(filenumr, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; int ferr; short filenum; short filenuma[2]; int inx; int loop = 10; char my_name[BUFSIZ]; char recv_buffer[BUFSIZ]; RI_Type ri; char send_buffer[BUFSIZ]; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); util_gethostname(my_name, (int) sizeof(my_name)); if (client) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); short filenumx; ferr = XFILE_OPEN_((char *) "$srv", 4, &filenumx, 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); cc = XWRITEREADX(filenum, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); printf("%s\n", send_buffer); } } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); // pick up opens for (inx = 0; inx < 2; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCNE(cc); getri(&ri); assert(recv_buffer[0] == XZSYS_VAL_SMSG_OPEN); assert(ri.io_type == 0); filenuma[inx] = ri.file_number; cc = XREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } for (inx = 0; inx < loop; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); getri(&ri); assert(ri.io_type == XZSYS_VAL_RCV_IOTYPE_WRITEREAD); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (short) (strlen(recv_buffer) + 1); cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } // pick up close for (inx = 0; inx < 2; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCNE(cc); getri(&ri); assert(recv_buffer[0] == XZSYS_VAL_SMSG_CLOSE); assert(ri.io_type == 0); if (ri.file_number == filenuma[0]) filenuma[0] = -1; else if (ri.file_number == filenuma[1]) filenuma[1] = -1; else assert(false); // needs to be matching cc = XREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _xcc_status cc; bool client = false; int closes; int count_read; int count_written; int ferr; short filenumr; short filenums[MAX_SRV]; int inxl; int inxs; int loop = 10; int maxcp = 1; int maxsp = 1; bool mq = false; char serv[20]; xzsys_ddl_smsg_def *sys_msg = (xzsys_ddl_smsg_def *) recv_buffer; bool verbose = false; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-maxcp", TA_Int, MAX_CLI, &maxcp }, { "-maxsp", TA_Int, MAX_SRV, &maxsp }, { "-mq", TA_Bool, TA_NOMAX, &mq }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); ferr = msg_mon_get_my_process_name(my_name, BUFSIZ); util_check("msg_mon_get_my_process_name", ferr); if (client) { for (inxl = 0; inxl < loop; inxl++) { for (inxs = 0; inxs < maxsp; inxs++) { sprintf(serv, "$srv%d", inxs); ferr = BFILE_OPEN_(serv, (short) strlen(serv), &filenums[inxs], 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); } for (inxs = 0; inxs < maxsp; inxs++) { sprintf(send_buffer, "hello, greetings %d from %s, inx=%d", inxs, my_name, inxl); cc = BWRITEREADX(filenums[inxs], send_buffer, (int) (strlen(send_buffer) + 1), // cast BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); if (mq) { if ((inxl % 100) == 0) printf("count=%d\n", inxl); } else printf("%s\n", send_buffer); } for (inxs = 0; inxs < maxsp; inxs++) { ferr = BFILE_CLOSE_(filenums[inxs], 0); TEST_CHK_FEOK(ferr); } } } else { closes = 0; ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenumr, 0, 0, 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); // process requests for (inxl = 0;; inxl++) { cc = BREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 0); if (_xstatus_ne(cc)) { int mt = sys_msg->u_z_msg.z_msgnumber[0]; if (verbose) { if (mt == XZSYS_VAL_SMSG_CLOSE) printf("inx=%d, type=%d, cc=%d\n", inxl, mt, closes); else printf("inx=%d, type=%d\n", inxl, mt); } if (mt == XZSYS_VAL_SMSG_CLOSE) closes++; count_read = 0; } else { strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (int) (strlen(recv_buffer) + 1); // cast } cc = BREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); if (closes >= maxcp * loop) break; } ferr = BFILE_CLOSE_(filenumr, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _bcc_status bcc; void *buf; bool client = false; int count_read; int count_written; int count_xferred; #ifdef USE_SB_FC int err; #endif // USE_SB_FC int ferr; short filenumr; short filenums[MAX_SRV]; #ifdef USE_SB_FC short info_count; #endif // USE_SB_FC int inx; int len; #ifdef USE_SB_FC short list_inx; #endif // USE_SB_FC int loop = 10; char *p; char recv_buffer[BUFSIZ]; char send_buffer[MAX_SRV][BUFSIZ]; #ifdef USE_SB_FC int socka1; int socka2; int sockc1[MAX_SRV]; int sockc2[MAX_SRV]; int sockl; #endif // USE_SB_FC int srv; SB_Tag_Type tag; short tfilenum; int timeout = -1; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-maxcp", TA_Next, TA_NOMAX, NULL }, { "-maxsp", TA_Next, TA_NOMAX, NULL }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); if (client) { #ifdef USE_SB_FC // check empty list ferr = BFILE_COMPLETE_GETINFO_((short *) info_list, MAX_INFO_LIST, &info_count); TEST_CHK_FEOK(ferr); assert(info_count == 0); // add bogus add_list[0].z_fnum_fd = 99; add_list[0].u_z_options.z_options.z_set_file = 0; // set add_list[0].u_z_options.z_options.z_filetype = 0; // guardian ferr = BFILE_COMPLETE_SET_((short *) add_list, 1, &list_inx); assert(ferr == XZFIL_ERR_NOTFOUND); assert(list_inx == 0); #endif // USE_SB_FC for (srv = 0; srv < MAX_SRV; srv++) { sprintf(send_buffer[srv], "$srv%d", srv); len = (int) strlen(send_buffer[srv]); ferr = BFILE_OPEN_((char *) send_buffer[srv], (short) len, &filenums[srv], 0, 0, 1, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); } #ifdef USE_SB_FC do_set_guardian(filenums[0], 0, 1); // add do_set_guardian(filenums[0], 1, 0); // remove (specific) do_set_guardian(filenums[0], 0, 1); // add do_set_guardian(-1, 1, 0); // remove (all) do_set_guardian(-1, 0, 1); // add (all) #endif // USE_SB_FC for (srv = 0; srv < MAX_SRV; srv++) { for (inx = 0; inx < loop; inx++) { sprintf(send_buffer[srv], "inx=%d", inx); bcc = BWRITEREADX(filenums[srv], send_buffer[srv], (short) (strlen(send_buffer[srv]) + 1), BUFSIZ, &count_read, 1); TEST_CHK_BCCEQ(bcc); #ifdef USE_SB_FC ferr = BFILE_COMPLETE_((short *) &info, timeout, NULL, 0, NULL); TEST_CHK_FEOK(ferr); assert(info.z_tag == 1); #else tfilenum = -1; bcc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_BCCEQ(bcc); #endif } } for (srv = 0; srv < MAX_SRV; srv++) { p = strchr(send_buffer[srv], ':'); *p = 0; p++; strcpy(host[srv], send_buffer[srv]); port[srv] = (unsigned short) atoi(p); if (verbose) printf("server[%d] returned host=%s, port=%d\n", srv, host[srv], port[srv]); } #ifdef USE_SB_FC if (verbose) printf("client connecting up\n"); // connect up, and setup fds for (srv = 0; srv < MAX_SRV; srv++) { sockc1[srv] = do_connect(srv); sockc2[srv] = do_connect(srv); } do_set_guardian(-1, 1, 0); // remove (all) do_set_linux(sockc1[0], 0, 0, 0, 0, 1); // add-no rr/wr/exc // nothing should be ready timeout = 0; ferr = BFILE_COMPLETE_((short *) &info, timeout, NULL, 0, NULL); assert(ferr == XZFIL_ERR_TIMEDOUT); // server has sent something, so rr should be on sleep(1); do_set_linux(sockc1[0], 0, 1, 0, 0, 1); // rr timeout = -1; ferr = BFILE_COMPLETE_((short *) &info, timeout, NULL, 0, NULL); TEST_CHK_FEOK(ferr); assert(info.z_filetype); // linux assert(info.z_error == XZFIL_ERR_OK); assert(info.z_fnum_fd == sockc1[0]); assert(info.u_z_return_value.z_return_value.z_read_ready); assert(!info.u_z_return_value.z_return_value.z_write_ready); assert(!info.u_z_return_value.z_return_value.z_exception); // wr should be on do_set_linux(sockc1[0], 0, 0, 1, 0, 1); // wr timeout = -1; ferr = BFILE_COMPLETE_((short *) &info, timeout, NULL, 0, NULL); TEST_CHK_FEOK(ferr); assert(info.z_filetype); // linux assert(info.z_error == XZFIL_ERR_OK); assert(info.z_fnum_fd == sockc1[0]); assert(!info.u_z_return_value.z_return_value.z_read_ready); assert(info.u_z_return_value.z_return_value.z_write_ready); assert(!info.u_z_return_value.z_return_value.z_exception); do_set_linux(sockc1[0], 0, 0, 0, 0, 1); // clear ready do_set_linux(sockc2[0], 0, 0, 0, 0, 2); // add-no rr/wr/exc // nothing should be ready timeout = 0; ferr = BFILE_COMPLETE_((short *) &info, timeout, NULL, 0, NULL); assert(ferr == XZFIL_ERR_TIMEDOUT); // rr should NOT be ready do_set_linux(sockc2[0], 0, 1, 0, 0, 2); // rr timeout = 100; ferr = BFILE_COMPLETE_((short *) &info, timeout, NULL, 0, NULL); assert(ferr == XZFIL_ERR_TIMEDOUT); // test fairness (check trace) do_set_linux(-1, 1, 0, 0, 0, 0); // clear linux for (srv = 0; srv < MAX_SRV; srv++) do_set_guardian(filenums[srv], 0, srv + 1); // add for (srv = 0; srv < MAX_SRV; srv++) { bcc = BWRITEREADX(filenums[srv], NULL, 0, BUFSIZ, &count_read, 1); TEST_CHK_BCCEQ(bcc); } usleep(10000); for (srv = 0; srv < MAX_SRV; srv++) { timeout = -1; ferr = BFILE_COMPLETE_((short *) &info, timeout, NULL, 0, NULL); TEST_CHK_FEOK(ferr); assert(!info.z_filetype); // guardian assert(info.z_error == XZFIL_ERR_OK); assert(info.z_fnum_fd == filenums[srv]); } #endif // USE_SB_FC if (verbose) printf("client closing\n"); for (srv = 0; srv < MAX_SRV; srv++) { ferr = BFILE_CLOSE_(filenums[srv], 0); TEST_CHK_FEOK(ferr); } printf("if there were no asserts, all is well\n"); } else { #ifdef USE_SB_FC sockl = do_listen(); assert(sockl != -1); #endif // USE_SB_FC ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenumr, 0, 0, 1, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { bcc = BREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 1); TEST_CHK_BCCEQ(bcc); tfilenum = filenumr; bcc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_BCCEQ(bcc); assert(tag == 1); sprintf(recv_buffer, "%s:%d\n", host[0], port[0]); count_read = (short) (strlen(recv_buffer) + 1); bcc = BREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_BCCEQ(bcc); } #ifdef USE_SB_FC if (verbose) printf("server accepting\n"); socka1 = do_accept(sockl); socka2 = do_accept(sockl); err = write(socka1, recv_buffer, 1); assert(err == 1); for (inx = 0; inx < 1; inx++) { bcc = BREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 1); TEST_CHK_BCCEQ(bcc); tfilenum = filenumr; bcc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_BCCEQ(bcc); bcc = BREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_BCCEQ(bcc); } #endif // USE_SB_FC if (verbose) printf("server closing\n"); ferr = BFILE_CLOSE_(filenumr, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; unsigned short count_read; unsigned short count_written; unsigned short count_xferred; int ferr; short filenum; short lasterr; int inx; int loop = 10; char my_name[BUFSIZ]; bool nowait = false; int nid; char *p; int pid; char recv_buffer[BUFSIZ]; char send_buffer[BUFSIZ]; SB_Tag_Type tag; short tfilenum; int tm_seq; int timeout = -1; MS_Mon_Transid_Type transid; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-nowait", TA_Bool, TA_NOMAX, &nowait }, { "-print", TA_Bool, TA_NOMAX, &print }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "", TA_End, TA_NOMAX, NULL } }; TRANSID_SET_NULL(curr_transid); TRANSID_SET_NULL(exp_trans); ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); util_gethostname(my_name, sizeof(my_name)); ferr = msg_mon_trans_register_tmlib(tmlib); TEST_CHK_FEOK(ferr); ferr = msg_mon_get_process_info(NULL, &nid, &pid); TEST_CHK_FEOK(ferr); if (client) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, nowait ? (short) 1 : (short) 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { ferr = msg_mon_get_tm_seq(&tm_seq); TEST_CHK_FEOK(ferr); if (inx & 1) cc = XSETMODE(filenum, 117, 1, 0, NULL); // suppress else cc = XSETMODE(filenum, 117, 0, 0, NULL); // normal TEST_CHK_CCEQ(cc); ferr = XFILE_GETINFO_(-1, &lasterr, NULL, 0, NULL, NULL, NULL); assert(lasterr == XZFIL_ERR_OK); sprintf(send_buffer, "hello, greetings from %s, inx=%d, trans=%d", my_name, inx, tm_seq); if (print) printf("client enlist, transid=%d\n", tm_seq); TRANSID_SET_SEQ(transid, tm_seq); trans_set_curr(transid); if ((inx & 1) == 0) { ferr = msg_mon_trans_enlist(nid, pid, transid); TEST_CHK_FEOK(ferr); } if ((inx & 1) == 0) fun_set(TMLIB_FUN_GET_TX, TMLIB_FUN_REINSTATE_TX); else fun_set(-1, -1); trans_set(transid); cc = XWRITEREADX(filenum, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, 0); if (nowait) { TEST_CHK_CCEQ(cc); tfilenum = filenum; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); } TEST_CHK_CCEQ(cc); fun_check(-1); if (print) printf("client end, transid=%d\n", tm_seq); if ((inx & 1) == 0) { ferr = msg_mon_trans_end(nid, pid, transid); TEST_CHK_FEOK(ferr); TRANSID_SET_NULL(transid); trans_set_curr(transid); // no more trans } printf("%s\n", send_buffer); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, nowait ? (short) 1 : (short) 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { if ((inx & 1) == 0) fun_set(TMLIB_FUN_REG_TX, -1); else fun_set(-1, -1); cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); if (nowait) { tfilenum = filenum; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); } if (inx & 1) { TRANSID_SET_NULL(transid); } else { p = &recv_buffer[strlen(recv_buffer)]; while ((p > recv_buffer) && (*p != '=')) p--; if (*p == '=') { p++; sscanf(p, "%d", &tm_seq); TRANSID_SET_SEQ(transid, tm_seq); } else TRANSID_SET_NULL(transid); } if (inx & 1) { MS_Mon_Transid_Type ltransid; TRANSID_SET_NULL(ltransid); trans_set_curr(ltransid); } trans_set(transid); trans_check(curr_transid); fun_check(-1); if ((inx & 1) == 0) fun_set(TMLIB_FUN_CLEAR_TX, -1); else fun_set(-1, -1); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (short) (strlen(recv_buffer) + 1); cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_FEOK(ferr); fun_check(-1); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_written; unsigned short count_xferred; int disable; bool done; int ferr; short filenum1; short filenum2; int inx; int loop = 10; char my_name[BUFSIZ]; char my_pname[BUFSIZ]; int out; MS_Mon_Process_Info_Type proc_info; char recv_buffer[BUFSIZ]; char send_buffer[BUFSIZ]; int send_len; SB_Tag_Type tag; int timeout = -1; short tfilenum; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); util_gethostname(my_name, (int) sizeof(my_name)); ferr = msg_mon_get_my_process_name(my_pname, sizeof(my_pname)); if (client) { ferr = XFILE_OPEN_(srv1, (short) strlen(srv1), &filenum1, 0, 0, MAX_OUT, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); ferr = msg_mon_get_process_info_detail(srv1, &proc_info); TEST_CHK_FEOK(ferr); ferr = XFILE_OPEN_(srv2, (short) strlen(srv2), &filenum2, 0, 0, MAX_OUT, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); send_len = (int) strlen(send_buffer) + 1; // cast if (verbose) printf("client doing writereadx's to fn1\n"); for (out = 0; out < MAX_OUT; out++) { cc = XWRITEREADX(filenum1, send_buffer, (ushort) send_len, BUFSIZ, &count_written, 0); TEST_CHK_CCEQ(cc); } if (verbose) printf("client doing writereadx's to fn2\n"); for (out = 0; out < MAX_OUT; out++) { cc = XWRITEREADX(filenum2, send_buffer, (ushort) send_len, BUFSIZ, &count_written, 0); TEST_CHK_CCEQ(cc); } if (verbose) printf("client killing srv1 (pid=%d), closing fn1\n", proc_info.os_pid); kill(proc_info.os_pid, SIGTERM); disable = msg_test_assert_disable(); ferr = XFILE_CLOSE_(filenum1); TEST_CHK_FEIGNORE(ferr); msg_test_assert_enable(disable); if (verbose) printf("client doing awaitios on fn1\n"); for (out = 0; out < MAX_OUT; out++) { tfilenum = -2; disable = msg_test_assert_disable(); cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); msg_test_assert_enable(disable); // can't check cc because of -2 if (_xstatus_eq(cc)) printf("%s\n", send_buffer); } if (verbose) printf("client restarting srv1, reopening fn1\n"); restart_server(argc, argv); ferr = XFILE_OPEN_(srv1, (short) strlen(srv1), &filenum1, 0, 0, MAX_OUT, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); ferr = msg_mon_get_process_info_detail(srv1, &proc_info); } if (verbose) printf("client sending stop to srv1\n"); strcpy(send_buffer, "stop"); send_len = (int) strlen(send_buffer) + 1; // cast cc = XWRITEREADX(filenum1, send_buffer, (ushort) send_len, BUFSIZ, &count_written, 0); TEST_CHK_CCEQ(cc); tfilenum = filenum1; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); strcpy(send_buffer, "stop"); if (verbose) printf("client sending stop to srv2\n"); cc = XWRITEREADX(filenum2, send_buffer, (ushort) send_len, BUFSIZ, &count_written, 0); TEST_CHK_CCEQ(cc); tfilenum = filenum2; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); if (verbose) printf("client finishing\n"); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum1, 0, 0, 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); do { if (verbose) printf("server-%s: doing readupdate\n", my_pname); cc = XREADUPDATEX(filenum1, recv_buffer, BUFSIZ, NULL, 0); if (verbose) printf("server-%s: readupdate done cc=%d\n", my_pname, cc); TEST_CHK_CCEQ(cc); util_time_sleep_ms(10); done = (strcmp(recv_buffer, "stop") == 0); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); if (verbose) printf("server-%s: doing reply, done=%d\n", my_pname, done); cc = XREPLYX(NULL, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); assert(count_written == 0); } while (!done); ferr = XFILE_CLOSE_(filenum1, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _bcc_status bcc; void *buf; int cancel = 0; bool client = false; int closes; int count; int count_cancel; int count_read; int count_written; int count_xferred; int ferr; int inxl; int inxo; int inxs; int inxx; int loop = 10; int maxcp = 1; int maxout = 1; int maxsp = 1; int msg_count; bool mq = false; short filenumr; short filenums[MAX_SRV]; int send_len; char serv[20]; xzsys_ddl_smsg_def *sys_msg = (xzsys_ddl_smsg_def *) recv_buffer; SB_Tag_Type tago; short tfilenum; int timeout = -1; bool verbose = false; TAD zargs[] = { { "-cancel", TA_Int, TA_NOMAX, &cancel }, { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-maxcp", TA_Int, MAX_CLI, &maxcp }, { "-maxout", TA_Int, MAX_OUT, &maxout }, { "-maxsp", TA_Int, MAX_SRV, &maxsp }, { "-mq", TA_Bool, TA_NOMAX, &mq }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); ferr = msg_mon_get_my_process_name(my_name, BUFSIZ); util_check("file_mon_get_my_process_name", ferr); if (client) { ferr = XCONTROLMESSAGESYSTEM(XCTLMSGSYS_SETSENDLIMIT, XMAX_SETTABLE_SENDLIMIT); assert(ferr == XZFIL_ERR_OK); for (inxs = 0; inxs < maxsp; inxs++) { sprintf(serv, "$srv%d", inxs); ferr = BFILE_OPEN_(serv, (short) strlen(serv), &filenums[inxs], 0, 0, (short) maxout, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); } msg_count = 0; count_cancel = 0; for (inxl = 0; inxl < loop; inxl++) { count = 0; if (cancel) count_cancel = rnd(cancel); for (inxs = 0; inxs < maxsp; inxs++) { for (inxo = 0; inxo < maxout; inxo++) { send_len = rnd(BUFSIZ); bcc = BWRITEREADX(filenums[inxs], send_buffer[inxo], send_len, BUFSIZ, &count_read, inxo + 1); out_list[inxs][inxo] = inxo + 1; util_check("BWRITEREADX", ferr); } } for (inxs = 0; inxs < maxsp; inxs++) { for (inxo = 0; inxo < maxout; inxo++) { msg_count++; if (verbose) printf("client(%s): msg-count=%d\n", my_name, msg_count); count++; if (cancel && (count >= count_cancel)) { if (verbose) printf("client(%s): cancel, count=%d\n", my_name, count); count_cancel = rnd(cancel); count = 0; tago = out_list[inxs][inxo]; if (tago == 0) { for (inxx = maxout - 1; inxx > 0; inxx--) { tago = out_list[inxs][inxx]; if (tago > 0) break; } } if (verbose) printf("client(%s): cancel, tag=" PFTAG "\n", my_name, tago); ferr = BCANCELREQ(filenums[inxs], tago); util_check("BCANCELREQ", ferr); } else { tfilenum = filenums[inxs]; bcc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tago, timeout, NULL); TEST_CHK_BCCEQ(bcc); assert(tago <= maxout); out_list[inxs][tago-1] = 0; } } } if (mq) { if ((inxl % 100) == 0) printf("client(%s): count=%d\n", my_name, inxl); } } for (inxs = 0; inxs < maxsp; inxs++) { ferr = BFILE_CLOSE_(filenums[inxs]); TEST_CHK_FEOK(ferr); } } else { ferr = XCONTROLMESSAGESYSTEM(XCTLMSGSYS_SETRECVLIMIT, XMAX_SETTABLE_RECVLIMIT); assert(ferr == XZFIL_ERR_OK); ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenumr, 0, 0, 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); closes = 0; msg_count = 0; // process requests for (;;) { bcc = BREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 0); if (_xstatus_ne(bcc)) { int mt = sys_msg->u_z_msg.z_msgnumber[0]; if (mt == XZSYS_VAL_SMSG_CLOSE) { closes++; if (verbose) printf("server(%s): closes=%d\n", my_name, closes); } else { const char *mtstr = msfs_util_get_sysmsg_str(mt); if (verbose) printf("server(%s): type=%s(%d)\n", my_name, mtstr, mt); } } else { msg_count++; if (verbose) printf("server(%s): msg-count=%d\n", my_name, msg_count); } bcc = BREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_BCCEQ(bcc); if (closes >= maxcp) break; } } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { bool bidir = false; bool bm = false; void *buf; double busy; _xcc_status cc; int count_read; int count_written; int count_xferred; int dsize = 1024; int ferr; short filenum[MAX_SERVERS]; short filenumr; int inx; int loop = 10; int max; int maxsp = 1; bool mq = false; bool nocopy = false; bool nowaitc = false; bool nowaits = false; int pinx; struct rusage r_start; struct rusage r_stop; char *recv_buffer_ptr; RI_Type ri; short sender_len; int sys_msg; struct timeval t_elapsed_data; struct timeval t_elapsed_open; struct timeval t_elapsed_total; struct timeval t_start_data; struct timeval t_start_total; struct timeval t_stop; SB_Tag_Type tag; short tfilenum; int timeout = -1; bool verbose = false; TAD zargs[] = { { "-bidir", TA_Bool, TA_NOMAX, &bidir }, { "-bm", TA_Bool, TA_NOMAX, &bm }, { "-client", TA_Bool, TA_NOMAX, &client }, { "-dsize", TA_Int, MAX_DBUF, &dsize }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-maxcp", TA_Int, MAX_CLIENTS, &maxcp }, { "-maxsp", TA_Int, MAX_SERVERS, &maxsp }, { "-mq", TA_Bool, TA_NOMAX, &mq }, { "-nocopy", TA_Bool, TA_NOMAX, &nocopy }, { "-nowaitc", TA_Bool, TA_NOMAX, &nowaitc }, { "-nowaits", TA_Bool, TA_NOMAX, &nowaits }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "", TA_End, TA_NOMAX, NULL } }; for (inx = 0; inx < MAX_CLIENTS; inx++) account[inx] = 0; signal(SIGUSR2, printaccount); ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); if (maxcp < 0) maxcp = 1; if (maxsp < 0) maxsp = 1; util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); if (nocopy) { ferr = file_buf_register(buf_alloc, buf_free); TEST_CHK_FEOK(ferr); } ferr = msg_mon_get_my_process_name(my_name, BUFSIZ); TEST_CHK_FEOK(ferr); // process-wait for clients/servers/shell ferr = msfs_util_wait_process_count(MS_ProcessType_Generic, maxcp + maxsp + 1, NULL, verbose); if (client) sleep(1); util_time_timer_start(&t_start_total); if (client) { inx = atoi(&my_name[4]); printf("dsize=%d, loop=%d\n", dsize, loop); for (pinx = 0; pinx < maxsp; pinx++) { sprintf(serv, "$srv%d", pinx); ferr = BFILE_OPEN_(serv, (short) strlen(serv), &filenum[pinx], 0, 0, nowaitc ? (short) 1 : (short) 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); } util_time_timer_start(&t_start_data); util_cpu_timer_start(&r_start); util_time_elapsed(&t_start_total, &t_start_data, &t_elapsed_open); max = loop; for (inx = 0; inx < max; inx++) { for (pinx = 0; pinx < maxsp; pinx++) { if (pinx == 0) { if (verbose) printf("%s-count=%d\n", my_name, inx); else if (mq && ((inx % 1000) == 0)) printf("%s-count=%d\n", my_name, inx); } cc = BWRITEREADX(filenum[pinx], send_buffer, (int) dsize, // cast bidir ? dsize : 0, &count_read, 0); } for (pinx = 0; pinx < maxsp; pinx++) { if (nowaitc) { TEST_CHK_CCEQ(cc); tfilenum = filenum[pinx]; cc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); } } } } else { ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenumr, 0, 0, nowaits ? (short) 1 : (short) 0, // nowait 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); util_time_timer_start(&t_start_data); util_cpu_timer_start(&r_start); max = maxcp * loop; for (inx = 0; inx < max; inx++) { if (nocopy) { cc = file_buf_readupdatex(filenumr, &recv_buffer_ptr, &count_read, 0); buf_free(recv_buffer_ptr); } else cc = BREADUPDATEX(filenumr, recv_buffer, (int) dsize, // cast &count_read, 0); if (nowaits) { tfilenum = -1; cc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); // don't check cc - could be sys msg sys_msg = _xstatus_ne(cc); } else sys_msg = _xstatus_ne(cc); if (sys_msg) inx--; if (!sys_msg) { getri(&ri); ferr = XPROCESSHANDLE_DECOMPOSE_(TPT_REF(ri.sender), NULL, // cpu NULL, // pin NULL, // nodenumber NULL, // nodename 0, // nodename NULL, // nodename_length sender, sizeof(sender), &sender_len, NULL); // sequence_number TEST_CHK_FEOK(ferr); sender[sender_len] = 0; if (verbose) printf("sender=%s\n", sender); char *p = &sender[4]; // past $cli int sender_inx = atoi(p); account[sender_inx]++; } cc = BREPLYX(recv_buffer, bidir ? dsize : 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } } util_cpu_timer_stop(&r_stop); util_time_timer_stop(&t_stop); util_time_elapsed(&t_start_total, &t_stop, &t_elapsed_total); util_time_elapsed(&t_start_data, &t_stop, &t_elapsed_data); util_cpu_timer_busy(&r_start, &r_stop, &t_elapsed_data, &busy); if (client) { if (!bm) { print_elapsed("", &t_elapsed_total); print_elapsed(" (data)", &t_elapsed_data); print_elapsed(" (open)", &t_elapsed_open); } print_rate(bm, "", bidir ? 2 * loop : loop, dsize, &t_elapsed_data, busy); } else print_server_busy(bm, "", busy); if (client) { for (pinx = 0; pinx < maxsp; pinx++) { ferr = BFILE_CLOSE_(filenum[pinx], 0); TEST_CHK_FEOK(ferr); } } else { ferr = BFILE_CLOSE_(filenumr, 0); TEST_CHK_FEOK(ferr); ferr = file_mon_process_close(); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); printaccount(0); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; unsigned short count_xferred; int ferr; short filenum_rcv; short filenum_wr; int inx; int loop = 10; char my_name[BUFSIZ]; bool nowait = false; char recv_buffer[BUFSIZ]; RI_Type ri; char send_buffer[BUFSIZ]; SB_Tag_Type tag; short tfilenum; int timeout = -1; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-nowait", TA_Bool, TA_NOMAX, &nowait }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); util_gethostname(my_name, sizeof(my_name)); if (client) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum_wr, 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); cc = XWRITEREADX(filenum_wr, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); printf("%s\n", send_buffer); } ferr = XFILE_CLOSE_(filenum_wr, 0); TEST_CHK_FEOK(ferr); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum_rcv, 0, 0, nowait ? (short) 1 : (short) 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); // read open message cc = XREADUPDATEX(filenum_rcv, recv_buffer, BUFSIZ, &count_read, 0); if (nowait) { TEST_CHK_CCEQ(cc); tfilenum = filenum_rcv; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); } TEST_CHK_CCNE(cc); getri(&ri); cc = XREPLYX(recv_buffer, 0, &count_written, ri.message_tag, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "i'm the server inx=%d", inx); cc = XREADUPDATEX(filenum_rcv, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); if (nowait) { tfilenum = filenum_rcv; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); } getri(&ri); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (short) (strlen(recv_buffer) + 1); cc = XREPLYX(recv_buffer, count_read, &count_written, ri.message_tag, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } ferr = XFILE_CLOSE_(filenum_rcv, 0); TEST_CHK_FEOK(ferr); ferr = file_mon_process_close(); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _bcc_status cc; bool chook = false; bool client = false; int count_read; int count_written; int ferr; int inx; void *result; bool shook = false; int status; SB_Thread::Thread *thr_test; TAD zargs[] = { { "-any1", TA_Bool, TA_NOMAX, &any1 }, { "-any2", TA_Bool, TA_NOMAX, &any2 }, { "-chook", TA_Bool, TA_NOMAX, &chook }, { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-shook", TA_Bool, TA_NOMAX, &shook }, { "-thread", TA_Bool, TA_NOMAX, &thread }, { "", TA_End, TA_NOMAX, NULL } }; arg_proc_args(zargs, false, argc, argv); if (client && chook) test_debug_hook("c", "c"); if (!client && shook) test_debug_hook("s", "s"); ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); if (client) { if (thread) { thr_test = new SB_Thread::Thread(thread_test_fun, "thr-test"); thr_test->start(); status = thr_test->join(&result); TEST_CHK_STATUSOK(status); delete thr_test; } else { thread_test_fun(NULL); } } else { ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { cc = BREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (unsigned short) (strlen(recv_buffer) + 1); // cast cc = BREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } ferr = BFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; unsigned short count_xferred; int disable; int ferr; short filenum; int linx; int loop = 1; int maxopen1; int maxopen2; char my_name[BUFSIZ]; int ninx; int oinx; int rd; int recvdepth = 1; int rinx; SB_Tag_Type tag; short tfilenum; int timeout = -1; bool verbose = false; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-recvdepth", TA_Int, MAXRCVDEPTH, &recvdepth }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); util_gethostname(my_name, (int) sizeof(my_name)); if (client) { maxopen1 = (recvdepth + MAXNOWAIT - 1 ) / MAXNOWAIT; maxopen2 = RDOVER / MAXNOWAIT; if (verbose) printf("client maxopen=%d, recvdepth=%d\n", maxopen1, recvdepth); for (oinx = 0; oinx < maxopen1; oinx++) { ferr = XFILE_OPEN_((char *) "$SRV", 8, &filenumc1[oinx], 0, 0, MAXNOWAIT, // nowait 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); } for (oinx = 0; oinx < maxopen2; oinx++) { ferr = XFILE_OPEN_((char *) "$SRV", 8, &filenumc2[oinx], 0, 0, MAXNOWAIT, // nowait 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); } for (linx = 0; linx < loop; linx++) { rd = 0; for (oinx = 0; oinx < maxopen1; oinx++) { for (ninx = 0; ninx < MAXNOWAIT; ninx++) { if (verbose) printf("client wr1, fnum=%d, linx=%d, oinx=%d, ninx=%d, rd=%d\n", filenumc1[oinx], linx, oinx, ninx, rd); sprintf(send_buffer1[oinx][ninx], "hello1, greetings from %s, oinx=%d, ninx=%d, rd=%d", my_name, oinx, ninx, rd); cc = XWRITEREADX(filenumc1[oinx], send_buffer1[oinx][ninx], (short) (strlen(send_buffer1[oinx][ninx]) + 1), BUFSIZ, &count_read, rd); TEST_CHK_CCEQ(cc); rd++; if (rd >= recvdepth) break; } } for (oinx = 0; oinx < maxopen2; oinx++) { for (ninx = 0; ninx < MAXNOWAIT; ninx++) { if (verbose) printf("client wr2, fnum=%d, linx=%d, oinx=%d, ninx=%d, rd=%d\n", filenumc2[oinx], linx, oinx, ninx, rd); sprintf(send_buffer2[oinx][ninx], "hello2, greetings from %s, oinx=%d, ninx=%d, rd=%d", my_name, oinx, ninx, rd); cc = XWRITEREADX(filenumc2[oinx], send_buffer2[oinx][ninx], (short) (strlen(send_buffer2[oinx][ninx]) + 1), BUFSIZ, &count_read, rd); TEST_CHK_CCEQ(cc); rd++; if (rd >= (recvdepth + RDOVER)) break; } } rd = 0; for (oinx = 0; oinx < maxopen1; oinx++) { for (ninx = 0; ninx < MAXNOWAIT; ninx++) { tfilenum = filenumc1[oinx]; if (verbose) printf("client awaitio1, fnum=%d, linx=%d, oinx=%d, ninx=%d, rd=%d\n", tfilenum, linx, oinx, ninx, rd); cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); send_buffer1[oinx][ninx][count_xferred] = 0; printf("%s\n", send_buffer1[oinx][ninx]); rd++; if (rd >= recvdepth) break; } } rinx = 0; for (oinx = 0; oinx < maxopen2; oinx++) { for (ninx = 0; ninx < MAXNOWAIT; ninx++) { tfilenum = filenumc2[oinx]; if (verbose) printf("client awaitio2, fnum=%d, linx=%d, oinx=%d, ninx=%d, rd=%d\n", tfilenum, linx, oinx, ninx, rd); disable = msg_test_assert_disable(); cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); msg_test_assert_enable(disable); msg_ok[rinx] = _xstatus_eq(cc); if (msg_ok[rinx]) { send_buffer2[oinx][ninx][count_xferred] = 0; printf("%s\n", send_buffer2[oinx][ninx]); } else if (verbose) printf("client awaitio2-err\n"); rinx++; rd++; if (rd >= (recvdepth + RDOVER)) break; } } // // re-link any failures // rd = recvdepth; rinx = 0; for (oinx = 0; oinx < maxopen2; oinx++) { for (ninx = 0; ninx < MAXNOWAIT; ninx++) { if (msg_ok[rinx++]) continue; tfilenum = filenumc2[oinx]; if (verbose) printf("client wr3, fnum=%d, linx=%d, oinx=%d, ninx=%d, rd=%d\n", filenumc2[oinx], linx, oinx, ninx, rd); sprintf(send_buffer2[oinx][ninx], "hello3, greetings from %s, oinx=%d, ninx=%d, rd=%d", my_name, oinx, ninx, rd); cc = XWRITEREADX(tfilenum, send_buffer2[oinx][ninx], (short) (strlen(send_buffer2[oinx][ninx]) + 1), BUFSIZ, &count_read, rd); TEST_CHK_CCEQ(cc); if (verbose) printf("client awaitio3, fnum=%d, linx=%d, oinx=%d, ninx=%d, rd=%d\n", tfilenum, linx, oinx, ninx, rd); cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); send_buffer2[oinx][ninx][count_xferred] = 0; printf("%s\n", send_buffer2[oinx][ninx]); rd++; if (rd >= (recvdepth + RDOVER)) break; } } } } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, (short) recvdepth, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (linx = 0; linx < loop; linx++) { for (rinx = 0; rinx < recvdepth; rinx++) { if (verbose) printf("server ru rinx=%d, rd=%d\n", rinx, rinx); cc = XREADUPDATEX(filenum, recv_buffer[rinx], BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); } sleep(1); // force NOLCB for (rinx = 0; rinx < recvdepth; rinx++) { if (verbose) printf("server reply rinx=%d, rd=%d\n", rinx, rinx); strcat(recv_buffer[rinx], "- reply from "); strcat(recv_buffer[rinx], my_name); count_read = (unsigned short) (strlen(recv_buffer[rinx]) + 1); // cast cc = XREPLYX(recv_buffer[rinx], count_read, &count_written, (short) rinx, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } sleep(1); // delay rd = recvdepth; for (rinx = 0; rinx < RDOVER; rinx++) { if (verbose) printf("server ru (over) rinx=%d, rd=%d\n", rinx, rd); cc = XREADUPDATEX(filenum, recv_buffer[rinx], BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); if (verbose) printf("server reply (over) rinx=%d, rd=%d\n", rinx, rd); strcat(recv_buffer[rinx], "- reply from "); strcat(recv_buffer[rinx], my_name); count_read = (unsigned short) (strlen(recv_buffer[rinx]) + 1); // cast cc = XREPLYX(recv_buffer[rinx], count_read, &count_written, (short) 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); rd++; } } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEIGNORE(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _xcc_status cc; bool client = false; int count_read; int count_written; int ferr; short filenum; int inx; void *result; int status; SB_Thread::Thread *thr_cli; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-sname", TA_Str, TA_NOMAX, &sname }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); ferr = msg_mon_get_my_process_name(my_name, BUFSIZ); util_check("msg_mon_get_my_process_name", ferr); if (client) { thr_cli = new SB_Thread::Thread(thread_cli_fun, "cli"); thr_cli->start(); status = thr_cli->join(&result); TEST_CHK_STATUSOK(status); delete thr_cli; } else { ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < (loop + 4); inx++) { cc = BREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); if (_xstatus_ne(cc)) { count_read = 0; } else { strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (int) (strlen(recv_buffer) + 1); // cast } cc = BREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } ferr = BFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; unsigned short count_xferred; int ferr; short filenum; int inx; int loop = 10; int num; int out; SB_Tag_Type tag; short tfilenum; int timeout = -1; int xinx; SB_Tag_Type xtag; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); if (client) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, MAX_OUT, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { for (out = 0; out < MAX_OUT; out++) { sprintf(send_buffer[out], "inx=%d, tag=%d", inx, out + 1); cc = XWRITEREADX(filenum, send_buffer[out], 0, 0, &count_read, out + 1); TEST_CHK_CCEQ(cc); } for (out = 0; out < MAX_OUT; out++) { tfilenum = filenum; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &xtag, timeout, NULL); TEST_CHK_CCEQ(cc); assert(xtag == (MAX_OUT - out)); num = sscanf((char *) buf, "inx=%d, tag=" PFTAG, &xinx, &xtag); assert(num == 2); assert(xinx == inx); assert(xtag == (MAX_OUT - out)); } } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); printf("if there were no asserts, all is well\n"); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 1, MAX_OUT, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { for (out = 0; out < MAX_OUT; out++) { cc = XREADUPDATEX(filenum, recv_buffer[out], BUFSIZ, &count_read, out + 1); TEST_CHK_CCEQ(cc); tfilenum = filenum; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); } for (out = MAX_OUT - 1; out >= 0; out--) { // reply in reverse order count_read = (short) (strlen(recv_buffer[out]) + 1); cc = XREPLYX(recv_buffer[out], count_read, &count_written, (short) out, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; unsigned short count_xferred; int ferr; short filenum; int inx; short lasterr; int loop = 10; char my_name[BUFSIZ]; bool nowait = true; char recv_buffer[BUFSIZ]; char send_buffer[BUFSIZ]; SB_Tag_Type tag; short tfilenum; int timeout; int timeout_count; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); util_gethostname(my_name, sizeof(my_name)); if (client) { timeout_count = 0; ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, nowait ? (short) 1 : (short) 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); cc = XWRITEREADX(filenum, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, 0); if (nowait) { TEST_CHK_CCEQ(cc); tfilenum = filenum; timeout = 1; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); if (_xstatus_ne(cc)) { timeout_count++; TEST_CHK_CCNE(cc); ferr = XFILE_GETINFO_(filenum, &lasterr, NULL, 0, NULL, NULL, NULL); assert(lasterr == XZFIL_ERR_TIMEDOUT); tfilenum = filenum; timeout = 200; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); } } else { TEST_CHK_CCNE(cc); ferr = XFILE_GETINFO_(-1, &lasterr, NULL, 0, NULL, NULL, NULL); TEST_CHK_FEOK(ferr); assert(lasterr == XZFIL_ERR_TIMEDOUT); } printf("%s\n", send_buffer); } assert(timeout_count); ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); SB_Thread::Sthr::sleep(30); // cause timeout TEST_CHK_CCEQ(cc); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (short) (strlen(recv_buffer) + 1); cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; int ferr; short filenum; bool forkexec = false; int inx; int loop = 10; char my_name[BUFSIZ]; const char *name; char recv_buffer[BUFSIZ]; char send_buffer[BUFSIZ]; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-forkexec", TA_Bool, TA_NOMAX, &forkexec }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "", TA_End, TA_NOMAX, NULL } }; arg_proc_args(zargs, false, argc, argv); if (client) name = "$cli"; else name = "$srv"; ferr = file_init_attach(&argc, &argv, forkexec, (char *) name); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); util_gethostname(my_name, (int) sizeof(my_name)); if (client) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); cc = XWRITEREADX(filenum, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); printf("%s\n", send_buffer); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (short) (strlen(recv_buffer) + 1); cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
void mxosrvr_atexit_function(void) { file_mon_process_shutdown(); }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; unsigned short count_xferred; int ferr; short filenum; int inx; int loop = 10; char recv_buffer[BUFSIZ]; char send_buffer[BUFSIZ]; SB_Tag_Type tag; short tfilenum; int timeout = -1; bool verbose = false; int xinx; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); if (client) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, 1, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "inx=%d, tag=%d", inx, inx); cc = XWRITEREADX(filenum, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, inx); TEST_CHK_CCEQ(cc); if (inx < (loop - 1)) { cc = XCANCELREQ(filenum, inx); TEST_CHK_CCEQ(cc); if (verbose) printf("client cancelled inx=%d\n", inx); } else { printf("client waiting response inx=%d\n", inx); tfilenum = filenum; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); assert(tag == inx); printf("%s\n", send_buffer); } } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); printf("if there were no asserts, all is well\n"); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 1, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 1); TEST_CHK_CCEQ(cc); tfilenum = filenum; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); count_read = (short) (strlen(recv_buffer) + 1); sscanf(recv_buffer, "inx=%d", &xinx); if (verbose) printf("server replying, server inx=%d, client inx=%d, %s\n", inx, xinx, recv_buffer); inx = xinx; cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } if (verbose) printf("server closing file inx=%d\n", inx); ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { bool abort1 = false; bool abort2 = false; void *buf; _xcc_status cc; bool client = false; int count_read; int count_written; int count_xferred; int dsize = 1024; int ferr; short filenum; int inx; int loop = 10; short mt; char my_name[BUFSIZ]; bool verbose = false; SB_Tag_Type tag; short tfilenum; int timeout = -1; TAD zargs[] = { { "-abort1", TA_Bool, TA_NOMAX, &abort1 }, { "-abort2", TA_Bool, TA_NOMAX, &abort2 }, { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); ferr = msg_mon_get_my_process_name(my_name, BUFSIZ); util_check("msg_mon_get_my_process_name", ferr); if (client) { ferr = BFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, (short) 1, // nowait 0, 0, 0, 0, NULL); if (verbose) printf("client open ferr=%d\n", ferr); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); cc = BWRITEREADX(filenum, send_buffer, (unsigned short) (strlen(send_buffer) + 1), // cast 0, &count_read, 0); if (verbose) printf("client wr cc=%d\n", cc); TEST_CHK_CCEQ(cc); tfilenum = -2; cc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); if (verbose) printf("client awaitiox cc=%d, fn=%d\n", cc, tfilenum); if (abort1) { if (_xstatus_ne(cc)) { sleep(1); inx--; continue; } } else { TEST_CHK_CCEQ(cc); } printf("%s\n", send_buffer); } } else { ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, (short) 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); if (abort1) { } else if (abort2) { loop -= 2; } else { loop += 2; } for (inx = 0; inx < loop; inx++) { if (abort1 && (inx == 3)) util_abort_core_free(); cc = BREADUPDATEX(filenum, recv_buffer, (int) dsize, // cast &count_read, 0); if (verbose) { memcpy(&mt, recv_buffer, sizeof(mt)); printf("server cc=%d, mt=%d\n", cc, mt); } cc = BREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } } if (client) { ferr = BFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = BFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _bcc_status bcc; bool client = false; int count_read; int count_written; int ferr; short filenum; int inx; int loop = 10; RI_Type ri; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); util_gethostname(my_name, (int) sizeof(my_name)); if (client) { ferr = BFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); bcc = BWRITEREADX(filenum, send_buffer, MAX_BUF, MAX_BUF, &count_read, 0); TEST_CHK_BCCEQ(bcc); assert(count_read == MAX_BUF); printf("%s\n", send_buffer); } ferr = BFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { bcc = BREADUPDATEX(filenum, recv_buffer, MAX_BUF, &count_read, 0); TEST_CHK_BCCEQ(bcc); getri(&ri); #ifdef USE_SB_NEW_RI assert(ri.max_reply_count == MAX_BUF); #endif getri(&ri); #ifdef USE_SB_NEW_RI assert(ri.max_reply_count == MAX_BUF); #endif strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (int) strlen(recv_buffer) + 1; // cast bcc = BREPLYX(recv_buffer, MAX_BUF, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_BCCEQ(bcc); assert(count_written == MAX_BUF); } ferr = BFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; unsigned short count_xferred; bool dup = false; int ferr; short filenum[10]; int filenums = 1; int finx; int inx; int loop = 10; bool noclose = false; bool nowait = false; int num; char recv_buffer1[BUFSIZ]; char recv_buffer2[BUFSIZ]; char send_buffer1[BUFSIZ]; char send_buffer2[BUFSIZ]; SB_Tag_Type tag1; SB_Tag_Type tag2; short tfilenum; int timeout = -1; bool verbose = false; bool wait = false; int xinx; SB_Tag_Type xtag; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-dup", TA_Bool, TA_NOMAX, &dup }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-noclose", TA_Bool, TA_NOMAX, &noclose }, { "-nowait", TA_Bool, TA_NOMAX, &nowait }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "-wait", TA_Bool, TA_NOMAX, &wait }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); if (dup) filenums = 5; util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); if (client) { if (verbose) printf("client opening server\n"); if (nowait) { for (finx = 0; finx < filenums; finx++) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum[finx], 0, 0, 2, 0, 0x4000, // nowait open 0, 0, NULL); TEST_CHK_FEOK(ferr); } for (finx = 0; finx < filenums; finx++) { tfilenum = filenum[finx]; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag1, timeout, NULL); TEST_CHK_CCEQ(cc); assert(tag1 == -30); } } else { for (finx = 0; finx < filenums; finx++) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum[finx], 0, 0, 2, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); } } for (inx = 0; inx < loop; inx++) { for (finx = 0; finx < filenums; finx++) { if (verbose) printf("client wr-1 inx=%d, finx=%d\n", inx, finx); sprintf(send_buffer1, "inx=%d, tag=1", inx); cc = XWRITEREADX(filenum[finx], send_buffer1, (short) (strlen(send_buffer1) + 1), BUFSIZ, &count_read, 1); TEST_CHK_CCEQ(cc); sprintf(send_buffer2, "inx=%d, tag=2", inx); if (verbose) printf("client wr-2 inx=%d, finx=%d\n", inx, finx); cc = XWRITEREADX(filenum[finx], send_buffer2, (short) (strlen(send_buffer2) + 1), BUFSIZ, &count_read, 2); TEST_CHK_CCEQ(cc); tfilenum = filenum[finx]; if (verbose) printf("client awaitio-1 inx=%d, finx=%d\n", inx, finx); cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag1, timeout, NULL); TEST_CHK_CCEQ(cc); assert(tag1 == 2); num = sscanf((char *) buf, "inx=%d, tag=" PFTAG, &xinx, &xtag); assert(num == 2); assert(xinx == inx); assert(xtag == 2); tfilenum = filenum[finx]; if (verbose) printf("client awaitio-2 inx=%d, finx=%d\n", inx, finx); cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag2, timeout, NULL); TEST_CHK_CCEQ(cc); assert(tag2 == 1); num = sscanf((char *) buf, "inx=%d, tag=" PFTAG, &xinx, &xtag); assert(num == 2); assert(xinx == inx); assert(xtag == 1); } } if (!noclose) { for (finx = 0; finx < filenums; finx++) { if (verbose) printf("client closing server finx=%d\n", finx); ferr = XFILE_CLOSE_(filenum[finx], 0); TEST_CHK_FEOK(ferr); } } if (wait) sleep(5); printf("if there were no asserts, all is well\n"); } else { if (verbose) printf("server opening $receive\n"); ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum[0], 0, 0, 1, 2, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (finx = 0; finx < filenums; finx++) { if (verbose) printf("server ru-open finx=%d\n", finx); cc = XREADUPDATEX(filenum[0], recv_buffer1, BUFSIZ, &count_read, 1); TEST_CHK_CCEQ(cc); tfilenum = filenum[0]; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag1, timeout, NULL); TEST_CHK_CCNE(cc); assert(recv_buffer1[0] == XZSYS_VAL_SMSG_OPEN); if (verbose) printf("server reply-open finx=%d\n", finx); cc = XREPLYX(recv_buffer1, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } for (inx = 0; inx < loop; inx++) { for (finx = 0; finx < filenums; finx++) { if (verbose) printf("server ru-1 inx=%d, finx=%d\n", inx, finx); cc = XREADUPDATEX(filenum[0], recv_buffer1, BUFSIZ, &count_read, 1); TEST_CHK_CCEQ(cc); tfilenum = filenum[0]; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag1, timeout, NULL); TEST_CHK_CCEQ(cc); if (verbose) printf("server ru-2 inx=%d, finx=%d\n", inx, finx); cc = XREADUPDATEX(filenum[0], recv_buffer2, BUFSIZ, &count_read, 2); TEST_CHK_CCEQ(cc); tfilenum = filenum[0]; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag2, timeout, NULL); TEST_CHK_CCEQ(cc); // reply in reverse order count_read = (short) (strlen(recv_buffer2) + 1); if (verbose) printf("server reply-2 inx=%d, finx=%d\n", inx, finx); cc = XREPLYX(recv_buffer2, count_read, &count_written, 1, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); count_read = (short) (strlen(recv_buffer1) + 1); if (verbose) printf("server reply-1 inx=%d, finx=%d\n", inx, finx); cc = XREPLYX(recv_buffer1, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } } if (!noclose) { for (finx = 0; finx < filenums; finx++) { if (verbose) printf("server ru-close finx=%d\n", finx); cc = XREADUPDATEX(filenum[0], recv_buffer1, BUFSIZ, &count_read, 1); TEST_CHK_CCEQ(cc); tfilenum = filenum[0]; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag1, timeout, NULL); TEST_CHK_CCNE(cc); assert(recv_buffer1[0] == XZSYS_VAL_SMSG_CLOSE); if (verbose) printf("server reply-close finx=%d\n", finx); cc = XREPLYX(recv_buffer1, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } } if (verbose) printf("server closing $receive\n"); ferr = XFILE_CLOSE_(filenum[0], 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { bool bidir = false; char *buf; _xcc_status cc; bool check = false; bool client = false; bool copy = false; int count_read; int count_written; int count_xferred; int dsize = 1024; int ferr; short filenum; int inx; int inx2; #ifdef MEM_LEAK int leak_loop; #endif int loop = 10; bool nowait = false; long t_elapsed; long t_elapsed_sec; struct timeval t_start; struct timeval t_stop; SB_Tag_Type tag; short tfilenum; int timeout = -1; int rc; bool reverse = false; bool verbose = false; int wc; TAD zargs[] = { { "-bidir", TA_Bool, TA_NOMAX, &bidir }, { "-check", TA_Bool, TA_NOMAX, &check }, { "-client", TA_Bool, TA_NOMAX, &client }, { "-copy", TA_Bool, TA_NOMAX, © }, { "-dsize", TA_Int, MAX_DBUF, &dsize }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-nowait", TA_Bool, TA_NOMAX, &nowait }, { "-reverse", TA_Bool, TA_NOMAX, &reverse }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); if (bidir) reverse = false; for (inx2 = 0; inx2 < dsize; inx2++) send_buffer[inx2] = CHK_CHAR; if (client) { printf("bidir=%d, check=%d, copy=%d, dsize=%d, loop=%d, nowait=%d, reverse=%d\n", bidir, check, copy, dsize, loop, nowait, reverse); ferr = BFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, nowait ? (short) 1 : (short) 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); util_time_timer_start(&t_start); #ifdef MEM_LEAK for (leak_loop = 0; ; leak_loop++) { if ((leak_loop % 100) == 0) printf("leak_loop=%d\n", leak_loop); #endif for (inx = 0; inx < loop; inx++) { if (verbose) printf("count=%d\n", inx); wc = dsize; rc = dsize; if (reverse) wc = 0; else if (!bidir) rc = 0; // !bidir && !reverse cc = BWRITEREADX(filenum, send_buffer, wc, rc, &count_read, 0); TEST_CHK_CCEQ(cc); if (nowait) { tfilenum = filenum; cc = BAWAITIOX(&tfilenum, (void **) &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); if (check) { assert(buf == send_buffer); assert(count_xferred == 0); if (rc) { for (inx2 = 0; inx2 < dsize; inx2++) { if (buf[inx2] != CHK_CHAR) { printf("buf[%d]=%d\n", inx2, buf[inx2]); assert(buf[inx2] == CHK_CHAR); } } } } } } #ifdef MEM_LEAK } #endif util_time_timer_stop(&t_stop); t_elapsed = (t_stop.tv_sec * 1000000 + t_stop.tv_usec) - (t_start.tv_sec * 1000000 + t_start.tv_usec); t_elapsed_sec = t_elapsed / 1000000; t_elapsed -= t_elapsed_sec * 1000000; printf("elapsed=%ld.%ld\n", t_elapsed_sec, t_elapsed); ferr = BFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, nowait ? (short) 1 : (short) 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); #ifdef MEM_LEAK for (leak_loop = 0; ; leak_loop++) { #endif for (inx = 0; inx < loop; inx++) { if (copy) cc = BREADUPDATEX(filenum, recv_buffer, dsize, &count_read, inx); else cc = file_buf_readupdatex(filenum, &buf, &count_read, inx); TEST_CHK_CCEQ(cc); if (nowait) { tfilenum = filenum; cc = BAWAITIOX(&tfilenum, (void **) &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); if (check) { if (reverse) assert(count_xferred == 0); else assert(count_xferred == dsize); assert(tag == inx); if (copy) assert(buf == recv_buffer); } } else { if (reverse) assert(count_read == 0); else assert(count_read == dsize); if (copy) buf = recv_buffer; else if (reverse) { buf = send_buffer; } } if (check && !reverse) { for (inx2 = 0; inx2 < dsize; inx2++) { if (buf[inx2] != CHK_CHAR) { printf("buf[%d]=%d\n", inx2, buf[inx2]); assert(buf[inx2] == CHK_CHAR); } } } if (bidir || reverse) cc = BREPLYX(buf, dsize, // wc &count_written, 0, XZFIL_ERR_OK); else cc = BREPLYX(buf, 0, // wc &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); if (!copy && !reverse) free(buf); } #ifdef MEM_LEAK } #endif ferr = BFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { int arg; _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; bool death = false; #ifdef SQ_PHANDLE_VERIFIER int disable; #endif int ferr; short filenumr; short filenums; #ifdef SQ_PHANDLE_VERIFIER short filenums2; #endif int inxl; short len; #ifdef SQ_PHANDLE_VERIFIER short len2; #endif int loop = 10; int nid; int pid; char prog[MS_MON_MAX_PROCESS_PATH]; char retname[BUFSIZ]; char sname[10]; char sname_seq1[40]; #ifdef SQ_PHANDLE_VERIFIER char sname_seq2[40]; #endif int status; bool verbose = false; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-death", TA_Bool, TA_NOMAX, &death }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); for (arg = 1; arg < argc; arg++) { if (strcmp(argv[arg], "-client") == 0) // start_process argv[arg] = (char *) "-server"; } util_test_start(client); if (death) ferr = file_mon_process_startup(true); // system messages? else ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); ferr = msg_mon_get_my_process_name(my_name, BUFSIZ); util_check("msg_mon_get_my_process_name", ferr); if (client) { if (death) { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenumr, 0, 0, 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); } strcpy(sname, "$srv"); if (verbose) printf("client starting server %s\n", sname); sprintf(prog, "%s/%s", getenv("PWD"), argv[0]); nid = -1; ferr = msg_mon_start_process_nowait_cb(cb, // callback prog, // prog sname, // name retname, // ret-name argc, // argc argv, // argv MS_ProcessType_Generic,// ptype 0, // priority false, // debug false, // backup 0, // tag &nid, // nid &pid, // pid NULL, // infile NULL); // outfile TEST_CHK_FEOK(ferr); if (verbose) printf("client waiting for server=%s start\n", sname); status = cv.wait(true); assert(status == 0); #ifdef SQ_PHANDLE_VERIFIER ferr = msg_mon_create_name_seq(sname, srv_verifier, sname_seq1, (int) sizeof(sname_seq1)); TEST_CHK_FEOK(ferr); ferr = msg_mon_create_name_seq(sname, srv_verifier + 99, sname_seq2, (int) sizeof(sname_seq2)); TEST_CHK_FEOK(ferr); #else strcpy(sname_seq1, sname); #endif len = (short) strlen(sname_seq1); if (verbose) printf("client opening server %s\n", sname); ferr = XFILE_OPEN_(sname_seq1, len, &filenums, 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); #ifdef SQ_PHANDLE_VERIFIER len2 = (short) strlen(sname_seq2); disable = msg_test_assert_disable(); // make sure seq # is checked ferr = XFILE_OPEN_(sname_seq2, len2, &filenums2, 0, 0, 0, 0, 0, 0, 0, NULL); assert(ferr != XZFIL_ERR_OK); msg_test_assert_enable(disable); #endif if (verbose) printf("open filenums=%d\n", filenums); for (inxl = 0; inxl < loop; inxl++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inxl); cc = XWRITEREADX(filenums, send_buffer, (unsigned short) (strlen(send_buffer) + 1), // cast BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); printf("%s\n", send_buffer); } disable = msg_test_assert_disable(); ferr = XFILE_CLOSE_(filenums, 0); TEST_CHK_FEOK(ferr); msg_test_assert_enable(disable); if (death) { sleep(2); } if (verbose) printf("client calling shutdown\n"); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenumr, 0, 0, 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); cc = XREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCNE(cc); count_read = 0; cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); for (inxl = 0; inxl < loop; inxl++) { cc = XREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (unsigned short) (strlen(recv_buffer) + 1); // cast cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } if (death) { sleep(1); util_abort_core_free(); } } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_written; unsigned short count_xferred; int ferr; short filenum; int inx; int loop = 10; char my_name[BUFSIZ]; bool nowait = false; char recv_buffer[BUFSIZ]; RI_Type ri; char send_buffer[BUFSIZ]; int send_len; SB_Tag_Type tag; int timeout = -1; short tfilenum; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-nowait", TA_Bool, TA_NOMAX, &nowait }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); util_gethostname(my_name, (int) sizeof(my_name)); if (client) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum, 0, 0, nowait ? (short) 1 : (short) 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); send_len = (int) strlen(send_buffer) + 1; // cast cc = XWRITEX(filenum, send_buffer, (ushort) send_len, &count_written, 0); if (nowait) { TEST_CHK_CCEQ(cc); tfilenum = filenum; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); assert(count_xferred == send_len); } else { TEST_CHK_CCEQ(cc); assert(count_written == send_len); } printf("%s\n", send_buffer); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, NULL, 0); TEST_CHK_CCEQ(cc); getri(&ri); assert(ri.io_type == XZSYS_VAL_RCV_IOTYPE_WRITE); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); cc = XREPLYX(NULL, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); assert(count_written == 0); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { int arg; bool attach = false; _xcc_status cc; bool chook = false; bool client = false; unsigned short count_read; unsigned short count_written; int ferr; short filenum; int inx; int loop = 10; char my_name[BUFSIZ]; char prog[MS_MON_MAX_PROCESS_PATH]; char recv_buffer[BUFSIZ]; char ret_name[MS_MON_MAX_PROCESS_NAME]; char send_buffer[BUFSIZ]; const char *server_name = "$SRV"; int server_nid = -1; TPT_DECL (server_phandle); int server_pid; bool shook = false; TAD zargs[] = { { "-attach", TA_Bool, TA_NOMAX, &attach }, { "-chook", TA_Bool, TA_NOMAX, &chook }, { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-shook", TA_Bool, TA_NOMAX, &shook }, { "", TA_End, TA_NOMAX, NULL } }; #ifdef DEBUG_ENV env = environ; while (*env != NULL) { printf("env=%s\n", *env); env++; } #endif arg_proc_args(zargs, false, argc, argv); if (chook && client) test_debug_hook("c", "c"); if (shook && !client) test_debug_hook("s", "s"); if (client && attach) ferr = file_init_attach(&argc, &argv, true, (char *) "$CLI"); else ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); util_gethostname(my_name, sizeof(my_name)); if (client) { sprintf(prog, "%s/%s", getenv("PWD"), argv[0]); for (arg = 0; arg < argc; arg++) if (strcmp(argv[arg], "-client") == 0) // start_process argv[arg] = (char *) "-server"; ferr = msg_mon_start_process(prog, // prog (char *) server_name, // name ret_name, // ret name argc, argv, TPT_REF(server_phandle), 0, // open NULL, // oid MS_ProcessType_Generic, // type 0, // priority 0, // debug 0, // backup &server_nid, // nid &server_pid, // pid NULL, // infile NULL); // outfile TEST_CHK_FEOK(ferr); assert(strcmp(ret_name, server_name) == 0); ferr = XFILE_OPEN_((char *) server_name, (short) strlen(server_name), &filenum, 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); cc = XWRITEREADX(filenum, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); printf("%s\n", send_buffer); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (short) (strlen(recv_buffer) + 1); cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _xcc_status cc; bool client = false; unsigned short count_read; int count_read_b; unsigned short count_written; TCPU_DECL (cpu); int ferr; short filenum; int inx; int loop = 10; TPT_DECL (mphandle); char *mphandlec = (char *) &mphandle; TPT_DECL_INT (mphandlei); int nid; char nodename[20]; short nodename_length; int nodenumber; int pid; TPIN_DECL (pin); char procname[40]; short procname_length; SB_Int64_Type sequence_number; const char *sname = "$srv"; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-sname", TA_Str, TA_NOMAX, &sname }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages? TEST_CHK_FEOK(ferr); ferr = msg_mon_get_my_process_name(my_name, BUFSIZ); util_check("msg_mon_get_my_process_name", ferr); ferr = msg_mon_get_process_info(my_name, &nid, &pid); TEST_CHK_FEOK(ferr); ferr = XPROCESSHANDLE_GETMINE_(TPT_REF(mphandle)); util_check("XPROCESSHANDLE_GETMINE_", ferr); TPT_COPY_INT(mphandlei, mphandle); assert((mphandlei[0] & 0xf0) == 0x20); // named assert(strncmp(my_name, &mphandlec[4], 32) == 0); printf("phandle=%x.%x.%x.%x.%x, pname=%s\n", mphandlei[0], mphandlei[1], mphandlei[2], mphandlei[3], mphandlei[4], my_name); ferr = XPROCESSHANDLE_DECOMPOSE_(TPT_REF(mphandle), &cpu, &pin, &nodenumber, nodename, sizeof(nodename), &nodename_length, procname, sizeof(procname), &procname_length, &sequence_number); assert(cpu == nid); assert(pin == pid); assert(nodenumber == 0); assert(nodename_length == 4); nodename[nodename_length] = 0; assert(strcmp(nodename, "\\NSK") == 0); procname[procname_length] = 0; assert(strcmp(procname, my_name) == 0); #ifdef SQ_PHANDLE_VERIFIER assert(sequence_number != 0); #else assert(sequence_number == 0); #endif if (client) { ferr = XFILE_OPEN_((char *) sname, 4, &filenum, 0, 0, 0, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); if ((inx & 1) == 0) cc = XWRITEREADX2(filenum, send_buffer, (unsigned short) (strlen(send_buffer) + 1), // cast recv_buffer, BUFSIZ, &count_read, 0); else cc = BWRITEREADX2(filenum, send_buffer, (unsigned short) (strlen(send_buffer) + 1), // cast recv_buffer, BUFSIZ, &count_read_b, 0); TEST_CHK_CCEQ(cc); printf("%s\n", recv_buffer); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum, 0, 0, 0, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { cc = XREADUPDATEX(filenum, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (unsigned short) (strlen(recv_buffer) + 1); // cast cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); } ferr = XFILE_CLOSE_(filenum, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { _bcc_status bcc; void *buf; bool client = false; int count_read; int count_written; int count_xferred; bool e_ldone; bool e_pwu; int err; int ferr; short filenumr; short filenums; int inx; int loop = 10; char *p; char recv_buffer[BUFSIZ]; char send_buffer[BUFSIZ]; int socka; int sockc; int sockl; SB_Tag_Type tag; short tfilenum; int timeout = -1; short wakeup; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(!client); // system messages TEST_CHK_FEOK(ferr); if (client) { ferr = BFILE_OPEN_((char *) "$srv", (short) 4, &filenums, 0, 0, 1, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "inx=%d", inx); bcc = BWRITEREADX(filenums, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, 1); TEST_CHK_BCCEQ(bcc); tfilenum = -1; bcc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_BCCEQ(bcc); } p = strchr(send_buffer, ':'); *p = 0; p++; strcpy(host, send_buffer); port = (unsigned short) atoi(p); if (verbose) printf("server returned host=%s, port=%d\n", host, port); if (verbose) printf("client connecting up\n"); // connect up, and setup fds epoll_init(); sockc = do_sock_connect(); pin_main = 1; proc_register_group_pin(-1, pin_main); epoll_add(sockc); do_thread_create(); bcc = BWRITEREADX(filenums, NULL, 0, BUFSIZ, &count_read, 1); TEST_CHK_BCCEQ(bcc); usleep(10000); e_pwu = false; e_ldone = false; for (;;) { wakeup = XWAIT(LDONE | PWU, -1); if (wakeup & PWU) { e_pwu = true; do_io_comp(); } if (wakeup & LDONE) { e_ldone = true; timeout = -1; tfilenum = -1; bcc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_BCCEQ(bcc); } if (e_ldone && e_pwu) break; } do_thread_join(); if (verbose) printf("client closing\n"); ferr = BFILE_CLOSE_(filenums, 0); TEST_CHK_FEOK(ferr); printf("if there were no asserts, all is well\n"); } else { sockl = do_sock_listen(); assert(sockl != -1); ferr = BFILE_OPEN_((char *) "$RECEIVE", 8, &filenumr, 0, 0, 1, 1, 1, // no sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); for (inx = 0; inx < loop; inx++) { bcc = BREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 1); TEST_CHK_BCCEQ(bcc); tfilenum = filenumr; bcc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_BCCEQ(bcc); assert(tag == 1); sprintf(recv_buffer, "%s:%d\n", host, port); count_read = (short) (strlen(recv_buffer) + 1); bcc = BREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_BCCEQ(bcc); } if (verbose) printf("server accepting\n"); socka = do_sock_accept(sockl); err = (int) write(socka, recv_buffer, 1); assert(err != -1); for (inx = 0; inx < 1; inx++) { bcc = BREADUPDATEX(filenumr, recv_buffer, BUFSIZ, &count_read, 1); TEST_CHK_BCCEQ(bcc); tfilenum = filenumr; bcc = BAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_BCCEQ(bcc); bcc = BREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_BCCEQ(bcc); } if (verbose) printf("server closing\n"); ferr = BFILE_CLOSE_(filenumr, 0); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }
int main(int argc, char *argv[]) { void *buf; _xcc_status cc; bool client = false; unsigned short count_read; unsigned short count_written; unsigned short count_xferred; int ferr; short filenum_rcv; short filenum_wr; int inx; short lasterr; int loop = 10; char my_name[BUFSIZ]; char recv_buffer[BUFSIZ]; char send_buffer[BUFSIZ]; SB_Tag_Type tag; short tfilenum; int timeout = -1; bool verbose = false; TAD zargs[] = { { "-client", TA_Bool, TA_NOMAX, &client }, { "-loop", TA_Int, TA_NOMAX, &loop }, { "-server", TA_Ign, TA_NOMAX, NULL }, { "-v", TA_Bool, TA_NOMAX, &verbose }, { "", TA_End, TA_NOMAX, NULL } }; ferr = file_init(&argc, &argv); TEST_CHK_FEOK(ferr); msfs_util_init_fs(&argc, &argv, file_debug_hook); arg_proc_args(zargs, false, argc, argv); util_test_start(client); ferr = file_mon_process_startup(true); // system messages TEST_CHK_FEOK(ferr); util_gethostname(my_name, sizeof(my_name)); // process-wait for client/server/shell ferr = msfs_util_wait_process_count(MS_ProcessType_Generic, 3, NULL, verbose); TEST_CHK_FEOK(ferr); if (client) { ferr = XFILE_OPEN_((char *) "$srv", 4, &filenum_wr, 0, 0, 1, 0, 0, 0, 0, NULL); TEST_CHK_FEOK(ferr); ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum_rcv, 0, 0, 0, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); // read open message cc = XREADUPDATEX(filenum_rcv, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCNE(cc); if (_xstatus_ne(cc)) { ferr = XFILE_GETINFO_(-1, &lasterr, NULL, 0, NULL, NULL, NULL); TEST_CHK_FEOK(ferr); assert(lasterr == XZFIL_ERR_SYSMESS); } cc = XREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "hello, greetings from %s, inx=%d", my_name, inx); if (verbose) printf("client doing writeread inx=%d\n", inx); cc = XWRITEREADX(filenum_wr, send_buffer, (short) (strlen(send_buffer) + 1), BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); if (verbose) printf("client doing awaitiox inx=%d\n", inx); tfilenum = filenum_wr; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); if (verbose) printf("client writeread done inx=%d\n", inx); printf("%s\n", send_buffer); } ferr = XFILE_CLOSE_(filenum_wr, 0); TEST_CHK_FEOK(ferr); ferr = file_mon_process_close(); TEST_CHK_FEOK(ferr); } else { ferr = XFILE_OPEN_((char *) "$RECEIVE", 8, &filenum_rcv, 0, 0, 1, 1, 0, // sys msg 0, 0, NULL); TEST_CHK_FEOK(ferr); // read open message cc = XREADUPDATEX(filenum_rcv, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); tfilenum = filenum_rcv; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); if (_xstatus_ne(cc)) { ferr = XFILE_GETINFO_(-1, &lasterr, NULL, 0, NULL, NULL, NULL); TEST_CHK_FEOK(ferr); assert(lasterr == XZFIL_ERR_SYSMESS); } cc = XREPLYX(recv_buffer, 0, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); ferr = XFILE_OPEN_((char *) "$cli", 4, &filenum_wr, 0, 0, 1, 0, 0, 0, 0, NULL); for (inx = 0; inx < loop; inx++) { sprintf(send_buffer, "i'm the server inx=%d", inx); if (verbose) printf("server doing readupdate inx=%d\n", inx); cc = XREADUPDATEX(filenum_rcv, recv_buffer, BUFSIZ, &count_read, 0); TEST_CHK_CCEQ(cc); if (verbose) printf("server doing awaitiox inx=%d\n", inx); tfilenum = filenum_rcv; cc = XAWAITIOX(&tfilenum, &buf, &count_xferred, &tag, timeout, NULL); TEST_CHK_CCEQ(cc); if (verbose) printf("server awaitiox done inx=%d\n", inx); strcat(recv_buffer, "- reply from "); strcat(recv_buffer, my_name); count_read = (short) (strlen(recv_buffer) + 1); if (verbose) printf("server doing reply inx=%d\n", inx); cc = XREPLYX(recv_buffer, count_read, &count_written, 0, XZFIL_ERR_OK); TEST_CHK_CCEQ(cc); if (verbose) printf("server reply done inx=%d\n", inx); } ferr = XFILE_CLOSE_(filenum_rcv, 0); TEST_CHK_FEOK(ferr); ferr = file_mon_process_close(); TEST_CHK_FEOK(ferr); } ferr = file_mon_process_shutdown(); TEST_CHK_FEOK(ferr); util_test_finish(client); return 0; }