2004-09-13 23:28:30 +00:00
|
|
|
/***
|
2006-06-19 21:53:48 +00:00
|
|
|
This file is part of PulseAudio.
|
2004-09-13 23:28:30 +00:00
|
|
|
|
2007-02-13 15:35:19 +00:00
|
|
|
Copyright 2004-2006 Lennart Poettering
|
|
|
|
|
Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
|
|
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is free software; you can redistribute it and/or modify
|
2004-11-14 14:58:54 +00:00
|
|
|
it under the terms of the GNU Lesser General Public License as published
|
2009-03-03 20:23:02 +00:00
|
|
|
by the Free Software Foundation; either version 2.1 of the License,
|
2004-09-13 23:28:30 +00:00
|
|
|
or (at your option) any later version.
|
|
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
PulseAudio is distributed in the hope that it will be useful, but
|
2004-09-13 23:28:30 +00:00
|
|
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
2004-11-14 14:58:54 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
2006-06-19 21:53:48 +00:00
|
|
|
along with PulseAudio; if not, write to the Free Software
|
2004-09-13 23:28:30 +00:00
|
|
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
|
|
|
USA.
|
|
|
|
|
***/
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include <errno.h>
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <string.h>
|
2004-09-17 19:45:44 +00:00
|
|
|
#include <unistd.h>
|
2007-11-01 00:34:43 +00:00
|
|
|
#include <sched.h>
|
2004-09-13 23:28:30 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulse/xmalloc.h>
|
2008-05-15 23:34:41 +00:00
|
|
|
#include <pulse/timeval.h>
|
2008-08-06 18:54:13 +02:00
|
|
|
#include <pulse/i18n.h>
|
2006-05-17 16:34:18 +00:00
|
|
|
|
2006-06-19 21:53:48 +00:00
|
|
|
#include <pulsecore/core-error.h>
|
|
|
|
|
#include <pulsecore/core-util.h>
|
|
|
|
|
#include <pulsecore/strbuf.h>
|
|
|
|
|
#include <pulsecore/conf-parser.h>
|
|
|
|
|
#include <pulsecore/resampler.h>
|
2007-10-28 19:13:50 +00:00
|
|
|
#include <pulsecore/macro.h>
|
2004-09-17 19:45:44 +00:00
|
|
|
|
2006-02-17 12:10:58 +00:00
|
|
|
#include "daemon-conf.h"
|
|
|
|
|
|
2007-10-28 19:13:50 +00:00
|
|
|
#define DEFAULT_SCRIPT_FILE PA_DEFAULT_CONFIG_DIR PA_PATH_SEP "default.pa"
|
|
|
|
|
#define DEFAULT_SCRIPT_FILE_USER PA_PATH_SEP "default.pa"
|
2008-05-15 23:34:41 +00:00
|
|
|
#define DEFAULT_SYSTEM_SCRIPT_FILE PA_DEFAULT_CONFIG_DIR PA_PATH_SEP "system.pa"
|
|
|
|
|
|
2007-10-28 19:13:50 +00:00
|
|
|
#define DEFAULT_CONFIG_FILE PA_DEFAULT_CONFIG_DIR PA_PATH_SEP "daemon.conf"
|
|
|
|
|
#define DEFAULT_CONFIG_FILE_USER PA_PATH_SEP "daemon.conf"
|
2004-09-17 19:45:44 +00:00
|
|
|
|
2006-06-19 23:56:54 +00:00
|
|
|
#define ENV_SCRIPT_FILE "PULSE_SCRIPT"
|
|
|
|
|
#define ENV_CONFIG_FILE "PULSE_CONFIG"
|
|
|
|
|
#define ENV_DL_SEARCH_PATH "PULSE_DLPATH"
|
2004-09-13 23:28:30 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
static const pa_daemon_conf default_conf = {
|
2004-09-14 17:52:11 +00:00
|
|
|
.cmd = PA_CMD_DAEMON,
|
2007-11-01 00:34:43 +00:00
|
|
|
.daemonize = FALSE,
|
|
|
|
|
.fail = TRUE,
|
|
|
|
|
.high_priority = TRUE,
|
|
|
|
|
.nice_level = -11,
|
|
|
|
|
.realtime_scheduling = FALSE,
|
|
|
|
|
.realtime_priority = 5, /* Half of JACK's default rtprio */
|
|
|
|
|
.disallow_module_loading = FALSE,
|
2008-08-06 19:39:12 +02:00
|
|
|
.disallow_exit = FALSE,
|
2009-01-27 04:39:07 +01:00
|
|
|
.flat_volumes = TRUE,
|
2008-07-22 19:45:18 +02:00
|
|
|
.exit_idle_time = 20,
|
2004-09-14 23:08:39 +00:00
|
|
|
.scache_idle_time = 20,
|
2004-09-13 23:28:30 +00:00
|
|
|
.auto_log_target = 1,
|
|
|
|
|
.script_commands = NULL,
|
|
|
|
|
.dl_search_path = NULL,
|
2008-05-15 23:34:41 +00:00
|
|
|
.load_default_script_file = TRUE,
|
2004-09-13 23:28:30 +00:00
|
|
|
.default_script_file = NULL,
|
|
|
|
|
.log_target = PA_LOG_SYSLOG,
|
2004-12-11 00:10:41 +00:00
|
|
|
.log_level = PA_LOG_NOTICE,
|
2008-10-21 19:15:41 +02:00
|
|
|
.log_backtrace = 0,
|
|
|
|
|
.log_meta = FALSE,
|
|
|
|
|
.log_time = FALSE,
|
2007-10-28 19:13:50 +00:00
|
|
|
.resample_method = PA_RESAMPLER_AUTO,
|
2007-11-21 01:30:40 +00:00
|
|
|
.disable_remixing = FALSE,
|
2008-09-05 16:04:42 +03:00
|
|
|
.disable_lfe_remixing = TRUE,
|
2004-11-04 21:27:12 +00:00
|
|
|
.config_file = NULL,
|
2007-11-01 00:34:43 +00:00
|
|
|
.use_pid_file = TRUE,
|
|
|
|
|
.system_instance = FALSE,
|
|
|
|
|
.no_cpu_limit = FALSE,
|
|
|
|
|
.disable_shm = FALSE,
|
2007-10-28 19:13:50 +00:00
|
|
|
.default_n_fragments = 4,
|
|
|
|
|
.default_fragment_size_msec = 25,
|
2008-10-01 01:14:36 +02:00
|
|
|
.default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 },
|
2009-02-21 16:32:42 +01:00
|
|
|
.default_channel_map = { .channels = 2, .map = { PA_CHANNEL_POSITION_LEFT, PA_CHANNEL_POSITION_RIGHT } },
|
2008-10-01 01:14:36 +02:00
|
|
|
.shm_size = 0
|
2006-07-20 01:25:37 +00:00
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
2008-05-15 23:34:41 +00:00
|
|
|
,.rlimit_fsize = { .value = 0, .is_set = FALSE },
|
2007-11-01 00:34:43 +00:00
|
|
|
.rlimit_data = { .value = 0, .is_set = FALSE },
|
2008-05-15 23:34:41 +00:00
|
|
|
.rlimit_stack = { .value = 0, .is_set = FALSE },
|
2009-02-26 16:48:58 +11:00
|
|
|
.rlimit_core = { .value = 0, .is_set = FALSE }
|
|
|
|
|
#ifdef RLIMIT_RSS
|
|
|
|
|
,.rlimit_rss = { .value = 0, .is_set = FALSE }
|
|
|
|
|
#endif
|
2006-07-20 01:25:37 +00:00
|
|
|
#ifdef RLIMIT_NPROC
|
2008-05-15 23:34:41 +00:00
|
|
|
,.rlimit_nproc = { .value = 0, .is_set = FALSE }
|
2006-07-20 01:25:37 +00:00
|
|
|
#endif
|
2009-01-27 00:48:53 +01:00
|
|
|
#ifdef RLIMIT_NOFILE
|
2008-05-15 23:34:41 +00:00
|
|
|
,.rlimit_nofile = { .value = 256, .is_set = TRUE }
|
2009-01-27 00:48:53 +01:00
|
|
|
#endif
|
2006-07-20 01:25:37 +00:00
|
|
|
#ifdef RLIMIT_MEMLOCK
|
2008-05-15 23:34:41 +00:00
|
|
|
,.rlimit_memlock = { .value = 0, .is_set = FALSE }
|
|
|
|
|
#endif
|
2009-01-27 00:48:53 +01:00
|
|
|
#ifdef RLIMIT_AS
|
2008-05-15 23:34:41 +00:00
|
|
|
,.rlimit_as = { .value = 0, .is_set = FALSE }
|
2009-01-27 00:48:53 +01:00
|
|
|
#endif
|
2008-05-15 23:34:41 +00:00
|
|
|
#ifdef RLIMIT_LOCKS
|
|
|
|
|
,.rlimit_locks = { .value = 0, .is_set = FALSE }
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_SIGPENDING
|
|
|
|
|
,.rlimit_sigpending = { .value = 0, .is_set = FALSE }
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_MSGQUEUE
|
|
|
|
|
,.rlimit_msgqueue = { .value = 0, .is_set = FALSE }
|
2007-11-01 00:34:43 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_NICE
|
2008-05-15 23:34:41 +00:00
|
|
|
,.rlimit_nice = { .value = 31, .is_set = TRUE } /* nice level of -11 */
|
2007-11-01 00:34:43 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_RTPRIO
|
2008-05-15 23:34:41 +00:00
|
|
|
,.rlimit_rtprio = { .value = 9, .is_set = TRUE } /* One below JACK's default for the server */
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_RTTIME
|
|
|
|
|
,.rlimit_rttime = { .value = PA_USEC_PER_SEC, .is_set = TRUE }
|
2006-07-20 01:25:37 +00:00
|
|
|
#endif
|
|
|
|
|
#endif
|
2004-09-13 23:28:30 +00:00
|
|
|
};
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_daemon_conf* pa_daemon_conf_new(void) {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_daemon_conf *c = pa_xnewdup(pa_daemon_conf, &default_conf, 1);
|
2004-11-04 21:27:12 +00:00
|
|
|
|
2006-07-19 17:44:19 +00:00
|
|
|
c->dl_search_path = pa_xstrdup(PA_DLSEARCHPATH);
|
2004-09-13 23:28:30 +00:00
|
|
|
return c;
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
void pa_daemon_conf_free(pa_daemon_conf *c) {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_assert(c);
|
2004-09-13 23:28:30 +00:00
|
|
|
pa_xfree(c->script_commands);
|
|
|
|
|
pa_xfree(c->dl_search_path);
|
|
|
|
|
pa_xfree(c->default_script_file);
|
2004-11-04 21:27:12 +00:00
|
|
|
pa_xfree(c->config_file);
|
2004-09-13 23:28:30 +00:00
|
|
|
pa_xfree(c);
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
int pa_daemon_conf_set_log_target(pa_daemon_conf *c, const char *string) {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_assert(c);
|
|
|
|
|
pa_assert(string);
|
2004-09-17 20:43:40 +00:00
|
|
|
|
|
|
|
|
if (!strcmp(string, "auto"))
|
2004-09-17 19:45:44 +00:00
|
|
|
c->auto_log_target = 1;
|
2004-09-17 20:43:40 +00:00
|
|
|
else if (!strcmp(string, "syslog")) {
|
2004-09-17 19:45:44 +00:00
|
|
|
c->auto_log_target = 0;
|
|
|
|
|
c->log_target = PA_LOG_SYSLOG;
|
2004-09-17 20:43:40 +00:00
|
|
|
} else if (!strcmp(string, "stderr")) {
|
2004-09-17 19:45:44 +00:00
|
|
|
c->auto_log_target = 0;
|
|
|
|
|
c->log_target = PA_LOG_STDERR;
|
2004-09-17 20:43:40 +00:00
|
|
|
} else
|
2004-09-17 19:45:44 +00:00
|
|
|
return -1;
|
2004-09-13 23:28:30 +00:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
int pa_daemon_conf_set_log_level(pa_daemon_conf *c, const char *string) {
|
2004-12-11 00:10:41 +00:00
|
|
|
uint32_t u;
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_assert(c);
|
|
|
|
|
pa_assert(string);
|
2004-12-11 00:10:41 +00:00
|
|
|
|
|
|
|
|
if (pa_atou(string, &u) >= 0) {
|
|
|
|
|
if (u >= PA_LOG_LEVEL_MAX)
|
|
|
|
|
return -1;
|
|
|
|
|
|
2006-01-27 16:25:31 +00:00
|
|
|
c->log_level = (pa_log_level_t) u;
|
2004-12-11 00:10:41 +00:00
|
|
|
} else if (pa_startswith(string, "debug"))
|
|
|
|
|
c->log_level = PA_LOG_DEBUG;
|
|
|
|
|
else if (pa_startswith(string, "info"))
|
|
|
|
|
c->log_level = PA_LOG_INFO;
|
|
|
|
|
else if (pa_startswith(string, "notice"))
|
|
|
|
|
c->log_level = PA_LOG_NOTICE;
|
|
|
|
|
else if (pa_startswith(string, "warn"))
|
|
|
|
|
c->log_level = PA_LOG_WARN;
|
|
|
|
|
else if (pa_startswith(string, "err"))
|
|
|
|
|
c->log_level = PA_LOG_ERROR;
|
|
|
|
|
else
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string) {
|
2004-09-17 21:10:05 +00:00
|
|
|
int m;
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_assert(c);
|
|
|
|
|
pa_assert(string);
|
2004-09-17 19:45:44 +00:00
|
|
|
|
2004-09-17 21:10:05 +00:00
|
|
|
if ((m = pa_parse_resample_method(string)) < 0)
|
2004-09-17 20:43:40 +00:00
|
|
|
return -1;
|
|
|
|
|
|
2004-09-17 21:10:05 +00:00
|
|
|
c->resample_method = m;
|
2004-09-17 20:43:40 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_log_target(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_daemon_conf *c = data;
|
2007-10-28 19:13:50 +00:00
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
2004-09-17 20:43:40 +00:00
|
|
|
|
|
|
|
|
if (pa_daemon_conf_set_log_target(c, rvalue) < 0) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid log target '%s'."), filename, line, rvalue);
|
2004-09-17 20:43:40 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_log_level(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_daemon_conf *c = data;
|
2007-10-28 19:13:50 +00:00
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
2004-12-11 00:10:41 +00:00
|
|
|
|
|
|
|
|
if (pa_daemon_conf_set_log_level(c, rvalue) < 0) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid log level '%s'."), filename, line, rvalue);
|
2004-12-11 00:10:41 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_resample_method(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_daemon_conf *c = data;
|
2007-10-28 19:13:50 +00:00
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
2004-09-17 20:43:40 +00:00
|
|
|
|
|
|
|
|
if (pa_daemon_conf_set_resample_method(c, rvalue) < 0) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid resample method '%s'."), filename, line, rvalue);
|
2004-09-13 23:28:30 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2004-09-17 19:45:44 +00:00
|
|
|
return 0;
|
2004-09-13 23:28:30 +00:00
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_rlimit(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2006-07-20 13:07:01 +00:00
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
|
|
|
|
struct pa_rlimit *r = data;
|
2007-10-28 19:13:50 +00:00
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(r);
|
2006-07-20 01:25:37 +00:00
|
|
|
|
|
|
|
|
if (rvalue[strspn(rvalue, "\t ")] == 0) {
|
|
|
|
|
/* Empty string */
|
|
|
|
|
r->is_set = 0;
|
|
|
|
|
r->value = 0;
|
|
|
|
|
} else {
|
|
|
|
|
int32_t k;
|
|
|
|
|
if (pa_atoi(rvalue, &k) < 0) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid rlimit '%s'."), filename, line, rvalue);
|
2006-07-20 01:25:37 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
r->is_set = k >= 0;
|
|
|
|
|
r->value = k >= 0 ? (rlim_t) k : 0;
|
|
|
|
|
}
|
2006-07-20 13:07:01 +00:00
|
|
|
#else
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log_warn(_("[%s:%u] rlimit not supported on this platform."), filename, line);
|
2006-07-20 13:07:01 +00:00
|
|
|
#endif
|
2006-07-20 01:25:37 +00:00
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_sample_format(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_daemon_conf *c = data;
|
|
|
|
|
pa_sample_format_t f;
|
|
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
|
|
|
|
|
|
|
|
|
if ((f = pa_parse_sample_format(rvalue)) < 0) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid sample format '%s'."), filename, line, rvalue);
|
2007-10-28 19:13:50 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c->default_sample_spec.format = f;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_sample_rate(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_daemon_conf *c = data;
|
2008-08-19 22:39:54 +02:00
|
|
|
uint32_t r;
|
2007-10-28 19:13:50 +00:00
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
|
|
|
|
|
2008-08-19 22:39:54 +02:00
|
|
|
if (pa_atou(rvalue, &r) < 0 || r > (uint32_t) PA_RATE_MAX || r <= 0) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid sample rate '%s'."), filename, line, rvalue);
|
2007-10-28 19:13:50 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c->default_sample_spec.rate = r;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-21 16:32:42 +01:00
|
|
|
struct channel_conf_info {
|
|
|
|
|
pa_daemon_conf *conf;
|
|
|
|
|
pa_bool_t default_sample_spec_set;
|
|
|
|
|
pa_bool_t default_channel_map_set;
|
|
|
|
|
};
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_sample_channels(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2009-02-21 16:32:42 +01:00
|
|
|
struct channel_conf_info *i = data;
|
2007-10-28 19:13:50 +00:00
|
|
|
int32_t n;
|
|
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
|
|
|
|
|
2008-05-21 22:42:32 +00:00
|
|
|
if (pa_atoi(rvalue, &n) < 0 || n > (int32_t) PA_CHANNELS_MAX || n <= 0) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid sample channels '%s'."), filename, line, rvalue);
|
2007-10-28 19:13:50 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-21 16:32:42 +01:00
|
|
|
i->conf->default_sample_spec.channels = (uint8_t) n;
|
|
|
|
|
i->default_sample_spec_set = TRUE;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int parse_channel_map(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
|
|
|
|
struct channel_conf_info *i = data;
|
|
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
|
|
|
|
|
|
|
|
|
if (!pa_channel_map_parse(&i->conf->default_channel_map, rvalue)) {
|
|
|
|
|
pa_log(_("[%s:%u] Invalid channel map '%s'."), filename, line, rvalue);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i->default_channel_map_set = TRUE;
|
2007-10-28 19:13:50 +00:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_fragments(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_daemon_conf *c = data;
|
|
|
|
|
int32_t n;
|
|
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
|
|
|
|
|
|
|
|
|
if (pa_atoi(rvalue, &n) < 0 || n < 2) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid number of fragments '%s'."), filename, line, rvalue);
|
2007-10-28 19:13:50 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c->default_n_fragments = (unsigned) n;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_fragment_size_msec(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_daemon_conf *c = data;
|
|
|
|
|
int32_t n;
|
|
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
|
|
|
|
|
|
|
|
|
if (pa_atoi(rvalue, &n) < 0 || n < 1) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid fragment size '%s'."), filename, line, rvalue);
|
2007-10-28 19:13:50 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c->default_fragment_size_msec = (unsigned) n;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_nice_level(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2007-11-01 00:34:43 +00:00
|
|
|
pa_daemon_conf *c = data;
|
|
|
|
|
int32_t level;
|
|
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
|
|
|
|
|
|
|
|
|
if (pa_atoi(rvalue, &level) < 0 || level < -20 || level > 19) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log(_("[%s:%u] Invalid nice level '%s'."), filename, line, rvalue);
|
2007-11-01 00:34:43 +00:00
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c->nice_level = (int) level;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-05 04:11:26 +01:00
|
|
|
static int parse_rtprio(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
|
2007-11-01 00:34:43 +00:00
|
|
|
pa_daemon_conf *c = data;
|
|
|
|
|
int32_t rtprio;
|
|
|
|
|
|
|
|
|
|
pa_assert(filename);
|
|
|
|
|
pa_assert(lvalue);
|
|
|
|
|
pa_assert(rvalue);
|
|
|
|
|
pa_assert(data);
|
|
|
|
|
|
|
|
|
|
if (pa_atoi(rvalue, &rtprio) < 0 || rtprio < sched_get_priority_min(SCHED_FIFO) || rtprio > sched_get_priority_max(SCHED_FIFO)) {
|
|
|
|
|
pa_log("[%s:%u] Invalid realtime priority '%s'.", filename, line, rvalue);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
c->realtime_priority = (int) rtprio;
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
|
2004-11-04 21:27:12 +00:00
|
|
|
int r = -1;
|
|
|
|
|
FILE *f = NULL;
|
2009-02-21 16:32:42 +01:00
|
|
|
struct channel_conf_info ci;
|
2006-01-11 01:17:39 +00:00
|
|
|
pa_config_item table[] = {
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "daemonize", pa_config_parse_bool, &c->daemonize, NULL },
|
|
|
|
|
{ "fail", pa_config_parse_bool, &c->fail, NULL },
|
|
|
|
|
{ "high-priority", pa_config_parse_bool, &c->high_priority, NULL },
|
|
|
|
|
{ "realtime-scheduling", pa_config_parse_bool, &c->realtime_scheduling, NULL },
|
|
|
|
|
{ "disallow-module-loading", pa_config_parse_bool, &c->disallow_module_loading, NULL },
|
|
|
|
|
{ "disallow-exit", pa_config_parse_bool, &c->disallow_exit, NULL },
|
|
|
|
|
{ "use-pid-file", pa_config_parse_bool, &c->use_pid_file, NULL },
|
|
|
|
|
{ "system-instance", pa_config_parse_bool, &c->system_instance, NULL },
|
|
|
|
|
{ "no-cpu-limit", pa_config_parse_bool, &c->no_cpu_limit, NULL },
|
|
|
|
|
{ "disable-shm", pa_config_parse_bool, &c->disable_shm, NULL },
|
|
|
|
|
{ "flat-volumes", pa_config_parse_bool, &c->flat_volumes, NULL },
|
|
|
|
|
{ "exit-idle-time", pa_config_parse_int, &c->exit_idle_time, NULL },
|
|
|
|
|
{ "scache-idle-time", pa_config_parse_int, &c->scache_idle_time, NULL },
|
|
|
|
|
{ "realtime-priority", parse_rtprio, c, NULL },
|
|
|
|
|
{ "dl-search-path", pa_config_parse_string, &c->dl_search_path, NULL },
|
|
|
|
|
{ "default-script-file", pa_config_parse_string, &c->default_script_file, NULL },
|
|
|
|
|
{ "log-target", parse_log_target, c, NULL },
|
|
|
|
|
{ "log-level", parse_log_level, c, NULL },
|
|
|
|
|
{ "verbose", parse_log_level, c, NULL },
|
|
|
|
|
{ "resample-method", parse_resample_method, c, NULL },
|
|
|
|
|
{ "default-sample-format", parse_sample_format, c, NULL },
|
|
|
|
|
{ "default-sample-rate", parse_sample_rate, c, NULL },
|
|
|
|
|
{ "default-sample-channels", parse_sample_channels, &ci, NULL },
|
|
|
|
|
{ "default-channel-map", parse_channel_map, &ci, NULL },
|
|
|
|
|
{ "default-fragments", parse_fragments, c, NULL },
|
|
|
|
|
{ "default-fragment-size-msec", parse_fragment_size_msec, c, NULL },
|
|
|
|
|
{ "nice-level", parse_nice_level, c, NULL },
|
|
|
|
|
{ "disable-remixing", pa_config_parse_bool, &c->disable_remixing, NULL },
|
|
|
|
|
{ "disable-lfe-remixing", pa_config_parse_bool, &c->disable_lfe_remixing, NULL },
|
|
|
|
|
{ "load-default-script-file", pa_config_parse_bool, &c->load_default_script_file, NULL },
|
|
|
|
|
{ "shm-size-bytes", pa_config_parse_size, &c->shm_size, NULL },
|
|
|
|
|
{ "log-meta", pa_config_parse_bool, &c->log_meta, NULL },
|
|
|
|
|
{ "log-time", pa_config_parse_bool, &c->log_time, NULL },
|
|
|
|
|
{ "log-backtrace", pa_config_parse_unsigned, &c->log_backtrace, NULL },
|
2006-07-20 01:25:37 +00:00
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-fsize", parse_rlimit, &c->rlimit_fsize, NULL },
|
|
|
|
|
{ "rlimit-data", parse_rlimit, &c->rlimit_data, NULL },
|
|
|
|
|
{ "rlimit-stack", parse_rlimit, &c->rlimit_stack, NULL },
|
|
|
|
|
{ "rlimit-core", parse_rlimit, &c->rlimit_core, NULL },
|
2009-02-26 16:48:58 +11:00
|
|
|
#ifdef RLIMIT_RSS
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-rss", parse_rlimit, &c->rlimit_rss, NULL },
|
2009-02-26 16:48:58 +11:00
|
|
|
#endif
|
2009-01-27 00:48:53 +01:00
|
|
|
#ifdef RLIMIT_NOFILE
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-nofile", parse_rlimit, &c->rlimit_nofile, NULL },
|
2009-01-27 00:48:53 +01:00
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_AS
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-as", parse_rlimit, &c->rlimit_as, NULL },
|
2009-01-27 00:48:53 +01:00
|
|
|
#endif
|
2006-07-20 01:25:37 +00:00
|
|
|
#ifdef RLIMIT_NPROC
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-nproc", parse_rlimit, &c->rlimit_nproc, NULL },
|
2006-07-20 01:25:37 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_MEMLOCK
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-memlock", parse_rlimit, &c->rlimit_memlock, NULL },
|
2006-07-20 01:25:37 +00:00
|
|
|
#endif
|
2008-05-15 23:34:41 +00:00
|
|
|
#ifdef RLIMIT_LOCKS
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-locks", parse_rlimit, &c->rlimit_locks, NULL },
|
2008-05-15 23:34:41 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_SIGPENDING
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-sigpending", parse_rlimit, &c->rlimit_sigpending, NULL },
|
2008-05-15 23:34:41 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_MSGQUEUE
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-msgqueue", parse_rlimit, &c->rlimit_msgqueue, NULL },
|
2008-05-15 23:34:41 +00:00
|
|
|
#endif
|
2007-11-01 00:34:43 +00:00
|
|
|
#ifdef RLIMIT_NICE
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-nice", parse_rlimit, &c->rlimit_nice, NULL },
|
2007-11-01 00:34:43 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_RTPRIO
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-rtprio", parse_rlimit, &c->rlimit_rtprio, NULL },
|
2007-11-01 00:34:43 +00:00
|
|
|
#endif
|
2008-05-15 23:34:41 +00:00
|
|
|
#ifdef RLIMIT_RTTIME
|
2009-02-21 16:32:42 +01:00
|
|
|
{ "rlimit-rttime", parse_rlimit, &c->rlimit_rttime, NULL },
|
2008-05-15 23:34:41 +00:00
|
|
|
#endif
|
2006-07-20 01:25:37 +00:00
|
|
|
#endif
|
2009-02-05 04:11:26 +01:00
|
|
|
{ NULL, NULL, NULL, NULL },
|
2004-09-17 19:45:44 +00:00
|
|
|
};
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2004-11-04 21:27:12 +00:00
|
|
|
pa_xfree(c->config_file);
|
|
|
|
|
c->config_file = NULL;
|
|
|
|
|
|
|
|
|
|
f = filename ?
|
|
|
|
|
fopen(c->config_file = pa_xstrdup(filename), "r") :
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_open_config_file(DEFAULT_CONFIG_FILE, DEFAULT_CONFIG_FILE_USER, ENV_CONFIG_FILE, &c->config_file);
|
2004-11-04 21:27:12 +00:00
|
|
|
|
2004-11-08 23:48:19 +00:00
|
|
|
if (!f && errno != ENOENT) {
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_log_warn(_("Failed to open configuration file: %s"), pa_cstrerror(errno));
|
2004-11-04 21:27:12 +00:00
|
|
|
goto finish;
|
|
|
|
|
}
|
|
|
|
|
|
2009-02-21 16:32:42 +01:00
|
|
|
ci.default_channel_map_set = ci.default_sample_spec_set = FALSE;
|
|
|
|
|
ci.conf = c;
|
|
|
|
|
|
2004-11-08 23:48:19 +00:00
|
|
|
r = f ? pa_config_parse(c->config_file, f, table, NULL) : 0;
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2009-02-21 16:32:42 +01:00
|
|
|
if (r >= 0) {
|
|
|
|
|
|
|
|
|
|
/* Make sure that channel map and sample spec fit together */
|
|
|
|
|
|
|
|
|
|
if (ci.default_sample_spec_set &&
|
|
|
|
|
ci.default_channel_map_set &&
|
|
|
|
|
c->default_channel_map.channels != c->default_sample_spec.channels) {
|
|
|
|
|
pa_log_error(_("The specified default channel map has a different number of channels than the specified default number of channels."));
|
|
|
|
|
r = -1;
|
|
|
|
|
goto finish;
|
|
|
|
|
} else if (ci.default_sample_spec_set)
|
|
|
|
|
pa_channel_map_init_extend(&c->default_channel_map, c->default_sample_spec.channels, PA_CHANNEL_MAP_DEFAULT);
|
|
|
|
|
else if (ci.default_channel_map_set)
|
|
|
|
|
c->default_sample_spec.channels = c->default_channel_map.channels;
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-04 21:27:12 +00:00
|
|
|
finish:
|
|
|
|
|
if (f)
|
|
|
|
|
fclose(f);
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2004-09-17 19:45:44 +00:00
|
|
|
return r;
|
|
|
|
|
}
|
2004-09-13 23:28:30 +00:00
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
int pa_daemon_conf_env(pa_daemon_conf *c) {
|
2004-09-17 19:45:44 +00:00
|
|
|
char *e;
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_assert(c);
|
2004-09-13 23:28:30 +00:00
|
|
|
|
2004-09-17 19:45:44 +00:00
|
|
|
if ((e = getenv(ENV_DL_SEARCH_PATH))) {
|
|
|
|
|
pa_xfree(c->dl_search_path);
|
|
|
|
|
c->dl_search_path = pa_xstrdup(e);
|
2004-09-13 23:28:30 +00:00
|
|
|
}
|
2004-09-17 19:45:44 +00:00
|
|
|
if ((e = getenv(ENV_SCRIPT_FILE))) {
|
|
|
|
|
pa_xfree(c->default_script_file);
|
|
|
|
|
c->default_script_file = pa_xstrdup(e);
|
2004-09-13 23:28:30 +00:00
|
|
|
}
|
|
|
|
|
|
2004-09-17 19:45:44 +00:00
|
|
|
return 0;
|
2004-09-13 23:28:30 +00:00
|
|
|
}
|
|
|
|
|
|
2008-05-15 23:34:41 +00:00
|
|
|
const char *pa_daemon_conf_get_default_script_file(pa_daemon_conf *c) {
|
|
|
|
|
pa_assert(c);
|
|
|
|
|
|
|
|
|
|
if (!c->default_script_file) {
|
|
|
|
|
if (c->system_instance)
|
|
|
|
|
c->default_script_file = pa_find_config_file(DEFAULT_SYSTEM_SCRIPT_FILE, NULL, ENV_SCRIPT_FILE);
|
|
|
|
|
else
|
|
|
|
|
c->default_script_file = pa_find_config_file(DEFAULT_SCRIPT_FILE, DEFAULT_SCRIPT_FILE_USER, ENV_SCRIPT_FILE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return c->default_script_file;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
FILE *pa_daemon_conf_open_default_script_file(pa_daemon_conf *c) {
|
|
|
|
|
FILE *f;
|
|
|
|
|
pa_assert(c);
|
|
|
|
|
|
|
|
|
|
if (!c->default_script_file) {
|
|
|
|
|
if (c->system_instance)
|
|
|
|
|
f = pa_open_config_file(DEFAULT_SYSTEM_SCRIPT_FILE, NULL, ENV_SCRIPT_FILE, &c->default_script_file);
|
|
|
|
|
else
|
|
|
|
|
f = pa_open_config_file(DEFAULT_SCRIPT_FILE, DEFAULT_SCRIPT_FILE_USER, ENV_SCRIPT_FILE, &c->default_script_file);
|
|
|
|
|
} else
|
|
|
|
|
f = fopen(c->default_script_file, "r");
|
|
|
|
|
|
|
|
|
|
return f;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2004-12-11 00:10:41 +00:00
|
|
|
static const char* const log_level_to_string[] = {
|
|
|
|
|
[PA_LOG_DEBUG] = "debug",
|
|
|
|
|
[PA_LOG_INFO] = "info",
|
|
|
|
|
[PA_LOG_NOTICE] = "notice",
|
|
|
|
|
[PA_LOG_WARN] = "warning",
|
|
|
|
|
[PA_LOG_ERROR] = "error"
|
|
|
|
|
};
|
|
|
|
|
|
2006-01-11 01:17:39 +00:00
|
|
|
char *pa_daemon_conf_dump(pa_daemon_conf *c) {
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_strbuf *s;
|
2009-02-21 16:32:42 +01:00
|
|
|
char cm[PA_CHANNEL_MAP_SNPRINT_MAX];
|
2007-10-28 19:13:50 +00:00
|
|
|
|
|
|
|
|
pa_assert(c);
|
|
|
|
|
|
|
|
|
|
s = pa_strbuf_new();
|
2004-09-13 23:28:30 +00:00
|
|
|
|
2004-11-04 21:27:12 +00:00
|
|
|
if (c->config_file)
|
2008-08-06 18:54:13 +02:00
|
|
|
pa_strbuf_printf(s, _("### Read from configuration file: %s ###\n"), c->config_file);
|
2004-12-11 00:10:41 +00:00
|
|
|
|
2009-02-18 19:15:43 +02:00
|
|
|
pa_assert(c->log_level < PA_LOG_LEVEL_MAX);
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2007-11-01 00:34:43 +00:00
|
|
|
pa_strbuf_printf(s, "daemonize = %s\n", pa_yes_no(c->daemonize));
|
|
|
|
|
pa_strbuf_printf(s, "fail = %s\n", pa_yes_no(c->fail));
|
|
|
|
|
pa_strbuf_printf(s, "high-priority = %s\n", pa_yes_no(c->high_priority));
|
|
|
|
|
pa_strbuf_printf(s, "nice-level = %i\n", c->nice_level);
|
|
|
|
|
pa_strbuf_printf(s, "realtime-scheduling = %s\n", pa_yes_no(c->realtime_scheduling));
|
|
|
|
|
pa_strbuf_printf(s, "realtime-priority = %i\n", c->realtime_priority);
|
|
|
|
|
pa_strbuf_printf(s, "disallow-module-loading = %s\n", pa_yes_no(c->disallow_module_loading));
|
2008-08-06 19:39:12 +02:00
|
|
|
pa_strbuf_printf(s, "disallow-exit = %s\n", pa_yes_no(c->disallow_exit));
|
2007-11-01 00:34:43 +00:00
|
|
|
pa_strbuf_printf(s, "use-pid-file = %s\n", pa_yes_no(c->use_pid_file));
|
|
|
|
|
pa_strbuf_printf(s, "system-instance = %s\n", pa_yes_no(c->system_instance));
|
|
|
|
|
pa_strbuf_printf(s, "no-cpu-limit = %s\n", pa_yes_no(c->no_cpu_limit));
|
|
|
|
|
pa_strbuf_printf(s, "disable-shm = %s\n", pa_yes_no(c->disable_shm));
|
2009-01-27 04:39:07 +01:00
|
|
|
pa_strbuf_printf(s, "flat-volumes = %s\n", pa_yes_no(c->flat_volumes));
|
2004-09-13 23:28:30 +00:00
|
|
|
pa_strbuf_printf(s, "exit-idle-time = %i\n", c->exit_idle_time);
|
2004-09-14 23:08:39 +00:00
|
|
|
pa_strbuf_printf(s, "scache-idle-time = %i\n", c->scache_idle_time);
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_strbuf_printf(s, "dl-search-path = %s\n", pa_strempty(c->dl_search_path));
|
|
|
|
|
pa_strbuf_printf(s, "default-script-file = %s\n", pa_strempty(pa_daemon_conf_get_default_script_file(c)));
|
|
|
|
|
pa_strbuf_printf(s, "load-default-script-file = %s\n", pa_yes_no(c->load_default_script_file));
|
2004-09-13 23:28:30 +00:00
|
|
|
pa_strbuf_printf(s, "log-target = %s\n", c->auto_log_target ? "auto" : (c->log_target == PA_LOG_SYSLOG ? "syslog" : "stderr"));
|
2004-12-11 00:10:41 +00:00
|
|
|
pa_strbuf_printf(s, "log-level = %s\n", log_level_to_string[c->log_level]);
|
2004-11-20 16:23:53 +00:00
|
|
|
pa_strbuf_printf(s, "resample-method = %s\n", pa_resample_method_to_string(c->resample_method));
|
2007-11-21 01:30:40 +00:00
|
|
|
pa_strbuf_printf(s, "disable-remixing = %s\n", pa_yes_no(c->disable_remixing));
|
2008-09-05 16:04:42 +03:00
|
|
|
pa_strbuf_printf(s, "disable-lfe-remixing = %s\n", pa_yes_no(c->disable_lfe_remixing));
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_strbuf_printf(s, "default-sample-format = %s\n", pa_sample_format_to_string(c->default_sample_spec.format));
|
|
|
|
|
pa_strbuf_printf(s, "default-sample-rate = %u\n", c->default_sample_spec.rate);
|
|
|
|
|
pa_strbuf_printf(s, "default-sample-channels = %u\n", c->default_sample_spec.channels);
|
2009-02-21 16:32:42 +01:00
|
|
|
pa_strbuf_printf(s, "default-channel-map = %s\n", pa_channel_map_snprint(cm, sizeof(cm), &c->default_channel_map));
|
2007-10-28 19:13:50 +00:00
|
|
|
pa_strbuf_printf(s, "default-fragments = %u\n", c->default_n_fragments);
|
|
|
|
|
pa_strbuf_printf(s, "default-fragment-size-msec = %u\n", c->default_fragment_size_msec);
|
2008-10-01 01:14:36 +02:00
|
|
|
pa_strbuf_printf(s, "shm-size-bytes = %lu\n", (unsigned long) c->shm_size);
|
2008-10-21 19:15:41 +02:00
|
|
|
pa_strbuf_printf(s, "log-meta = %s\n", pa_yes_no(c->log_meta));
|
|
|
|
|
pa_strbuf_printf(s, "log-time = %s\n", pa_yes_no(c->log_time));
|
|
|
|
|
pa_strbuf_printf(s, "log-backtrace = %u\n", c->log_backtrace);
|
2006-07-20 01:25:37 +00:00
|
|
|
#ifdef HAVE_SYS_RESOURCE_H
|
|
|
|
|
pa_strbuf_printf(s, "rlimit-fsize = %li\n", c->rlimit_fsize.is_set ? (long int) c->rlimit_fsize.value : -1);
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_strbuf_printf(s, "rlimit-data = %li\n", c->rlimit_data.is_set ? (long int) c->rlimit_data.value : -1);
|
2006-07-20 01:25:37 +00:00
|
|
|
pa_strbuf_printf(s, "rlimit-stack = %li\n", c->rlimit_stack.is_set ? (long int) c->rlimit_stack.value : -1);
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_strbuf_printf(s, "rlimit-core = %li\n", c->rlimit_core.is_set ? (long int) c->rlimit_core.value : -1);
|
2009-02-26 16:48:58 +11:00
|
|
|
#ifdef RLIMIT_RSS
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_strbuf_printf(s, "rlimit-rss = %li\n", c->rlimit_rss.is_set ? (long int) c->rlimit_rss.value : -1);
|
2009-02-26 16:48:58 +11:00
|
|
|
#endif
|
2009-01-27 00:48:53 +01:00
|
|
|
#ifdef RLIMIT_AS
|
|
|
|
|
pa_strbuf_printf(s, "rlimit-as = %li\n", c->rlimit_as.is_set ? (long int) c->rlimit_as.value : -1);
|
|
|
|
|
#endif
|
2006-07-20 01:25:37 +00:00
|
|
|
#ifdef RLIMIT_NPROC
|
|
|
|
|
pa_strbuf_printf(s, "rlimit-nproc = %li\n", c->rlimit_nproc.is_set ? (long int) c->rlimit_nproc.value : -1);
|
|
|
|
|
#endif
|
2009-01-27 00:48:53 +01:00
|
|
|
#ifdef RLIMIT_NOFILE
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_strbuf_printf(s, "rlimit-nofile = %li\n", c->rlimit_nofile.is_set ? (long int) c->rlimit_nofile.value : -1);
|
2009-01-27 00:48:53 +01:00
|
|
|
#endif
|
2006-07-20 01:25:37 +00:00
|
|
|
#ifdef RLIMIT_MEMLOCK
|
|
|
|
|
pa_strbuf_printf(s, "rlimit-memlock = %li\n", c->rlimit_memlock.is_set ? (long int) c->rlimit_memlock.value : -1);
|
|
|
|
|
#endif
|
2008-05-15 23:34:41 +00:00
|
|
|
#ifdef RLIMIT_LOCKS
|
|
|
|
|
pa_strbuf_printf(s, "rlimit-locks = %li\n", c->rlimit_locks.is_set ? (long int) c->rlimit_locks.value : -1);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_SIGPENDING
|
|
|
|
|
pa_strbuf_printf(s, "rlimit-sigpending = %li\n", c->rlimit_sigpending.is_set ? (long int) c->rlimit_sigpending.value : -1);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_MSGQUEUE
|
|
|
|
|
pa_strbuf_printf(s, "rlimit-msgqueue = %li\n", c->rlimit_msgqueue.is_set ? (long int) c->rlimit_msgqueue.value : -1);
|
|
|
|
|
#endif
|
2007-11-01 00:34:43 +00:00
|
|
|
#ifdef RLIMIT_NICE
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_strbuf_printf(s, "rlimit-nice = %li\n", c->rlimit_nice.is_set ? (long int) c->rlimit_nice.value : -1);
|
2007-11-01 00:34:43 +00:00
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_RTPRIO
|
2008-05-15 23:34:41 +00:00
|
|
|
pa_strbuf_printf(s, "rlimit-rtprio = %li\n", c->rlimit_rtprio.is_set ? (long int) c->rlimit_rtprio.value : -1);
|
|
|
|
|
#endif
|
|
|
|
|
#ifdef RLIMIT_RTTIME
|
|
|
|
|
pa_strbuf_printf(s, "rlimit-rttime = %li\n", c->rlimit_rttime.is_set ? (long int) c->rlimit_rttime.value : -1);
|
2007-11-01 00:34:43 +00:00
|
|
|
#endif
|
2006-07-20 01:25:37 +00:00
|
|
|
#endif
|
2007-01-04 13:43:45 +00:00
|
|
|
|
2004-09-13 23:28:30 +00:00
|
|
|
return pa_strbuf_tostring_free(s);
|
|
|
|
|
}
|