procstat(1): make rlimit_param[] size assertion automatic

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D46619
This commit is contained in:
Konstantin Belousov 2024-09-14 16:15:20 +03:00
parent 3a2a5d6060
commit e3b777534b

View file

@ -47,7 +47,7 @@
static struct { static struct {
const char *name; const char *name;
const char *suffix; const char *suffix;
} rlimit_param[15] = { } rlimit_param[] = {
{"cputime", "sec"}, {"cputime", "sec"},
{"filesize", "B "}, {"filesize", "B "},
{"datasize", "B "}, {"datasize", "B "},
@ -65,9 +65,8 @@ static struct {
{"umtxp", " "}, {"umtxp", " "},
}; };
#if RLIM_NLIMITS > 15 _Static_assert(nitems(rlimit_param) == RLIM_NLIMITS,
#error "Resource limits have grown. Add new entries to rlimit_param[]." "Resource limits have grown. Add new entries to rlimit_param[].");
#endif
static const char * static const char *
humanize_rlimit(int indx, rlim_t limit) humanize_rlimit(int indx, rlim_t limit)