Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Jan 2012 20:13:38 +0000 (UTC)
From:      Mikolaj Golub <trociny@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r230548 - head/usr.bin/procstat
Message-ID:  <201201252013.q0PKDcOP043572@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trociny
Date: Wed Jan 25 20:13:37 2012
New Revision: 230548
URL: http://svn.freebsd.org/changeset/base/230548

Log:
  After the recent changes there is no need in rlimit array any more.
  
  Submitted by:	Andrey Zonov <andrey at zonov.org>
  MFC after:	1 week

Modified:
  head/usr.bin/procstat/procstat_rlimit.c

Modified: head/usr.bin/procstat/procstat_rlimit.c
==============================================================================
--- head/usr.bin/procstat/procstat_rlimit.c	Wed Jan 25 20:05:58 2012	(r230547)
+++ head/usr.bin/procstat/procstat_rlimit.c	Wed Jan 25 20:13:37 2012	(r230548)
@@ -66,8 +66,6 @@ static struct {
 #error "Resource limits have grown. Add new entries to rlimit_param[]."
 #endif
 
-static struct rlimit rlimit[RLIM_NLIMITS];
-
 static
 const char *humanize_rlimit(int indx, rlim_t limit)
 {
@@ -90,6 +88,7 @@ const char *humanize_rlimit(int indx, rl
 void
 procstat_rlimit(struct kinfo_proc *kipp)
 {
+	struct rlimit rlimit;
 	int error, i, name[5];
 	size_t len;
 
@@ -104,7 +103,7 @@ procstat_rlimit(struct kinfo_proc *kipp)
 	name[3] = kipp->ki_pid;
 	for (i = 0; i < RLIM_NLIMITS; i++) {
 		name[4] = i;
-		error = sysctl(name, 5, &rlimit[i], &len, NULL, 0);
+		error = sysctl(name, 5, &rlimit, &len, NULL, 0);
 		if (error < 0 && errno != ESRCH) {
 			warn("sysctl: kern.proc.rlimit: %d", kipp->ki_pid);
 			return;
@@ -114,7 +113,7 @@ procstat_rlimit(struct kinfo_proc *kipp)
 
 		printf("%5d %-16s %-16s ", kipp->ki_pid, kipp->ki_comm,
 		    rlimit_param[i].name);
-		printf("%16s ", humanize_rlimit(i, rlimit[i].rlim_cur));
-		printf("%16s\n", humanize_rlimit(i, rlimit[i].rlim_max));
-        }
+		printf("%16s ", humanize_rlimit(i, rlimit.rlim_cur));
+		printf("%16s\n", humanize_rlimit(i, rlimit.rlim_max));
+	}
 }



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