svn commit: r230548 - head/usr.bin/procstat

Mikolaj Golub trociny at FreeBSD.org
Wed Jan 25 20:13:38 UTC 2012


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));
+	}
 }


More information about the svn-src-all mailing list