Loading trusty/libtrusty/tipc-test/tipc_test.c +717 −755 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ static const char *main_ctrl_name = "com.android.ipc-unittest.ctrl"; static const char* receiver_name = "com.android.trusty.memref.receiver"; static const char *_sopts = "hsvD:t:r:m:b:"; /* clang-format off */ static const struct option _lopts[] = { {"help", no_argument, 0, 'h'}, {"silent", no_argument, 0, 's'}, Loading @@ -56,6 +57,7 @@ static const struct option _lopts[] = { {"msgsize", required_argument, 0, 'm'}, {0, 0, 0, 0} }; /* clang-format on */ static const char *usage = "Usage: %s [options]\n" Loading Loading @@ -100,8 +102,7 @@ static bool opt_silent = false; static void print_usage_and_exit(const char *prog, int code, bool verbose) { fprintf(stderr, usage, prog); if (verbose) fprintf (stderr, "%s", usage_long); if (verbose) fprintf(stderr, "%s", usage_long); exit(code); } Loading @@ -110,14 +111,11 @@ static void parse_options(int argc, char **argv) int c; int oidx = 0; while (1) { while (1) { c = getopt_long(argc, argv, _sopts, _lopts, &oidx); if (c == -1) break; /* done */ if (c == -1) break; /* done */ switch (c) { case 'D': dev_name = strdup(optarg); break; Loading Loading @@ -169,13 +167,11 @@ static int connect_test(uint repeat) for (i = 0; i < repeat; i++) { echo_fd = tipc_connect(dev_name, echo_name); if (echo_fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); } dsink_fd = tipc_connect(dev_name, datasink_name); if (dsink_fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "datasink"); fprintf(stderr, "Failed to connect to '%s' service\n", "datasink"); } if (echo_fd >= 0) { Loading Loading @@ -205,8 +201,7 @@ static int connect_foo(uint repeat) for (i = 0; i < repeat; i++) { fd = tipc_connect(dev_name, "foo"); if (fd >= 0) { fprintf(stderr, "succeeded to connect to '%s' service\n", "foo"); fprintf(stderr, "succeeded to connect to '%s' service\n", "foo"); tipc_close(fd); } } Loading @@ -231,8 +226,7 @@ static int closer1_test(uint repeat) for (i = 0; i < repeat; i++) { fd = tipc_connect(dev_name, closer1_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "closer1"); fprintf(stderr, "Failed to connect to '%s' service\n", "closer1"); continue; } if (!opt_silent) { Loading Loading @@ -289,7 +283,6 @@ static int closer3_test(uint repeat) } for (i = 0; i < repeat; i++) { /* open 4 connections to closer3 service */ for (j = 0; j < 4; j++) { fd[j] = tipc_connect(dev_name, closer3_name); Loading @@ -303,8 +296,7 @@ static int closer3_test(uint repeat) rc = write(fd[j], buf, sizeof(buf)); if (rc != sizeof(buf)) { if (!opt_silent) { printf("%s: fd[%d]=%d: write returned = %zd\n", __func__, j, fd[j], rc); printf("%s: fd[%d]=%d: write returned = %zd\n", __func__, j, fd[j], rc); } perror("closer3_test: write"); } Loading @@ -316,13 +308,11 @@ static int closer3_test(uint repeat) /* It is expected that they will be closed by remote */ for (j = 0; j < 4; j++) { if (fd[j] < 0) continue; if (fd[j] < 0) continue; rc = write(fd[j], buf, sizeof(buf)); if (rc != sizeof(buf)) { if (!opt_silent) { printf("%s: fd[%d]=%d: write returned = %zd\n", __func__, j, fd[j], rc); printf("%s: fd[%d]=%d: write returned = %zd\n", __func__, j, fd[j], rc); } perror("closer3_test: write"); } Loading Loading @@ -354,8 +344,8 @@ static int echo_test(uint repeat, uint msgsz, bool var) char rx_buf[msgsz]; if (!opt_silent) { printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); } echo_fd = tipc_connect(dev_name, echo_name); Loading @@ -365,7 +355,6 @@ static int echo_test(uint repeat, uint msgsz, bool var) } for (i = 0; i < repeat; i++) { msg_len = msgsz; if (opt_variable && msgsz) { msg_len = rand() % msgsz; Loading @@ -386,8 +375,7 @@ static int echo_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "data truncated (%zu vs. %zu)\n", rc, msg_len); fprintf(stderr, "data truncated (%zu vs. %zu)\n", rc, msg_len); continue; } Loading Loading @@ -415,17 +403,14 @@ static int burst_write_test(uint repeat, uint msgburst, uint msgsz, bool var) char tx_buf[msgsz]; if (!opt_silent) { printf("%s: repeat %u: burst %u: msgsz %u: variable %s\n", __func__, repeat, msgburst, msgsz, var ? "true" : "false"); printf("%s: repeat %u: burst %u: msgsz %u: variable %s\n", __func__, repeat, msgburst, msgsz, var ? "true" : "false"); } for (i = 0; i < repeat; i++) { fd = tipc_connect(dev_name, datasink_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "datasink"); fprintf(stderr, "Failed to connect to '%s' service\n", "datasink"); break; } Loading Loading @@ -519,13 +504,11 @@ static int select_test(uint repeat, uint msgburst, uint msgsz) fd = tipc_connect(dev_name, echo_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); return fd; } for (i = 0; i < repeat; i++) { _wait_for_msg(fd, msgsz, 1); if (!opt_silent) { Loading Loading @@ -564,8 +547,7 @@ static int blocked_read_test(uint repeat) fd = tipc_connect(dev_name, echo_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); return fd; } Loading Loading @@ -608,8 +590,7 @@ static int ta2ta_ipc_test(void) fd = tipc_connect(dev_name, main_ctrl_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "main_ctrl"); fprintf(stderr, "Failed to connect to '%s' service\n", "main_ctrl"); return fd; } Loading @@ -629,8 +610,7 @@ static int ta2ta_ipc_test(void) } else if (rx_buf[0] == TEST_MESSAGE) { write(STDOUT_FILENO, rx_buf + 1, ret - 1); } else { fprintf(stderr, "%s: Bad message header: %d\n", __func__, rx_buf[0]); fprintf(stderr, "%s: Bad message header: %d\n", __func__, rx_buf[0]); break; } } Loading @@ -651,19 +631,11 @@ typedef struct uuid static void print_uuid(const char *dev, uuid_t *uuid) { printf("%s:", dev); printf("uuid: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", uuid->time_low, uuid->time_mid, uuid->time_hi_and_version, uuid->clock_seq_and_node[0], uuid->clock_seq_and_node[1], uuid->clock_seq_and_node[2], uuid->clock_seq_and_node[3], uuid->clock_seq_and_node[4], uuid->clock_seq_and_node[5], uuid->clock_seq_and_node[6], uuid->clock_seq_and_node[7] ); printf("uuid: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", uuid->time_low, uuid->time_mid, uuid->time_hi_and_version, uuid->clock_seq_and_node[0], uuid->clock_seq_and_node[1], uuid->clock_seq_and_node[2], uuid->clock_seq_and_node[3], uuid->clock_seq_and_node[4], uuid->clock_seq_and_node[5], uuid->clock_seq_and_node[6], uuid->clock_seq_and_node[7]); } static int dev_uuid_test(void) Loading @@ -674,8 +646,7 @@ static int dev_uuid_test(void) fd = tipc_connect(dev_name, uuid_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "uuid"); fprintf(stderr, "Failed to connect to '%s' service\n", "uuid"); return fd; } Loading @@ -684,8 +655,7 @@ static int dev_uuid_test(void) if (rc < 0) { perror("dev_uuid_test: read"); } else if (rc != sizeof(uuid)) { fprintf(stderr, "unexpected uuid size (%d vs. %d)\n", (int)rc, (int)sizeof(uuid)); fprintf(stderr, "unexpected uuid size (%d vs. %d)\n", (int)rc, (int)sizeof(uuid)); } else { print_uuid(dev_name, &uuid); } Loading @@ -705,15 +675,13 @@ static int ta_access_test(void) fd = tipc_connect(dev_name, ta_only_name); if (fd >= 0) { fprintf(stderr, "Succeed to connect to '%s' service\n", "ta_only"); fprintf(stderr, "Succeed to connect to '%s' service\n", "ta_only"); tipc_close(fd); } fd = tipc_connect(dev_name, ns_only_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "ns_only"); fprintf(stderr, "Failed to connect to '%s' service\n", "ns_only"); return fd; } tipc_close(fd); Loading @@ -738,8 +706,8 @@ static int writev_test(uint repeat, uint msgsz, bool var) struct iovec iovs[2] = {{tx0_buf, 0}, {tx1_buf, 0}}; if (!opt_silent) { printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); } echo_fd = tipc_connect(dev_name, echo_name); Loading @@ -749,7 +717,6 @@ static int writev_test(uint repeat, uint msgsz, bool var) } for (i = 0; i < repeat; i++) { msg_len = msgsz; if (opt_variable && msgsz) { msg_len = rand() % msgsz; Loading @@ -769,9 +736,8 @@ static int writev_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "writev", (size_t)rc, msg_len); fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "writev", (size_t)rc, msg_len); break; } Loading @@ -782,9 +748,8 @@ static int writev_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "read", (size_t)rc, msg_len); fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "read", (size_t)rc, msg_len); break; } Loading Loading @@ -820,8 +785,8 @@ static int readv_test(uint repeat, uint msgsz, bool var) struct iovec iovs[2] = {{rx0_buf, 0}, {rx1_buf, 0}}; if (!opt_silent) { printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); } echo_fd = tipc_connect(dev_name, echo_name); Loading @@ -831,7 +796,6 @@ static int readv_test(uint repeat, uint msgsz, bool var) } for (i = 0; i < repeat; i++) { msg_len = msgsz; if (opt_variable && msgsz) { msg_len = rand() % msgsz; Loading @@ -851,9 +815,8 @@ static int readv_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "write", (size_t)rc, msg_len); fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "write", (size_t)rc, msg_len); break; } Loading @@ -864,9 +827,8 @@ static int readv_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "write", (size_t)rc, msg_len); fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "write", (size_t)rc, msg_len); break; } Loading Loading
trusty/libtrusty/tipc-test/tipc_test.c +717 −755 Original line number Diff line number Diff line Loading @@ -46,6 +46,7 @@ static const char *main_ctrl_name = "com.android.ipc-unittest.ctrl"; static const char* receiver_name = "com.android.trusty.memref.receiver"; static const char *_sopts = "hsvD:t:r:m:b:"; /* clang-format off */ static const struct option _lopts[] = { {"help", no_argument, 0, 'h'}, {"silent", no_argument, 0, 's'}, Loading @@ -56,6 +57,7 @@ static const struct option _lopts[] = { {"msgsize", required_argument, 0, 'm'}, {0, 0, 0, 0} }; /* clang-format on */ static const char *usage = "Usage: %s [options]\n" Loading Loading @@ -100,8 +102,7 @@ static bool opt_silent = false; static void print_usage_and_exit(const char *prog, int code, bool verbose) { fprintf(stderr, usage, prog); if (verbose) fprintf (stderr, "%s", usage_long); if (verbose) fprintf(stderr, "%s", usage_long); exit(code); } Loading @@ -110,14 +111,11 @@ static void parse_options(int argc, char **argv) int c; int oidx = 0; while (1) { while (1) { c = getopt_long(argc, argv, _sopts, _lopts, &oidx); if (c == -1) break; /* done */ if (c == -1) break; /* done */ switch (c) { case 'D': dev_name = strdup(optarg); break; Loading Loading @@ -169,13 +167,11 @@ static int connect_test(uint repeat) for (i = 0; i < repeat; i++) { echo_fd = tipc_connect(dev_name, echo_name); if (echo_fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); } dsink_fd = tipc_connect(dev_name, datasink_name); if (dsink_fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "datasink"); fprintf(stderr, "Failed to connect to '%s' service\n", "datasink"); } if (echo_fd >= 0) { Loading Loading @@ -205,8 +201,7 @@ static int connect_foo(uint repeat) for (i = 0; i < repeat; i++) { fd = tipc_connect(dev_name, "foo"); if (fd >= 0) { fprintf(stderr, "succeeded to connect to '%s' service\n", "foo"); fprintf(stderr, "succeeded to connect to '%s' service\n", "foo"); tipc_close(fd); } } Loading @@ -231,8 +226,7 @@ static int closer1_test(uint repeat) for (i = 0; i < repeat; i++) { fd = tipc_connect(dev_name, closer1_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "closer1"); fprintf(stderr, "Failed to connect to '%s' service\n", "closer1"); continue; } if (!opt_silent) { Loading Loading @@ -289,7 +283,6 @@ static int closer3_test(uint repeat) } for (i = 0; i < repeat; i++) { /* open 4 connections to closer3 service */ for (j = 0; j < 4; j++) { fd[j] = tipc_connect(dev_name, closer3_name); Loading @@ -303,8 +296,7 @@ static int closer3_test(uint repeat) rc = write(fd[j], buf, sizeof(buf)); if (rc != sizeof(buf)) { if (!opt_silent) { printf("%s: fd[%d]=%d: write returned = %zd\n", __func__, j, fd[j], rc); printf("%s: fd[%d]=%d: write returned = %zd\n", __func__, j, fd[j], rc); } perror("closer3_test: write"); } Loading @@ -316,13 +308,11 @@ static int closer3_test(uint repeat) /* It is expected that they will be closed by remote */ for (j = 0; j < 4; j++) { if (fd[j] < 0) continue; if (fd[j] < 0) continue; rc = write(fd[j], buf, sizeof(buf)); if (rc != sizeof(buf)) { if (!opt_silent) { printf("%s: fd[%d]=%d: write returned = %zd\n", __func__, j, fd[j], rc); printf("%s: fd[%d]=%d: write returned = %zd\n", __func__, j, fd[j], rc); } perror("closer3_test: write"); } Loading Loading @@ -354,8 +344,8 @@ static int echo_test(uint repeat, uint msgsz, bool var) char rx_buf[msgsz]; if (!opt_silent) { printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); } echo_fd = tipc_connect(dev_name, echo_name); Loading @@ -365,7 +355,6 @@ static int echo_test(uint repeat, uint msgsz, bool var) } for (i = 0; i < repeat; i++) { msg_len = msgsz; if (opt_variable && msgsz) { msg_len = rand() % msgsz; Loading @@ -386,8 +375,7 @@ static int echo_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "data truncated (%zu vs. %zu)\n", rc, msg_len); fprintf(stderr, "data truncated (%zu vs. %zu)\n", rc, msg_len); continue; } Loading Loading @@ -415,17 +403,14 @@ static int burst_write_test(uint repeat, uint msgburst, uint msgsz, bool var) char tx_buf[msgsz]; if (!opt_silent) { printf("%s: repeat %u: burst %u: msgsz %u: variable %s\n", __func__, repeat, msgburst, msgsz, var ? "true" : "false"); printf("%s: repeat %u: burst %u: msgsz %u: variable %s\n", __func__, repeat, msgburst, msgsz, var ? "true" : "false"); } for (i = 0; i < repeat; i++) { fd = tipc_connect(dev_name, datasink_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "datasink"); fprintf(stderr, "Failed to connect to '%s' service\n", "datasink"); break; } Loading Loading @@ -519,13 +504,11 @@ static int select_test(uint repeat, uint msgburst, uint msgsz) fd = tipc_connect(dev_name, echo_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); return fd; } for (i = 0; i < repeat; i++) { _wait_for_msg(fd, msgsz, 1); if (!opt_silent) { Loading Loading @@ -564,8 +547,7 @@ static int blocked_read_test(uint repeat) fd = tipc_connect(dev_name, echo_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); fprintf(stderr, "Failed to connect to '%s' service\n", "echo"); return fd; } Loading Loading @@ -608,8 +590,7 @@ static int ta2ta_ipc_test(void) fd = tipc_connect(dev_name, main_ctrl_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "main_ctrl"); fprintf(stderr, "Failed to connect to '%s' service\n", "main_ctrl"); return fd; } Loading @@ -629,8 +610,7 @@ static int ta2ta_ipc_test(void) } else if (rx_buf[0] == TEST_MESSAGE) { write(STDOUT_FILENO, rx_buf + 1, ret - 1); } else { fprintf(stderr, "%s: Bad message header: %d\n", __func__, rx_buf[0]); fprintf(stderr, "%s: Bad message header: %d\n", __func__, rx_buf[0]); break; } } Loading @@ -651,19 +631,11 @@ typedef struct uuid static void print_uuid(const char *dev, uuid_t *uuid) { printf("%s:", dev); printf("uuid: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", uuid->time_low, uuid->time_mid, uuid->time_hi_and_version, uuid->clock_seq_and_node[0], uuid->clock_seq_and_node[1], uuid->clock_seq_and_node[2], uuid->clock_seq_and_node[3], uuid->clock_seq_and_node[4], uuid->clock_seq_and_node[5], uuid->clock_seq_and_node[6], uuid->clock_seq_and_node[7] ); printf("uuid: %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", uuid->time_low, uuid->time_mid, uuid->time_hi_and_version, uuid->clock_seq_and_node[0], uuid->clock_seq_and_node[1], uuid->clock_seq_and_node[2], uuid->clock_seq_and_node[3], uuid->clock_seq_and_node[4], uuid->clock_seq_and_node[5], uuid->clock_seq_and_node[6], uuid->clock_seq_and_node[7]); } static int dev_uuid_test(void) Loading @@ -674,8 +646,7 @@ static int dev_uuid_test(void) fd = tipc_connect(dev_name, uuid_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "uuid"); fprintf(stderr, "Failed to connect to '%s' service\n", "uuid"); return fd; } Loading @@ -684,8 +655,7 @@ static int dev_uuid_test(void) if (rc < 0) { perror("dev_uuid_test: read"); } else if (rc != sizeof(uuid)) { fprintf(stderr, "unexpected uuid size (%d vs. %d)\n", (int)rc, (int)sizeof(uuid)); fprintf(stderr, "unexpected uuid size (%d vs. %d)\n", (int)rc, (int)sizeof(uuid)); } else { print_uuid(dev_name, &uuid); } Loading @@ -705,15 +675,13 @@ static int ta_access_test(void) fd = tipc_connect(dev_name, ta_only_name); if (fd >= 0) { fprintf(stderr, "Succeed to connect to '%s' service\n", "ta_only"); fprintf(stderr, "Succeed to connect to '%s' service\n", "ta_only"); tipc_close(fd); } fd = tipc_connect(dev_name, ns_only_name); if (fd < 0) { fprintf(stderr, "Failed to connect to '%s' service\n", "ns_only"); fprintf(stderr, "Failed to connect to '%s' service\n", "ns_only"); return fd; } tipc_close(fd); Loading @@ -738,8 +706,8 @@ static int writev_test(uint repeat, uint msgsz, bool var) struct iovec iovs[2] = {{tx0_buf, 0}, {tx1_buf, 0}}; if (!opt_silent) { printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); } echo_fd = tipc_connect(dev_name, echo_name); Loading @@ -749,7 +717,6 @@ static int writev_test(uint repeat, uint msgsz, bool var) } for (i = 0; i < repeat; i++) { msg_len = msgsz; if (opt_variable && msgsz) { msg_len = rand() % msgsz; Loading @@ -769,9 +736,8 @@ static int writev_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "writev", (size_t)rc, msg_len); fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "writev", (size_t)rc, msg_len); break; } Loading @@ -782,9 +748,8 @@ static int writev_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "read", (size_t)rc, msg_len); fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "read", (size_t)rc, msg_len); break; } Loading Loading @@ -820,8 +785,8 @@ static int readv_test(uint repeat, uint msgsz, bool var) struct iovec iovs[2] = {{rx0_buf, 0}, {rx1_buf, 0}}; if (!opt_silent) { printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); printf("%s: repeat %u: msgsz %u: variable %s\n", __func__, repeat, msgsz, var ? "true" : "false"); } echo_fd = tipc_connect(dev_name, echo_name); Loading @@ -831,7 +796,6 @@ static int readv_test(uint repeat, uint msgsz, bool var) } for (i = 0; i < repeat; i++) { msg_len = msgsz; if (opt_variable && msgsz) { msg_len = rand() % msgsz; Loading @@ -851,9 +815,8 @@ static int readv_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "write", (size_t)rc, msg_len); fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "write", (size_t)rc, msg_len); break; } Loading @@ -864,9 +827,8 @@ static int readv_test(uint repeat, uint msgsz, bool var) } if ((size_t)rc != msg_len) { fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "write", (size_t)rc, msg_len); fprintf(stderr, "%s: %s: data size mismatch (%zd vs. %zd)\n", __func__, "write", (size_t)rc, msg_len); break; } Loading