summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/daemon/daemon-conf.c20
-rw-r--r--src/daemon/daemon-conf.h9
-rw-r--r--src/daemon/main.c2
3 files changed, 28 insertions, 3 deletions
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index c3abc092..c8c1b6fb 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -97,11 +97,15 @@ static const pa_daemon_conf default_conf = {
#ifdef RLIMIT_NPROC
,.rlimit_nproc = { .value = 0, .is_set = FALSE }
#endif
+#ifdef RLIMIT_NOFILE
,.rlimit_nofile = { .value = 256, .is_set = TRUE }
+#endif
#ifdef RLIMIT_MEMLOCK
,.rlimit_memlock = { .value = 0, .is_set = FALSE }
#endif
+#ifdef RLIMIT_AS
,.rlimit_as = { .value = 0, .is_set = FALSE }
+#endif
#ifdef RLIMIT_LOCKS
,.rlimit_locks = { .value = 0, .is_set = FALSE }
#endif
@@ -442,8 +446,12 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
{ "rlimit-stack", parse_rlimit, NULL },
{ "rlimit-core", parse_rlimit, NULL },
{ "rlimit-rss", parse_rlimit, NULL },
+#ifdef RLIMIT_NOFILE
{ "rlimit-nofile", parse_rlimit, NULL },
+#endif
+#ifdef RLIMIT_AS
{ "rlimit-as", parse_rlimit, NULL },
+#endif
#ifdef RLIMIT_NPROC
{ "rlimit-nproc", parse_rlimit, NULL },
#endif
@@ -508,10 +516,14 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
table[i++].data = &c->rlimit_fsize;
table[i++].data = &c->rlimit_data;
table[i++].data = &c->rlimit_stack;
- table[i++].data = &c->rlimit_as;
table[i++].data = &c->rlimit_core;
+ table[i++].data = &c->rlimit_rss;
+#ifdef RLIMIT_NOFILE
table[i++].data = &c->rlimit_nofile;
+#endif
+#ifdef RLIMIT_AS
table[i++].data = &c->rlimit_as;
+#endif
#ifdef RLIMIT_NPROC
table[i++].data = &c->rlimit_nproc;
#endif
@@ -662,12 +674,16 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
pa_strbuf_printf(s, "rlimit-data = %li\n", c->rlimit_data.is_set ? (long int) c->rlimit_data.value : -1);
pa_strbuf_printf(s, "rlimit-stack = %li\n", c->rlimit_stack.is_set ? (long int) c->rlimit_stack.value : -1);
pa_strbuf_printf(s, "rlimit-core = %li\n", c->rlimit_core.is_set ? (long int) c->rlimit_core.value : -1);
- pa_strbuf_printf(s, "rlimit-as = %li\n", c->rlimit_as.is_set ? (long int) c->rlimit_as.value : -1);
pa_strbuf_printf(s, "rlimit-rss = %li\n", c->rlimit_rss.is_set ? (long int) c->rlimit_rss.value : -1);
+#ifdef RLIMIT_AS
+ pa_strbuf_printf(s, "rlimit-as = %li\n", c->rlimit_as.is_set ? (long int) c->rlimit_as.value : -1);
+#endif
#ifdef RLIMIT_NPROC
pa_strbuf_printf(s, "rlimit-nproc = %li\n", c->rlimit_nproc.is_set ? (long int) c->rlimit_nproc.value : -1);
#endif
+#ifdef RLIMIT_NOFILE
pa_strbuf_printf(s, "rlimit-nofile = %li\n", c->rlimit_nofile.is_set ? (long int) c->rlimit_nofile.value : -1);
+#endif
#ifdef RLIMIT_MEMLOCK
pa_strbuf_printf(s, "rlimit-memlock = %li\n", c->rlimit_memlock.is_set ? (long int) c->rlimit_memlock.value : -1);
#endif
diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h
index fffa35e0..3b75b83e 100644
--- a/src/daemon/daemon-conf.h
+++ b/src/daemon/daemon-conf.h
@@ -84,7 +84,14 @@ typedef struct pa_daemon_conf {
char *config_file;
#ifdef HAVE_SYS_RESOURCE_H
- pa_rlimit rlimit_fsize, rlimit_data, rlimit_stack, rlimit_core, rlimit_rss, rlimit_nofile, rlimit_as;
+ pa_rlimit rlimit_fsize, rlimit_data, rlimit_stack, rlimit_core, rlimit_rss;
+
+#ifdef RLIMIT_NOFILE
+ pa_rlimit rlimit_nofile;
+#endif
+#ifdef RLIMIT_AS
+ pa_rlimit rlimit_as;
+#endif
#ifdef RLIMIT_NPROC
pa_rlimit rlimit_nproc;
#endif
diff --git a/src/daemon/main.c b/src/daemon/main.c
index f4836072..9705f4c3 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -298,7 +298,9 @@ static void set_all_rlimits(const pa_daemon_conf *conf) {
#ifdef RLIMIT_NPROC
set_one_rlimit(&conf->rlimit_nproc, RLIMIT_NPROC, "RLIMIT_NPROC");
#endif
+#ifdef RLIMIT_NOFILE
set_one_rlimit(&conf->rlimit_nofile, RLIMIT_NOFILE, "RLIMIT_NOFILE");
+#endif
#ifdef RLIMIT_MEMLOCK
set_one_rlimit(&conf->rlimit_memlock, RLIMIT_MEMLOCK, "RLIMIT_MEMLOCK");
#endif