[BACK]Return to mbufs.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / systat

Diff for /src/usr.bin/systat/mbufs.c between version 1.9 and 1.10

version 1.9, 2001/12/07 09:18:08 version 1.10, 2002/06/09 05:16:20
Line 44 
Line 44 
 #include <sys/param.h>  #include <sys/param.h>
 #include <sys/types.h>  #include <sys/types.h>
 #include <sys/mbuf.h>  #include <sys/mbuf.h>
   #include <sys/sysctl.h>
   
 #include <stdlib.h>  #include <stdlib.h>
 #include <string.h>  #include <string.h>
Line 148 
Line 149 
 {  {
         int ret;          int ret;
   
         if (namelist[X_MBSTAT].n_type == 0) {          if (kd != NULL) {
                 if ((ret = kvm_nlist(kd, namelist)) == -1)  
                         errx(1, "%s", kvm_geterr(kd));  
                 else if (ret)  
                         nlisterr(namelist);  
                 if (namelist[X_MBSTAT].n_type == 0) {                  if (namelist[X_MBSTAT].n_type == 0) {
                         error("namelist on %s failed", _PATH_UNIX);                          if ((ret = kvm_nlist(kd, namelist)) == -1)
                         return(0);                                  errx(1, "%s", kvm_geterr(kd));
                           else if (ret)
                                   nlisterr(namelist);
                           if (namelist[X_MBSTAT].n_type == 0) {
                                   error("namelist on %s failed", _PATH_UNIX);
                                   return(0);
                           }
                 }                  }
         }          }
         if (mb == 0)          if (mb == 0)
Line 166 
Line 169 
 void  void
 fetchmbufs()  fetchmbufs()
 {  {
         if (namelist[X_MBSTAT].n_type == 0)          int mib[2];
                 return;          size_t size = sizeof (*mb);
         NREAD(X_MBSTAT, mb, sizeof (*mb));  
           if (kd == NULL) {
                   mib[0] = CTL_KERN;
                   mib[1] = KERN_MBSTAT;
                   if (sysctl(mib, 2, mb, &size, NULL, 0) < 0)
                           err(1, "sysctl(KERN_MBSTAT) failed");
           } else {
                   if (namelist[X_MBSTAT].n_type == 0)
                           return;
                   NREAD(X_MBSTAT, mb, size);
           }
 }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.10