From 4399303fd6414fe250c01e8cf5bc75bd1f1f8e00 Mon Sep 17 00:00:00 2001 From: trociny Date: Wed, 25 Jan 2012 20:13:37 +0000 Subject: After the recent changes there is no need in rlimit array any more. Submitted by: Andrey Zonov MFC after: 1 week --- usr.bin/procstat/procstat_rlimit.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'usr.bin/procstat') diff --git a/usr.bin/procstat/procstat_rlimit.c b/usr.bin/procstat/procstat_rlimit.c index 5f9c5fc..c5429c4 100644 --- a/usr.bin/procstat/procstat_rlimit.c +++ b/usr.bin/procstat/procstat_rlimit.c @@ -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, rlim_t limit) 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)); + } } -- cgit v1.1