convert from kinfo to sysctl
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 1 Apr 1993 08:10:57 +0000 (00:10 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 1 Apr 1993 08:10:57 +0000 (00:10 -0800)
SCCS-vsn: usr.bin/w/w.c 5.34
SCCS-vsn: lib/libc/gmon/gmon.c 5.13
SCCS-vsn: usr.bin/fstat/fstat.c 5.43

usr/src/lib/libc/gmon/gmon.c
usr/src/usr.bin/fstat/fstat.c
usr/src/usr.bin/w/w.c

index 613bf80..2c892e5 100644 (file)
@@ -6,13 +6,13 @@
  */
 
 #if !defined(lint) && defined(LIBC_SCCS)
  */
 
 #if !defined(lint) && defined(LIBC_SCCS)
-static char sccsid[] = "@(#)gmon.c     5.12 (Berkeley) %G%";
+static char sccsid[] = "@(#)gmon.c     5.13 (Berkeley) %G%";
 #endif
 
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/time.h>
 #endif
 
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/time.h>
-#include <sys/kinfo.h>
+#include <sys/sysctl.h>
 
 #ifdef DEBUG
 #include <stdio.h>
 
 #ifdef DEBUG
 #include <stdio.h>
@@ -41,7 +41,7 @@ monstartup(lowpc, highpc)
 {
        register int o;
        struct clockinfo clockinfo;
 {
        register int o;
        struct clockinfo clockinfo;
-       int tsize, fsize, size;
+       int mib[2], tsize, fsize, size;
        char *cp;
        struct gmonhdr *hdr;
        struct gmonparam *p = &_gmonparam;
        char *cp;
        struct gmonhdr *hdr;
        struct gmonparam *p = &_gmonparam;
@@ -103,7 +103,9 @@ monstartup(lowpc, highpc)
 
        moncontrol(1);
        size = sizeof(clockinfo);
 
        moncontrol(1);
        size = sizeof(clockinfo);
-       if (getkerninfo(KINFO_CLOCKRATE, &clockinfo, &size, 0) < 0)
+       mib[0] = CTL_KERN;
+       mib[1] = KERN_CLOCKRATE;
+       if (sysctl(mib, 2, &clockinfo, &size, NULL, 0) < 0)
                /*
                 * Best guess
                 */
                /*
                 * Best guess
                 */
index 3a8c191..ec0c715 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)fstat.c    5.42 (Berkeley) %G%";
+static char sccsid[] = "@(#)fstat.c    5.43 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -26,7 +26,7 @@ static char sccsid[] = "@(#)fstat.c   5.42 (Berkeley) %G%";
 #include <sys/domain.h>
 #include <sys/protosw.h>
 #include <sys/unpcb.h>
 #include <sys/domain.h>
 #include <sys/protosw.h>
 #include <sys/unpcb.h>
-#include <sys/kinfo.h>
+#include <sys/sysctl.h>
 #include <sys/kinfo_proc.h>
 #include <sys/filedesc.h>
 #define        KERNEL
 #include <sys/kinfo_proc.h>
 #include <sys/filedesc.h>
 #define        KERNEL
@@ -132,7 +132,7 @@ main(argc, argv)
        int cnt;
 
        arg = 0;
        int cnt;
 
        arg = 0;
-       what = KINFO_PROC_ALL;
+       what = KERN_PROC_ALL;
        nlistf = memf = NULL;
        while ((ch = getopt(argc, argv, "fnp:u:vNM")) != EOF)
                switch((char)ch) {
        nlistf = memf = NULL;
        while ((ch = getopt(argc, argv, "fnp:u:vNM")) != EOF)
                switch((char)ch) {
@@ -156,7 +156,7 @@ main(argc, argv)
                                    "fstat: -p requires a process id\n");
                                usage();
                        }
                                    "fstat: -p requires a process id\n");
                                usage();
                        }
-                       what = KINFO_PROC_PID;
+                       what = KERN_PROC_PID;
                        arg = atoi(optarg);
                        break;
                case 'u':
                        arg = atoi(optarg);
                        break;
                case 'u':
@@ -167,7 +167,7 @@ main(argc, argv)
                                    optarg);
                                exit(1);
                        }
                                    optarg);
                                exit(1);
                        }
-                       what = KINFO_PROC_UID;
+                       what = KERN_PROC_UID;
                        arg = passwd->pw_uid;
                        break;
                case 'v':
                        arg = passwd->pw_uid;
                        break;
                case 'v':
index 23eaaa9..080f9bc 100644 (file)
@@ -12,7 +12,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)w.c        5.33 (Berkeley) %G%";
+static char sccsid[] = "@(#)w.c        5.34 (Berkeley) %G%";
 #endif /* not lint */
 
 #define ADDRHACK
 #endif /* not lint */
 
 #define ADDRHACK
@@ -27,7 +27,7 @@ static char sccsid[] = "@(#)w.c       5.33 (Berkeley) %G%";
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/stat.h>
 #include <sys/file.h>
 #include <sys/time.h>
 #include <sys/stat.h>
-#include <sys/kinfo.h>
+#include <sys/sysctl.h>
 #include <sys/proc.h>
 #include <sys/user.h>
 #include <sys/ioctl.h>
 #include <sys/proc.h>
 #include <sys/user.h>
 #include <sys/ioctl.h>
@@ -280,7 +280,7 @@ main(argc, argv)
                printf(HEADER);
        }
 
                printf(HEADER);
        }
 
-       if ((kp = kvm_getprocs(kd, KINFO_PROC_ALL, 0, &nentries)) == NULL)
+       if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL)
                error("%s", kvm_geterr(kd));
        for (i = 0; i < nentries; i++, kp++) {
                register struct proc *p = &kp->kp_proc;
                error("%s", kvm_geterr(kd));
        for (i = 0; i < nentries; i++, kp++) {
                register struct proc *p = &kp->kp_proc;