Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 12 Jan 2003 04:00:39 +1100 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        Maxime Henrion <mux@FreeBSD.org>
Cc:        Matt Dillon <dillon@FreeBSD.org>, <cvs-committers@FreeBSD.org>, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sbin/sysctl sysctl.c src/sys/vm vm_meter.c vm_param.h src/usr.bin/systat vmstat.c src/usr.bin/vmstat vmstat.c
Message-ID:  <20030112023654.C3194-100000@gamplex.bde.org>
In-Reply-To: <20030111115116.GA16775@elvis.mu.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 11 Jan 2003, Maxime Henrion wrote:

> Matt Dillon wrote:
> > dillon      2003/01/10 23:29:47 PST
> >
> >   Modified files:
> >     sbin/sysctl          sysctl.c
> >     sys/vm               vm_meter.c vm_param.h
> >     usr.bin/systat       vmstat.c
> >     usr.bin/vmstat       vmstat.c
> >   Log:
> >   Make 'sysctl vm.vmtotal' work properly using updated patch from Hiten.
> >   (the patch in the PR was stale).
>
> Was this commit tested ?  It breaks the build of the kernel.  Can you
> please fix this ?

I had not noticed this, but noticed many others (loss of compatibility
by renaming old interfaces, printf format errors in sysctl.c including
truncating all the int32_t fields mod 64K, and some bugs in the source
and output formatting in sysctl.c).

The following patch fixes most of the problems in sysctl.c (however, I
would prefer to back out the changes there, since everything is or should
be better thandled in vmstat or systat).

%%%
Index: sysctl.c
===================================================================
RCS file: /home/ncvs/src/sbin/sysctl/sysctl.c,v
retrieving revision 1.49
diff -u -2 -r1.49 sysctl.c
--- sysctl.c	11 Jan 2003 07:29:46 -0000	1.49
+++ sysctl.c	11 Jan 2003 16:45:38 -0000
@@ -333,15 +333,19 @@
 		return (0);
 	}
-
 	printf("\nSystem wide totals computed every five seconds:\n");
 	printf("===============================================\n");
-	printf("Processes: (RUNQ:\t %hu Disk Wait: %hu Page Wait: %hu Sleep: %hu)\n",
-		v->t_rq, v->t_dw, v->t_pw, v->t_sl);
-	printf("Virtual Memory:\t\t (Total: %hu Active %hu)\n", v->t_vm, v->t_avm);
-	printf("Real Memory:\t\t (Total: %hu Active %hu)\n", v->t_rm, v->t_arm);
-	printf("Shared Virtual Memory:\t (Total: %hu Active: %hu)\n", v->t_vmshr, v->t_avmshr);
-	printf("Shared Real Memory:\t (Total: %hu Active: %hu)\n", v->t_rmshr, v->t_armshr);
-	printf("Free Memory Pages:\t %hu\n", v->t_free);
-
+	printf(
+"Processes:\t\t (RUNQ %d, Disk Wait %d, Page Wait %d, Sleep %d, Swap %d)\n",
+	    v->t_rq, v->t_dw, v->t_pw, v->t_sl, v->t_sw);
+	printf(
+"Virtual Memory:\t\t (Total %#lx (bytes; others: pages), Active %ld)\n",
+	    (u_long)v->t_vm, (long)v->t_avm);
+	printf("Real Memory:\t\t (Total %ld, Active %ld)\n",
+	    (long)v->t_rm, (long)v->t_arm);
+	printf("Shared Virtual Memory:\t (Total %ld, Active %ld)\n",
+	    (long)v->t_vmshr, (long)v->t_avmshr);
+	printf("Shared Real Memory:\t (Total %ld, Active %ld)\n",
+	    (long)v->t_rmshr, (long)v->t_armshr);
+	printf("Free Memory Pages:\t %ld", (long)v->t_free);
 	return (0);
 }
%%%

This makes differences like the following in the output:

%%%
--- out.old	Sun Jan 12 03:40:42 2003
+++ out.new	Sun Jan 12 03:45:45 2003
@@ -2,9 +2,8 @@
 System wide totals computed every five seconds:
 ===============================================
-Processes: (RUNQ:	 1 Disk Wait: 0 Page Wait: 0 Sleep: 32)
-Virtual Memory:		 (Total: 21697 Active 6295)
-Real Memory:		 (Total: 60670 Active 3718)
-Shared Virtual Memory:	 (Total: 933 Active: 855)
-Shared Real Memory:	 (Total: 513 Active: 503)
-Free Memory Pages:	 5544
-
+Processes:		 (RUNQ 1, Disk Wait 0, Page Wait 0, Sleep 32, Swap 0)
+Virtual Memory:		 (Total 0x800a5525 (bytes; others: pages), Active 6307)
+Real Memory:		 (Total 126259, Active 3732)
+Shared Virtual Memory:	 (Total 933, Active 855)
+Shared Real Memory:	 (Total 513, Active 503)
+Free Memory Pages:	 5425
%%%

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030112023654.C3194-100000>