Add a missing pa_xfree.
[pulseaudio.git] / src / daemon / daemon-conf.c
blobc98c0218ec9e7eec33e706bc44905726a17290ec
1 /* $Id$ */
3 /***
4 This file is part of PulseAudio.
6 Copyright 2004-2006 Lennart Poettering
7 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
9 PulseAudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU Lesser General Public License as published
11 by the Free Software Foundation; either version 2 of the License,
12 or (at your option) any later version.
14 PulseAudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU Lesser General Public License
20 along with PulseAudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
22 USA.
23 ***/
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
29 #include <errno.h>
30 #include <stdio.h>
31 #include <string.h>
32 #include <unistd.h>
33 #include <sched.h>
35 #include <pulse/xmalloc.h>
37 #include <pulsecore/core-error.h>
38 #include <pulsecore/core-util.h>
39 #include <pulsecore/strbuf.h>
40 #include <pulsecore/conf-parser.h>
41 #include <pulsecore/resampler.h>
42 #include <pulsecore/macro.h>
44 #include "daemon-conf.h"
46 #define DEFAULT_SCRIPT_FILE PA_DEFAULT_CONFIG_DIR PA_PATH_SEP "default.pa"
47 #define DEFAULT_SCRIPT_FILE_USER PA_PATH_SEP "default.pa"
48 #define DEFAULT_CONFIG_FILE PA_DEFAULT_CONFIG_DIR PA_PATH_SEP "daemon.conf"
49 #define DEFAULT_CONFIG_FILE_USER PA_PATH_SEP "daemon.conf"
51 #define ENV_SCRIPT_FILE "PULSE_SCRIPT"
52 #define ENV_CONFIG_FILE "PULSE_CONFIG"
53 #define ENV_DL_SEARCH_PATH "PULSE_DLPATH"
55 static const pa_daemon_conf default_conf = {
56 .cmd = PA_CMD_DAEMON,
57 .daemonize = FALSE,
58 .fail = TRUE,
59 .high_priority = TRUE,
60 .nice_level = -11,
61 .realtime_scheduling = FALSE,
62 .realtime_priority = 5, /* Half of JACK's default rtprio */
63 .disallow_module_loading = FALSE,
64 .exit_idle_time = -1,
65 .module_idle_time = 20,
66 .scache_idle_time = 20,
67 .auto_log_target = 1,
68 .script_commands = NULL,
69 .dl_search_path = NULL,
70 .default_script_file = NULL,
71 .log_target = PA_LOG_SYSLOG,
72 .log_level = PA_LOG_NOTICE,
73 .resample_method = PA_RESAMPLER_AUTO,
74 .disable_remixing = FALSE,
75 .config_file = NULL,
76 .use_pid_file = TRUE,
77 .system_instance = FALSE,
78 .no_cpu_limit = FALSE,
79 .disable_shm = FALSE,
80 .default_n_fragments = 4,
81 .default_fragment_size_msec = 25,
82 .default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 }
83 #ifdef HAVE_SYS_RESOURCE_H
84 , .rlimit_as = { .value = 0, .is_set = FALSE },
85 .rlimit_core = { .value = 0, .is_set = FALSE },
86 .rlimit_data = { .value = 0, .is_set = FALSE },
87 .rlimit_fsize = { .value = 0, .is_set = FALSE },
88 .rlimit_nofile = { .value = 256, .is_set = TRUE },
89 .rlimit_stack = { .value = 0, .is_set = FALSE }
90 #ifdef RLIMIT_NPROC
91 , .rlimit_nproc = { .value = 0, .is_set = FALSE }
92 #endif
93 #ifdef RLIMIT_MEMLOCK
94 , .rlimit_memlock = { .value = 0, .is_set = FALSE }
95 #endif
96 #ifdef RLIMIT_NICE
97 , .rlimit_nice = { .value = 31, .is_set = TRUE } /* nice level of -11 */
98 #endif
99 #ifdef RLIMIT_RTPRIO
100 , .rlimit_rtprio = { .value = 9, .is_set = TRUE } /* One below JACK's default for the server */
101 #endif
102 #endif
105 pa_daemon_conf* pa_daemon_conf_new(void) {
106 FILE *f;
107 pa_daemon_conf *c = pa_xnewdup(pa_daemon_conf, &default_conf, 1);
109 if ((f = pa_open_config_file(DEFAULT_SCRIPT_FILE, DEFAULT_SCRIPT_FILE_USER, ENV_SCRIPT_FILE, &c->default_script_file, "r")))
110 fclose(f);
112 c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
113 return c;
116 void pa_daemon_conf_free(pa_daemon_conf *c) {
117 pa_assert(c);
118 pa_xfree(c->script_commands);
119 pa_xfree(c->dl_search_path);
120 pa_xfree(c->default_script_file);
121 pa_xfree(c->config_file);
122 pa_xfree(c);
125 int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const char *string) {
126 pa_assert(c);
127 pa_assert(string);
129 if (!strcmp(string, "auto"))
130 c->auto_log_target = 1;
131 else if (!strcmp(string, "syslog")) {
132 c->auto_log_target = 0;
133 c->log_target = PA_LOG_SYSLOG;
134 } else if (!strcmp(string, "stderr")) {
135 c->auto_log_target = 0;
136 c->log_target = PA_LOG_STDERR;
137 } else
138 return -1;
140 return 0;
143 int pa_daemon_conf_set_log_level(pa_daemon_conf *c, const char *string) {
144 uint32_t u;
145 pa_assert(c);
146 pa_assert(string);
148 if (pa_atou(string, &u) >= 0) {
149 if (u >= PA_LOG_LEVEL_MAX)
150 return -1;
152 c->log_level = (pa_log_level_t) u;
153 } else if (pa_startswith(string, "debug"))
154 c->log_level = PA_LOG_DEBUG;
155 else if (pa_startswith(string, "info"))
156 c->log_level = PA_LOG_INFO;
157 else if (pa_startswith(string, "notice"))
158 c->log_level = PA_LOG_NOTICE;
159 else if (pa_startswith(string, "warn"))
160 c->log_level = PA_LOG_WARN;
161 else if (pa_startswith(string, "err"))
162 c->log_level = PA_LOG_ERROR;
163 else
164 return -1;
166 return 0;
169 int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string) {
170 int m;
171 pa_assert(c);
172 pa_assert(string);
174 if ((m = pa_parse_resample_method(string)) < 0)
175 return -1;
177 c->resample_method = m;
178 return 0;
181 static int parse_log_target(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
182 pa_daemon_conf *c = data;
184 pa_assert(filename);
185 pa_assert(lvalue);
186 pa_assert(rvalue);
187 pa_assert(data);
189 if (pa_daemon_conf_set_log_target(c, rvalue) < 0) {
190 pa_log("[%s:%u] Invalid log target '%s'.", filename, line, rvalue);
191 return -1;
194 return 0;
197 static int parse_log_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
198 pa_daemon_conf *c = data;
200 pa_assert(filename);
201 pa_assert(lvalue);
202 pa_assert(rvalue);
203 pa_assert(data);
205 if (pa_daemon_conf_set_log_level(c, rvalue) < 0) {
206 pa_log("[%s:%u] Invalid log level '%s'.", filename, line, rvalue);
207 return -1;
210 return 0;
213 static int parse_resample_method(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
214 pa_daemon_conf *c = data;
216 pa_assert(filename);
217 pa_assert(lvalue);
218 pa_assert(rvalue);
219 pa_assert(data);
221 if (pa_daemon_conf_set_resample_method(c, rvalue) < 0) {
222 pa_log("[%s:%u] Invalid resample method '%s'.", filename, line, rvalue);
223 return -1;
226 return 0;
229 static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
230 #ifdef HAVE_SYS_RESOURCE_H
231 struct pa_rlimit *r = data;
233 pa_assert(filename);
234 pa_assert(lvalue);
235 pa_assert(rvalue);
236 pa_assert(r);
238 if (rvalue[strspn(rvalue, "\t ")] == 0) {
239 /* Empty string */
240 r->is_set = 0;
241 r->value = 0;
242 } else {
243 int32_t k;
244 if (pa_atoi(rvalue, &k) < 0) {
245 pa_log("[%s:%u] Invalid rlimit '%s'.", filename, line, rvalue);
246 return -1;
248 r->is_set = k >= 0;
249 r->value = k >= 0 ? (rlim_t) k : 0;
251 #else
252 pa_log_warn("[%s:%u] rlimit not supported on this platform.", filename, line);
253 #endif
255 return 0;
258 static int parse_sample_format(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
259 pa_daemon_conf *c = data;
260 pa_sample_format_t f;
262 pa_assert(filename);
263 pa_assert(lvalue);
264 pa_assert(rvalue);
265 pa_assert(data);
267 if ((f = pa_parse_sample_format(rvalue)) < 0) {
268 pa_log("[%s:%u] Invalid sample format '%s'.", filename, line, rvalue);
269 return -1;
272 c->default_sample_spec.format = f;
273 return 0;
276 static int parse_sample_rate(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
277 pa_daemon_conf *c = data;
278 int32_t r;
280 pa_assert(filename);
281 pa_assert(lvalue);
282 pa_assert(rvalue);
283 pa_assert(data);
285 if (pa_atoi(rvalue, &r) < 0 || r > PA_RATE_MAX || r <= 0) {
286 pa_log("[%s:%u] Invalid sample rate '%s'.", filename, line, rvalue);
287 return -1;
290 c->default_sample_spec.rate = r;
291 return 0;
294 static int parse_sample_channels(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
295 pa_daemon_conf *c = data;
296 int32_t n;
298 pa_assert(filename);
299 pa_assert(lvalue);
300 pa_assert(rvalue);
301 pa_assert(data);
303 if (pa_atoi(rvalue, &n) < 0 || n > PA_CHANNELS_MAX || n <= 0) {
304 pa_log("[%s:%u] Invalid sample channels '%s'.", filename, line, rvalue);
305 return -1;
308 c->default_sample_spec.channels = (uint8_t) n;
309 return 0;
312 static int parse_fragments(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
313 pa_daemon_conf *c = data;
314 int32_t n;
316 pa_assert(filename);
317 pa_assert(lvalue);
318 pa_assert(rvalue);
319 pa_assert(data);
321 if (pa_atoi(rvalue, &n) < 0 || n < 2) {
322 pa_log("[%s:%u] Invalid number of fragments '%s'.", filename, line, rvalue);
323 return -1;
326 c->default_n_fragments = (unsigned) n;
327 return 0;
330 static int parse_fragment_size_msec(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
331 pa_daemon_conf *c = data;
332 int32_t n;
334 pa_assert(filename);
335 pa_assert(lvalue);
336 pa_assert(rvalue);
337 pa_assert(data);
339 if (pa_atoi(rvalue, &n) < 0 || n < 1) {
340 pa_log("[%s:%u] Invalid fragment size '%s'.", filename, line, rvalue);
341 return -1;
344 c->default_fragment_size_msec = (unsigned) n;
345 return 0;
348 static int parse_nice_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
349 pa_daemon_conf *c = data;
350 int32_t level;
352 pa_assert(filename);
353 pa_assert(lvalue);
354 pa_assert(rvalue);
355 pa_assert(data);
357 if (pa_atoi(rvalue, &level) < 0 || level < -20 || level > 19) {
358 pa_log("[%s:%u] Invalid nice level '%s'.", filename, line, rvalue);
359 return -1;
362 c->nice_level = (int) level;
363 return 0;
366 static int parse_rtprio(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) {
367 pa_daemon_conf *c = data;
368 int32_t rtprio;
370 pa_assert(filename);
371 pa_assert(lvalue);
372 pa_assert(rvalue);
373 pa_assert(data);
375 if (pa_atoi(rvalue, &rtprio) < 0 || rtprio < sched_get_priority_min(SCHED_FIFO) || rtprio > sched_get_priority_max(SCHED_FIFO)) {
376 pa_log("[%s:%u] Invalid realtime priority '%s'.", filename, line, rvalue);
377 return -1;
380 c->realtime_priority = (int) rtprio;
381 return 0;
384 int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
385 int r = -1;
386 FILE *f = NULL;
388 pa_config_item table[] = {
389 { "daemonize", pa_config_parse_bool, NULL },
390 { "fail", pa_config_parse_bool, NULL },
391 { "high-priority", pa_config_parse_bool, NULL },
392 { "realtime-scheduling", pa_config_parse_bool, NULL },
393 { "disallow-module-loading", pa_config_parse_bool, NULL },
394 { "use-pid-file", pa_config_parse_bool, NULL },
395 { "system-instance", pa_config_parse_bool, NULL },
396 { "no-cpu-limit", pa_config_parse_bool, NULL },
397 { "disable-shm", pa_config_parse_bool, NULL },
398 { "exit-idle-time", pa_config_parse_int, NULL },
399 { "module-idle-time", pa_config_parse_int, NULL },
400 { "scache-idle-time", pa_config_parse_int, NULL },
401 { "realtime-priority", parse_rtprio, NULL },
402 { "dl-search-path", pa_config_parse_string, NULL },
403 { "default-script-file", pa_config_parse_string, NULL },
404 { "log-target", parse_log_target, NULL },
405 { "log-level", parse_log_level, NULL },
406 { "verbose", parse_log_level, NULL },
407 { "resample-method", parse_resample_method, NULL },
408 { "default-sample-format", parse_sample_format, NULL },
409 { "default-sample-rate", parse_sample_rate, NULL },
410 { "default-sample-channels", parse_sample_channels, NULL },
411 { "default-fragments", parse_fragments, NULL },
412 { "default-fragment-size-msec", parse_fragment_size_msec, NULL },
413 { "nice-level", parse_nice_level, NULL },
414 { "disable-remixing", pa_config_parse_bool, NULL },
415 #ifdef HAVE_SYS_RESOURCE_H
416 { "rlimit-as", parse_rlimit, NULL },
417 { "rlimit-core", parse_rlimit, NULL },
418 { "rlimit-data", parse_rlimit, NULL },
419 { "rlimit-fsize", parse_rlimit, NULL },
420 { "rlimit-nofile", parse_rlimit, NULL },
421 { "rlimit-stack", parse_rlimit, NULL },
422 #ifdef RLIMIT_NPROC
423 { "rlimit-nproc", parse_rlimit, NULL },
424 #endif
425 #ifdef RLIMIT_MEMLOCK
426 { "rlimit-memlock", parse_rlimit, NULL },
427 #endif
428 #ifdef RLIMIT_NICE
429 { "rlimit-nice", parse_rlimit, NULL },
430 #endif
431 #ifdef RLIMIT_RTPRIO
432 { "rlimit-rtprio", parse_rlimit, NULL },
433 #endif
434 #endif
435 { NULL, NULL, NULL },
438 table[0].data = &c->daemonize;
439 table[1].data = &c->fail;
440 table[2].data = &c->high_priority;
441 table[3].data = &c->realtime_scheduling;
442 table[4].data = &c->disallow_module_loading;
443 table[5].data = &c->use_pid_file;
444 table[6].data = &c->system_instance;
445 table[7].data = &c->no_cpu_limit;
446 table[8].data = &c->disable_shm;
447 table[9].data = &c->exit_idle_time;
448 table[10].data = &c->module_idle_time;
449 table[11].data = &c->scache_idle_time;
450 table[12].data = c;
451 table[13].data = &c->dl_search_path;
452 table[14].data = &c->default_script_file;
453 table[15].data = c;
454 table[16].data = c;
455 table[17].data = c;
456 table[18].data = c;
457 table[19].data = c;
458 table[20].data = c;
459 table[21].data = c;
460 table[22].data = c;
461 table[23].data = c;
462 table[24].data = c;
463 table[25].data = &c->disable_remixing;
464 #ifdef HAVE_SYS_RESOURCE_H
465 table[26].data = &c->rlimit_as;
466 table[27].data = &c->rlimit_core;
467 table[28].data = &c->rlimit_data;
468 table[29].data = &c->rlimit_fsize;
469 table[30].data = &c->rlimit_nofile;
470 table[31].data = &c->rlimit_stack;
471 #ifdef RLIMIT_NPROC
472 table[32].data = &c->rlimit_nproc;
473 #endif
474 #ifdef RLIMIT_MEMLOCK
475 #ifndef RLIMIT_NPROC
476 #error "Houston, we have a numbering problem!"
477 #endif
478 table[33].data = &c->rlimit_memlock;
479 #endif
480 #ifdef RLIMIT_NICE
481 #ifndef RLIMIT_MEMLOCK
482 #error "Houston, we have a numbering problem!"
483 #endif
484 table[34].data = &c->rlimit_nice;
485 #endif
486 #ifdef RLIMIT_RTPRIO
487 #ifndef RLIMIT_NICE
488 #error "Houston, we have a numbering problem!"
489 #endif
490 table[35].data = &c->rlimit_rtprio;
491 #endif
492 #endif
494 pa_xfree(c->config_file);
495 c->config_file = NULL;
497 f = filename ?
498 fopen(c->config_file = pa_xstrdup(filename), "r") :
499 pa_open_config_file(DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_FILE_USER, ENV_CONFIG_FILE, &c->config_file, "r");
501 if (!f && errno != ENOENT) {
502 pa_log_warn("Failed to open configuration file '%s': %s", c->config_file, pa_cstrerror(errno));
503 goto finish;
506 r = f ? pa_config_parse(c->config_file, f, table, NULL) : 0;
508 finish:
509 if (f)
510 fclose(f);
512 return r;
515 int pa_daemon_conf_env(pa_daemon_conf *c) {
516 char *e;
518 if ((e = getenv(ENV_DL_SEARCH_PATH))) {
519 pa_xfree(c->dl_search_path);
520 c->dl_search_path = pa_xstrdup(e);
522 if ((e = getenv(ENV_SCRIPT_FILE))) {
523 pa_xfree(c->default_script_file);
524 c->default_script_file = pa_xstrdup(e);
527 return 0;
530 static const char* const log_level_to_string[] = {
531 [PA_LOG_DEBUG] = "debug",
532 [PA_LOG_INFO] = "info",
533 [PA_LOG_NOTICE] = "notice",
534 [PA_LOG_WARN] = "warning",
535 [PA_LOG_ERROR] = "error"
538 char *pa_daemon_conf_dump(pa_daemon_conf *c) {
539 pa_strbuf *s;
541 pa_assert(c);
543 s = pa_strbuf_new();
545 if (c->config_file)
546 pa_strbuf_printf(s, "### Read from configuration file: %s ###\n", c->config_file);
548 pa_assert(c->log_level <= PA_LOG_LEVEL_MAX);
550 pa_strbuf_printf(s, "daemonize = %s\n", pa_yes_no(c->daemonize));
551 pa_strbuf_printf(s, "fail = %s\n", pa_yes_no(c->fail));
552 pa_strbuf_printf(s, "high-priority = %s\n", pa_yes_no(c->high_priority));
553 pa_strbuf_printf(s, "nice-level = %i\n", c->nice_level);
554 pa_strbuf_printf(s, "realtime-scheduling = %s\n", pa_yes_no(c->realtime_scheduling));
555 pa_strbuf_printf(s, "realtime-priority = %i\n", c->realtime_priority);
556 pa_strbuf_printf(s, "disallow-module-loading = %s\n", pa_yes_no(c->disallow_module_loading));
557 pa_strbuf_printf(s, "use-pid-file = %s\n", pa_yes_no(c->use_pid_file));
558 pa_strbuf_printf(s, "system-instance = %s\n", pa_yes_no(c->system_instance));
559 pa_strbuf_printf(s, "no-cpu-limit = %s\n", pa_yes_no(c->no_cpu_limit));
560 pa_strbuf_printf(s, "disable-shm = %s\n", pa_yes_no(c->disable_shm));
561 pa_strbuf_printf(s, "exit-idle-time = %i\n", c->exit_idle_time);
562 pa_strbuf_printf(s, "module-idle-time = %i\n", c->module_idle_time);
563 pa_strbuf_printf(s, "scache-idle-time = %i\n", c->scache_idle_time);
564 pa_strbuf_printf(s, "dl-search-path = %s\n", c->dl_search_path ? c->dl_search_path : "");
565 pa_strbuf_printf(s, "default-script-file = %s\n", c->default_script_file);
566 pa_strbuf_printf(s, "log-target = %s\n", c->auto_log_target ? "auto" : (c->log_target == PA_LOG_SYSLOG ? "syslog" : "stderr"));
567 pa_strbuf_printf(s, "log-level = %s\n", log_level_to_string[c->log_level]);
568 pa_strbuf_printf(s, "resample-method = %s\n", pa_resample_method_to_string(c->resample_method));
569 pa_strbuf_printf(s, "disable-remixing = %s\n", pa_yes_no(c->disable_remixing));
570 pa_strbuf_printf(s, "default-sample-format = %s\n", pa_sample_format_to_string(c->default_sample_spec.format));
571 pa_strbuf_printf(s, "default-sample-rate = %u\n", c->default_sample_spec.rate);
572 pa_strbuf_printf(s, "default-sample-channels = %u\n", c->default_sample_spec.channels);
573 pa_strbuf_printf(s, "default-fragments = %u\n", c->default_n_fragments);
574 pa_strbuf_printf(s, "default-fragment-size-msec = %u\n", c->default_fragment_size_msec);
575 #ifdef HAVE_SYS_RESOURCE_H
576 pa_strbuf_printf(s, "rlimit-as = %li\n", c->rlimit_as.is_set ? (long int) c->rlimit_as.value : -1);
577 pa_strbuf_printf(s, "rlimit-core = %li\n", c->rlimit_core.is_set ? (long int) c->rlimit_core.value : -1);
578 pa_strbuf_printf(s, "rlimit-data = %li\n", c->rlimit_data.is_set ? (long int) c->rlimit_data.value : -1);
579 pa_strbuf_printf(s, "rlimit-fsize = %li\n", c->rlimit_fsize.is_set ? (long int) c->rlimit_fsize.value : -1);
580 pa_strbuf_printf(s, "rlimit-nofile = %li\n", c->rlimit_nofile.is_set ? (long int) c->rlimit_nofile.value : -1);
581 pa_strbuf_printf(s, "rlimit-stack = %li\n", c->rlimit_stack.is_set ? (long int) c->rlimit_stack.value : -1);
582 #ifdef RLIMIT_NPROC
583 pa_strbuf_printf(s, "rlimit-nproc = %li\n", c->rlimit_nproc.is_set ? (long int) c->rlimit_nproc.value : -1);
584 #endif
585 #ifdef RLIMIT_MEMLOCK
586 pa_strbuf_printf(s, "rlimit-memlock = %li\n", c->rlimit_memlock.is_set ? (long int) c->rlimit_memlock.value : -1);
587 #endif
588 #ifdef RLIMIT_NICE
589 pa_strbuf_printf(s, "rlimit-nice = %li\n", c->rlimit_memlock.is_set ? (long int) c->rlimit_nice.value : -1);
590 #endif
591 #ifdef RLIMIT_RTPRIO
592 pa_strbuf_printf(s, "rlimit-rtprio = %li\n", c->rlimit_memlock.is_set ? (long int) c->rlimit_rtprio.value : -1);
593 #endif
594 #endif
596 return pa_strbuf_tostring_free(s);