mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] print unsigned integers in sunrpc stats
@ 2005-08-30  8:27 Max Kellermann
  0 siblings, 0 replies; only message in thread
From: Max Kellermann @ 2005-08-30  8:27 UTC (permalink / raw)
  To: linux-kernel; +Cc: bk

[-- Attachment #1: Type: text/plain, Size: 253 bytes --]

Hi,

the sunrpc stats are collected in unsigned integers, but they are
printed with '%d'.  That can result in negative numbers in
/proc/net/rpc when the highest bit of a counter is set.  The following
patch changes '%d' to '%u' where appropriate.

Max


[-- Attachment #2: sunrpc-unsigned-stats.patch --]
[-- Type: text/plain, Size: 1586 bytes --]

--- linux-2.6.13/net/sunrpc/stats.c.orig	2005-08-30 10:22:35.000000000 +0200
+++ linux-2.6.13/net/sunrpc/stats.c	2005-08-30 10:28:51.000000000 +0200
@@ -35,13 +35,13 @@
 	int		i, j;
 
 	seq_printf(seq,
-		"net %d %d %d %d\n",
+		"net %u %u %u %u\n",
 			statp->netcnt,
 			statp->netudpcnt,
 			statp->nettcpcnt,
 			statp->nettcpconn);
 	seq_printf(seq,
-		"rpc %d %d %d\n",
+		"rpc %u %u %u\n",
 			statp->rpccnt,
 			statp->rpcretrans,
 			statp->rpcauthrefresh);
@@ -50,10 +50,10 @@
 		const struct rpc_version *vers = prog->version[i];
 		if (!vers)
 			continue;
-		seq_printf(seq, "proc%d %d",
+		seq_printf(seq, "proc%u %u",
 					vers->number, vers->nrprocs);
 		for (j = 0; j < vers->nrprocs; j++)
-			seq_printf(seq, " %d",
+			seq_printf(seq, " %u",
 					vers->procs[j].p_count);
 		seq_putc(seq, '\n');
 	}
@@ -83,13 +83,13 @@
 	int		i, j;
 
 	seq_printf(seq,
-		"net %d %d %d %d\n",
+		"net %u %u %u %u\n",
 			statp->netcnt,
 			statp->netudpcnt,
 			statp->nettcpcnt,
 			statp->nettcpconn);
 	seq_printf(seq,
-		"rpc %d %d %d %d %d\n",
+		"rpc %u %u %u %u %u\n",
 			statp->rpccnt,
 			statp->rpcbadfmt+statp->rpcbadauth+statp->rpcbadclnt,
 			statp->rpcbadfmt,
@@ -99,9 +99,9 @@
 	for (i = 0; i < prog->pg_nvers; i++) {
 		if (!(vers = prog->pg_vers[i]) || !(proc = vers->vs_proc))
 			continue;
-		seq_printf(seq, "proc%d %d", i, vers->vs_nproc);
+		seq_printf(seq, "proc%d %u", i, vers->vs_nproc);
 		for (j = 0; j < vers->vs_nproc; j++, proc++)
-			seq_printf(seq, " %d", proc->pc_count);
+			seq_printf(seq, " %u", proc->pc_count);
 		seq_putc(seq, '\n');
 	}
 }

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-08-30  8:28 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-30  8:27 [PATCH] print unsigned integers in sunrpc stats Max Kellermann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®