]> git.proxmox.com Git - mirror_ovs.git/blobdiff - utilities/ovs-benchmark.c
ovsdb-idl: log error in client when db schema does not exist on server
[mirror_ovs.git] / utilities / ovs-benchmark.c
index d2f2e8b3484d3a8239f6821af3115e77ff91224b..ee593ff6e45d4cae93416422f6f5f2dac64429a9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, 2012, 2013 Nicira, Inc.
+ * Copyright (c) 2010, 2011, 2012, 2013, 2015 Nicira, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -81,10 +81,13 @@ time_in_msec(void)
 int
 main(int argc, char *argv[])
 {
+    struct ovs_cmdl_context ctx = { .argc = 0, };
     set_program_name(argv[0]);
     vlog_set_levels(NULL, VLF_ANY_DESTINATION, VLL_EMER);
     parse_options(argc, argv);
-    ovs_cmdl_run_command(argc - optind, argv + optind, get_all_commands());
+    ctx.argc = argc - optind;
+    ctx.argv = argv + optind;
+    ovs_cmdl_run_command(&ctx, get_all_commands());
     return 0;
 }
 
@@ -244,7 +247,7 @@ Other options:\n\
 }
 
 static void
-cmd_listen(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+cmd_listen(struct ovs_cmdl_context *ctx OVS_UNUSED)
 {
     struct pollfd *fds;
     int n_fds;
@@ -370,7 +373,7 @@ bind_local_port(int fd, unsigned short int *local_port,
 }
 
 static void
-cmd_rate(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+cmd_rate(struct ovs_cmdl_context *ctx OVS_UNUSED)
 {
     unsigned short int local_port;
     unsigned short int remote_port;
@@ -396,7 +399,7 @@ cmd_rate(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
         long long int now;
         long long int may_open;
         int delay;
-        int error;
+        int retval;
         int j;
 
         if (max_rate > 0) {
@@ -455,8 +458,8 @@ cmd_rate(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
             delay = 1000;
         }
 
-        error = do_poll(fds, n_fds, delay);
-        if (error) {
+        retval = do_poll(fds, n_fds, delay);
+        if (retval < 0) {
             ovs_fatal(errno, "poll");
         }
 
@@ -488,6 +491,7 @@ cmd_rate(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
             }
         }
     }
+    free(fds);
 }
 
 static void
@@ -520,7 +524,7 @@ timer_end(long long int start, bool error,
 }
 
 static void
-cmd_latency(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+cmd_latency(struct ovs_cmdl_context *ctx OVS_UNUSED)
 {
     unsigned short int local_port;
     unsigned short int remote_port;
@@ -584,10 +588,10 @@ cmd_latency(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
         }
 
         while (n_fds > 0) {
-            int error;
+            int retval;
 
-            error = do_poll(fds, n_fds, -1);
-            if (error) {
+            retval = do_poll(fds, n_fds, -1);
+            if (retval < 0) {
                 ovs_fatal(errno, "poll");
             }
 
@@ -611,7 +615,7 @@ cmd_latency(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
 }
 
 static void
-cmd_help(int argc OVS_UNUSED, char *argv[] OVS_UNUSED)
+cmd_help(struct ovs_cmdl_context *ctx OVS_UNUSED)
 {
     usage();
 }