diff options
author | trociny <trociny@FreeBSD.org> | 2012-01-22 20:26:46 +0000 |
---|---|---|
committer | trociny <trociny@FreeBSD.org> | 2012-01-22 20:26:46 +0000 |
commit | 575910ee0bdfab04324f5d7df6259b253ef16914 (patch) | |
tree | fa74709745015f1ac108867f7dc5e517a29d5a98 /usr.bin | |
parent | fcd1c3665658a259422a5ab83d754099b36bbd46 (diff) | |
download | FreeBSD-src-575910ee0bdfab04324f5d7df6259b253ef16914.zip FreeBSD-src-575910ee0bdfab04324f5d7df6259b253ef16914.tar.gz |
Make procstat -l to work with the new version of kern.proc.rlimit.
Submitted by: Andrey Zonov <andrey at zonov.org>
MFC after: 2 weeks
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/procstat/procstat_rlimit.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/usr.bin/procstat/procstat_rlimit.c b/usr.bin/procstat/procstat_rlimit.c index 4f7e986..5f9c5fc 100644 --- a/usr.bin/procstat/procstat_rlimit.c +++ b/usr.bin/procstat/procstat_rlimit.c @@ -90,27 +90,28 @@ const char *humanize_rlimit(int indx, rlim_t limit) void procstat_rlimit(struct kinfo_proc *kipp) { - int error, i, name[4]; + int error, i, name[5]; size_t len; if (!hflag) { printf("%5s %-16s %-16s %16s %16s\n", "PID", "COMM", "RLIMIT", "SOFT ", "HARD "); } + len = sizeof(struct rlimit); name[0] = CTL_KERN; name[1] = KERN_PROC; name[2] = KERN_PROC_RLIMIT; name[3] = kipp->ki_pid; - len = sizeof(rlimit); - error = sysctl(name, 4, rlimit, &len, NULL, 0); - if (error < 0 && errno != ESRCH) { - warn("sysctl: kern.proc.rlimit: %d", kipp->ki_pid); - return; - } - if (error < 0 || len != sizeof(rlimit)) - return; - for (i = 0; i < RLIM_NLIMITS; i++) { + name[4] = i; + error = sysctl(name, 5, &rlimit[i], &len, NULL, 0); + if (error < 0 && errno != ESRCH) { + warn("sysctl: kern.proc.rlimit: %d", kipp->ki_pid); + return; + } + if (error < 0 || len != sizeof(struct rlimit)) + return; + printf("%5d %-16s %-16s ", kipp->ki_pid, kipp->ki_comm, rlimit_param[i].name); printf("%16s ", humanize_rlimit(i, rlimit[i].rlim_cur)); |