Date: Sun, 22 Jan 2012 20:26:46 +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: r230471 - head/usr.bin/procstat Message-ID: <201201222026.q0MKQkqu091546@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: trociny Date: Sun Jan 22 20:26:46 2012 New Revision: 230471 URL: http://svn.freebsd.org/changeset/base/230471 Log: 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 Modified: head/usr.bin/procstat/procstat_rlimit.c Modified: head/usr.bin/procstat/procstat_rlimit.c ============================================================================== --- head/usr.bin/procstat/procstat_rlimit.c Sun Jan 22 20:25:00 2012 (r230470) +++ head/usr.bin/procstat/procstat_rlimit.c Sun Jan 22 20:26:46 2012 (r230471) @@ -90,27 +90,28 @@ const char *humanize_rlimit(int indx, rl 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));
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201201222026.q0MKQkqu091546>