Print this page
10139 smatch fixes for usr/src/cmd/stat

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/stat/vmstat/vmstat.c
          +++ new/usr/src/cmd/stat/vmstat/vmstat.c
↓ open down ↓ 3 lines elided ↑ open up ↑
   4    4  
   5    5  /*
   6    6   * Copyright (c) 1980 Regents of the University of California.
   7    7   * All rights reserved.  The Berkeley software License Agreement
   8    8   * specifies the terms and conditions for redistribution.
   9    9   */
  10   10  
  11   11  /* from UCB 5.4 5/17/86 */
  12   12  /* from SunOS 4.1, SID 1.31 */
  13   13  
       14 +/*
       15 + * Copyright (c) 2018, Joyent, Inc.
       16 + */
       17 +
  14   18  #include <stdio.h>
  15   19  #include <stdlib.h>
  16   20  #include <stdarg.h>
  17   21  #include <ctype.h>
  18   22  #include <unistd.h>
  19   23  #include <memory.h>
  20   24  #include <string.h>
  21   25  #include <fcntl.h>
  22   26  #include <errno.h>
  23   27  #include <signal.h>
↓ open down ↓ 194 lines elided ↑ open up ↑
 218  222  /*ARGSUSED*/
 219  223  static void
 220  224  show_disk(void *v1, void *v2, void *d)
 221  225  {
 222  226          struct iodev_snapshot *old = (struct iodev_snapshot *)v1;
 223  227          struct iodev_snapshot *new = (struct iodev_snapshot *)v2;
 224  228          hrtime_t oldtime = new->is_crtime;
 225  229          double hr_etime;
 226  230          double reads, writes;
 227  231  
 228      -        if (new == NULL)
 229      -                return;
 230      -
 231  232          if (old)
 232  233                  oldtime = old->is_stats.wlastupdate;
 233  234          hr_etime = new->is_stats.wlastupdate - oldtime;
 234  235          if (hr_etime == 0.0)
 235  236                  hr_etime = NANOSEC;
 236  237          reads = new->is_stats.reads - (old ? old->is_stats.reads : 0);
 237  238          writes = new->is_stats.writes - (old ? old->is_stats.writes : 0);
 238  239          adjprintf(" %*.0f", 2, (reads + writes) / hr_etime * NANOSEC);
 239  240  }
 240  241  
↓ open down ↓ 268 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX