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
This commit is contained in:
parent
0b17c7bea5
commit
98623e8dda
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=230548
@ -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));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user