git: 50c03711f28a - stable/14 - procstat(1): make rlimit_param[] size assertion automatic
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 22 Sep 2024 09:36:50 UTC
The branch stable/14 has been updated by kib:
URL: https://cgit.FreeBSD.org/src/commit/?id=50c03711f28a69e6e1811414abd8e4d191d3445d
commit 50c03711f28a69e6e1811414abd8e4d191d3445d
Author: Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2024-09-14 13:15:20 +0000
Commit: Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2024-09-21 21:19:49 +0000
procstat(1): make rlimit_param[] size assertion automatic
(cherry picked from commit e3b777534baeb69a1ee88d0b18c76a68eacdb34e)
---
usr.bin/procstat/procstat_rlimit.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/usr.bin/procstat/procstat_rlimit.c b/usr.bin/procstat/procstat_rlimit.c
index f2dcfcd47327..f930d5b0aee0 100644
--- a/usr.bin/procstat/procstat_rlimit.c
+++ b/usr.bin/procstat/procstat_rlimit.c
@@ -48,7 +48,7 @@
static struct {
const char *name;
const char *suffix;
-} rlimit_param[15] = {
+} rlimit_param[] = {
{"cputime", "sec"},
{"filesize", "B "},
{"datasize", "B "},
@@ -66,9 +66,8 @@ static struct {
{"umtxp", " "},
};
-#if RLIM_NLIMITS > 15
-#error "Resource limits have grown. Add new entries to rlimit_param[]."
-#endif
+_Static_assert(nitems(rlimit_param) == RLIM_NLIMITS,
+ "Resource limits have grown. Add new entries to rlimit_param[].");
static const char *
humanize_rlimit(int indx, rlim_t limit)