aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/procstat/procstat_rlimit.c
diff options
context:
space:
mode:
authorKonstantin Belousov <kib@FreeBSD.org>2013-10-21 16:46:12 +0000
committerKonstantin Belousov <kib@FreeBSD.org>2013-10-21 16:46:12 +0000
commit85a0ddfd0b269f9527883973092c457f04c1af19 (patch)
tree04786befd82e74b0298aa6139cca4192ba215854 /usr.bin/procstat/procstat_rlimit.c
parent9110db818a1e36cffed5208b6d005d9c1b84236a (diff)
downloadsrc-85a0ddfd0b269f9527883973092c457f04c1af19.tar.gz
src-85a0ddfd0b269f9527883973092c457f04c1af19.zip
Add a resource limit for the total number of kqueues available to the
user. Kqueue now saves the ucred of the allocating thread, to correctly decrement the counter on close. Under some specific and not real-world use scenario for kqueue, it is possible for the kqueues to consume memory proportional to the square of the number of the filedescriptors available to the process. Limit allows administrator to prevent the abuse. This is kernel-mode side of the change, with the user-mode enabling commit following. Reported and tested by: pho Discussed with: jmg Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=256850
Diffstat (limited to 'usr.bin/procstat/procstat_rlimit.c')
-rw-r--r--usr.bin/procstat/procstat_rlimit.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/procstat/procstat_rlimit.c b/usr.bin/procstat/procstat_rlimit.c
index f3ed5fc45177..f7f67af1e0ff 100644
--- a/usr.bin/procstat/procstat_rlimit.c
+++ b/usr.bin/procstat/procstat_rlimit.c
@@ -46,7 +46,7 @@
static struct {
const char *name;
const char *suffix;
-} rlimit_param[13] = {
+} rlimit_param[14] = {
{"cputime", "sec"},
{"filesize", "B "},
{"datasize", "B "},
@@ -60,9 +60,10 @@ static struct {
{"vmemoryuse", "B "},
{"pseudo-terminals", " "},
{"swapuse", "B "},
+ {"kqueues", " "},
};
-#if RLIM_NLIMITS > 13
+#if RLIM_NLIMITS > 14
#error "Resource limits have grown. Add new entries to rlimit_param[]."
#endif