file reorg, pathnames.h, paths.h
[unix-history] / usr / src / usr.bin / vmstat / vmstat.c
index 87092e5..4611856 100644 (file)
@@ -1,22 +1,29 @@
 /*
 /*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+ * Copyright (c) 1980 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms are permitted
+ * provided that the above copyright notice and this paragraph are
+ * duplicated in all such forms and that any documentation,
+ * advertising materials, and other materials related to such
+ * distribution and use acknowledge that the software was developed
+ * by the University of California, Berkeley.  The name of the
+ * University may not be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  */
 
 #ifndef lint
 char copyright[] =
  */
 
 #ifndef lint
 char copyright[] =
-"@(#) Copyright (c) 1980 Regents of the University of California.\n\
+"@(#) Copyright (c) 1980 The Regents of the University of California.\n\
  All rights reserved.\n";
  All rights reserved.\n";
-#endif not lint
+#endif /* not lint */
 
 #ifndef lint
 
 #ifndef lint
-static char sccsid[] = "@(#)vmstat.c   5.10 (Berkeley) %G%";
-#endif not lint
-
-#include <stdio.h>
-#include <ctype.h>
-#include <nlist.h>
+static char sccsid[] = "@(#)vmstat.c   5.13 (Berkeley) %G%";
+#endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/file.h>
 
 #include <sys/param.h>
 #include <sys/file.h>
@@ -28,6 +35,10 @@ static char sccsid[] = "@(#)vmstat.c 5.10 (Berkeley) %G%";
 #include <sys/namei.h>
 #include <sys/text.h>
 #include <sys/malloc.h>
 #include <sys/namei.h>
 #include <sys/text.h>
 #include <sys/malloc.h>
+#include <stdio.h>
+#include <ctype.h>
+#include <nlist.h>
+#include <paths.h>
 
 struct nlist nl[] = {
 #define        X_CPTIME        0
 
 struct nlist nl[] = {
 #define        X_CPTIME        0
@@ -144,14 +155,14 @@ main(argc, argv)
        long t;
        char *arg, **cp, buf[BUFSIZ];
 
        long t;
        char *arg, **cp, buf[BUFSIZ];
 
-       nlist("/vmunix", nl);
+       nlist(_PATH_UNIX, nl);
        if(nl[0].n_type == 0) {
        if(nl[0].n_type == 0) {
-               fprintf(stderr, "no /vmunix namelist\n");
+               fprintf(stderr, "vmstat: no %s namelist\n", _PATH_UNIX);
                exit(1);
        }
                exit(1);
        }
-       mf = open("/dev/kmem", 0);
+       mf = open(_PATH_KMEM, 0);
        if(mf < 0) {
        if(mf < 0) {
-               fprintf(stderr, "cannot open /dev/kmem\n");
+               fprintf(stderr, "vmstat: cannot open %s\n", _PATH_KMEM);
                exit(1);
        }
        iter = 0;
                exit(1);
        }
        iter = 0;
@@ -167,7 +178,7 @@ main(argc, argv)
 
                case 'z':
                        close(mf);
 
                case 'z':
                        close(mf);
-                       mf = open("/dev/kmem", 2);
+                       mf = open(_PATH_KMEM, 2);
                        lseek(mf, (long)nl[X_SUM].n_value, L_SET);
                        write(mf, &z.Sum, sizeof z.Sum);
                        exit(0);
                        lseek(mf, (long)nl[X_SUM].n_value, L_SET);
                        write(mf, &z.Sum, sizeof z.Sum);
                        exit(0);
@@ -565,12 +576,13 @@ char *kmemnames[] = {
        "cred",         /* 16 M_CRED */
        "pgrp",         /* 17 M_PGRP */
        "session",      /* 18 M_SESSION */
        "cred",         /* 16 M_CRED */
        "pgrp",         /* 17 M_PGRP */
        "session",      /* 18 M_SESSION */
+       "iov",          /* 19 M_IOV */
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
        0, 0, 0, 0, 0,
-       0, 0, 0, 0, 0,
+       0, 0, 0, 0,
        "temp",         /* 49 M_TEMP */
 };
 
        "temp",         /* 49 M_TEMP */
 };