Print this page
10052 "dladm show-ether" should pick one kstat snapshot and stick with it
Reviewed by: Rob Johnston <rob.johnston@joyent.com>
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Gergo Doma <domag02@gmail.com>
Reviewed by: Andy Fiddaman <andy@omniosce.org>

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/flowstat/flowstat.c
          +++ new/usr/src/cmd/flowstat/flowstat.c
↓ open down ↓ 19 lines elided ↑ open up ↑
  20   20   */
  21   21  /*
  22   22   * Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
  23   23   * Use is subject to license terms.
  24   24   */
  25   25  
  26   26  /*
  27   27   * Copyright 2017 Joyent, Inc.
  28   28   */
  29   29  
       30 +/*
       31 + * Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
       32 + */
       33 +
  30   34  #include <stdio.h>
  31   35  #include <locale.h>
  32   36  #include <stdarg.h>
  33   37  #include <stdlib.h>
  34   38  #include <fcntl.h>
  35   39  #include <string.h>
  36   40  #include <stropts.h>
  37   41  #include <errno.h>
  38   42  #include <strings.h>
  39   43  #include <getopt.h>
↓ open down ↓ 379 lines elided ↑ open up ↑
 419  423  
 420  424          /* Get previous stats for the flow */
 421  425          flow_node = get_flow_prev_stat(flowname, arg);
 422  426          if (flow_node == NULL)
 423  427                  goto done;
 424  428  
 425  429          flow_node->fc_visited = B_TRUE;
 426  430          prev_stat = flow_node->fc_stat;
 427  431  
 428  432          /* Query library for current stats */
 429      -        curr_stat = dladm_flow_stat_query(flowname);
      433 +        curr_stat = dladm_flow_stat_query(handle, flowname);
 430  434          if (curr_stat == NULL)
 431  435                  goto done;
 432  436  
 433  437          /* current stats - prev iteration stats */
 434  438          diff_stat = dladm_flow_stat_diff(curr_stat, prev_stat);
 435  439  
 436  440          /* Free prev stats */
 437  441          dladm_flow_stat_free(prev_stat);
 438  442  
 439  443          /* Prev <- curr stats */
↓ open down ↓ 44 lines elided ↑ open up ↑
 484  488          }
 485  489  }
 486  490  
 487  491  /* ARGSUSED */
 488  492  static int
 489  493  dump_one_flow_stats(dladm_handle_t handle, dladm_flow_attr_t *attr, void *arg)
 490  494  {
 491  495          char    *flowname = attr->fa_flowname;
 492  496          void    *stat;
 493  497  
 494      -        stat = dladm_flow_stat_query_all(flowname);
      498 +        stat = dladm_flow_stat_query_all(handle, flowname);
 495  499          if (stat == NULL)
 496  500                  goto done;
 497  501          print_all_stats(stat);
 498  502          dladm_flow_stat_query_all_free(stat);
 499  503  
 500  504  done:
 501  505          return (DLADM_WALK_CONTINUE);
 502  506  }
 503  507  
 504  508  /*
↓ open down ↓ 608 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX