diff options
Diffstat (limited to 'src/daemon/daemon-conf.c')
-rw-r--r-- | src/daemon/daemon-conf.c | 165 |
1 files changed, 80 insertions, 85 deletions
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 05c86c87..d7ffc105 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -74,8 +74,12 @@ static const pa_daemon_conf default_conf = { .default_script_file = NULL, .log_target = PA_LOG_SYSLOG, .log_level = PA_LOG_NOTICE, + .log_backtrace = 0, + .log_meta = FALSE, + .log_time = FALSE, .resample_method = PA_RESAMPLER_AUTO, .disable_remixing = FALSE, + .disable_lfe_remixing = TRUE, .config_file = NULL, .use_pid_file = TRUE, .system_instance = FALSE, @@ -83,7 +87,8 @@ static const pa_daemon_conf default_conf = { .disable_shm = FALSE, .default_n_fragments = 4, .default_fragment_size_msec = 25, - .default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 } + .default_sample_spec = { .format = PA_SAMPLE_S16NE, .rate = 44100, .channels = 2 }, + .shm_size = 0 #ifdef HAVE_SYS_RESOURCE_H ,.rlimit_fsize = { .value = 0, .is_set = FALSE }, .rlimit_data = { .value = 0, .is_set = FALSE }, @@ -191,7 +196,7 @@ int pa_daemon_conf_set_resample_method(pa_daemon_conf *c, const char *string) { return 0; } -static int parse_log_target(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_log_target(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; pa_assert(filename); @@ -207,7 +212,7 @@ static int parse_log_target(const char *filename, unsigned line, const char *lva return 0; } -static int parse_log_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_log_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; pa_assert(filename); @@ -223,7 +228,7 @@ static int parse_log_level(const char *filename, unsigned line, const char *lval return 0; } -static int parse_resample_method(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_resample_method(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; pa_assert(filename); @@ -239,7 +244,7 @@ static int parse_resample_method(const char *filename, unsigned line, const char return 0; } -static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { #ifdef HAVE_SYS_RESOURCE_H struct pa_rlimit *r = data; @@ -268,7 +273,7 @@ static int parse_rlimit(const char *filename, unsigned line, const char *lvalue, return 0; } -static int parse_sample_format(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_sample_format(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; pa_sample_format_t f; @@ -286,16 +291,16 @@ static int parse_sample_format(const char *filename, unsigned line, const char * return 0; } -static int parse_sample_rate(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_sample_rate(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; - int32_t r; + uint32_t r; pa_assert(filename); pa_assert(lvalue); pa_assert(rvalue); pa_assert(data); - if (pa_atoi(rvalue, &r) < 0 || r > (int32_t) PA_RATE_MAX || r <= 0) { + if (pa_atou(rvalue, &r) < 0 || r > (uint32_t) PA_RATE_MAX || r <= 0) { pa_log(_("[%s:%u] Invalid sample rate '%s'."), filename, line, rvalue); return -1; } @@ -304,7 +309,7 @@ static int parse_sample_rate(const char *filename, unsigned line, const char *lv return 0; } -static int parse_sample_channels(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_sample_channels(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t n; @@ -322,7 +327,7 @@ static int parse_sample_channels(const char *filename, unsigned line, const char return 0; } -static int parse_fragments(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_fragments(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t n; @@ -340,7 +345,7 @@ static int parse_fragments(const char *filename, unsigned line, const char *lval return 0; } -static int parse_fragment_size_msec(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_fragment_size_msec(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t n; @@ -358,7 +363,7 @@ static int parse_fragment_size_msec(const char *filename, unsigned line, const c return 0; } -static int parse_nice_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_nice_level(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t level; @@ -376,7 +381,7 @@ static int parse_nice_level(const char *filename, unsigned line, const char *lva return 0; } -static int parse_rtprio(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, PA_GCC_UNUSED void *userdata) { +static int parse_rtprio(const char *filename, unsigned line, const char *lvalue, const char *rvalue, void *data, void *userdata) { pa_daemon_conf *c = data; int32_t rtprio; @@ -397,6 +402,7 @@ static int parse_rtprio(const char *filename, unsigned line, const char *lvalue, int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { int r = -1; FILE *f = NULL; + unsigned i = 0; pa_config_item table[] = { { "daemonize", pa_config_parse_bool, NULL }, @@ -426,7 +432,12 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { { "default-fragment-size-msec", parse_fragment_size_msec, NULL }, { "nice-level", parse_nice_level, NULL }, { "disable-remixing", pa_config_parse_bool, NULL }, + { "disable-lfe-remixing", pa_config_parse_bool, NULL }, { "load-default-script-file", pa_config_parse_bool, NULL }, + { "shm-size-bytes", pa_config_parse_size, NULL }, + { "log-meta", pa_config_parse_bool, NULL }, + { "log-time", pa_config_parse_bool, NULL }, + { "log-backtrace", pa_config_parse_unsigned, NULL }, #ifdef HAVE_SYS_RESOURCE_H { "rlimit-fsize", parse_rlimit, NULL }, { "rlimit-data", parse_rlimit, NULL }, @@ -463,96 +474,75 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { { NULL, NULL, NULL }, }; - table[0].data = &c->daemonize; - table[1].data = &c->fail; - table[2].data = &c->high_priority; - table[3].data = &c->realtime_scheduling; - table[4].data = &c->disallow_module_loading; - table[5].data = &c->disallow_exit; - table[6].data = &c->use_pid_file; - table[7].data = &c->system_instance; - table[8].data = &c->no_cpu_limit; - table[9].data = &c->disable_shm; - table[10].data = &c->exit_idle_time; - table[11].data = &c->module_idle_time; - table[12].data = &c->scache_idle_time; - table[13].data = c; - table[14].data = &c->dl_search_path; - table[15].data = &c->default_script_file; - table[16].data = c; - table[17].data = c; - table[18].data = c; - table[19].data = c; - table[20].data = c; - table[21].data = c; - table[22].data = c; - table[23].data = c; - table[24].data = c; - table[25].data = c; - table[26].data = &c->disable_remixing; - table[27].data = &c->load_default_script_file; + table[i++].data = &c->daemonize; + table[i++].data = &c->fail; + table[i++].data = &c->high_priority; + table[i++].data = &c->realtime_scheduling; + table[i++].data = &c->disallow_module_loading; + table[i++].data = &c->disallow_exit; + table[i++].data = &c->use_pid_file; + table[i++].data = &c->system_instance; + table[i++].data = &c->no_cpu_limit; + table[i++].data = &c->disable_shm; + table[i++].data = &c->exit_idle_time; + table[i++].data = &c->module_idle_time; + table[i++].data = &c->scache_idle_time; + table[i++].data = c; + table[i++].data = &c->dl_search_path; + table[i++].data = &c->default_script_file; + table[i++].data = c; + table[i++].data = c; + table[i++].data = c; + table[i++].data = c; + table[i++].data = c; + table[i++].data = c; + table[i++].data = c; + table[i++].data = c; + table[i++].data = c; + table[i++].data = c; + table[i++].data = &c->disable_remixing; + table[i++].data = &c->disable_lfe_remixing; + table[i++].data = &c->load_default_script_file; + table[i++].data = &c->shm_size; + table[i++].data = &c->log_meta; + table[i++].data = &c->log_time; + table[i++].data = &c->log_backtrace; #ifdef HAVE_SYS_RESOURCE_H - table[28].data = &c->rlimit_fsize; - table[29].data = &c->rlimit_data; - table[30].data = &c->rlimit_stack; - table[31].data = &c->rlimit_as; - table[32].data = &c->rlimit_core; - table[33].data = &c->rlimit_nofile; - table[34].data = &c->rlimit_as; + 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_nofile; + table[i++].data = &c->rlimit_as; #ifdef RLIMIT_NPROC - table[35].data = &c->rlimit_nproc; + table[i++].data = &c->rlimit_nproc; #endif - #ifdef RLIMIT_MEMLOCK -#ifndef RLIMIT_NPROC -#error "Houston, we have a numbering problem!" -#endif - table[36].data = &c->rlimit_memlock; + table[i++].data = &c->rlimit_memlock; #endif - #ifdef RLIMIT_LOCKS -#ifndef RLIMIT_MEMLOCK -#error "Houston, we have a numbering problem!" -#endif - table[37].data = &c->rlimit_locks; + table[i++].data = &c->rlimit_locks; #endif - #ifdef RLIMIT_SIGPENDING -#ifndef RLIMIT_LOCKS -#error "Houston, we have a numbering problem!" -#endif - table[38].data = &c->rlimit_sigpending; + table[i++].data = &c->rlimit_sigpending; #endif - #ifdef RLIMIT_MSGQUEUE -#ifndef RLIMIT_SIGPENDING -#error "Houston, we have a numbering problem!" -#endif - table[39].data = &c->rlimit_msgqueue; + table[i++].data = &c->rlimit_msgqueue; #endif - #ifdef RLIMIT_NICE -#ifndef RLIMIT_MSGQUEUE -#error "Houston, we have a numbering problem!" -#endif - table[40].data = &c->rlimit_nice; + table[i++].data = &c->rlimit_nice; #endif - #ifdef RLIMIT_RTPRIO -#ifndef RLIMIT_NICE -#error "Houston, we have a numbering problem!" -#endif - table[41].data = &c->rlimit_rtprio; + table[i++].data = &c->rlimit_rtprio; #endif - #ifdef RLIMIT_RTTIME -#ifndef RLIMIT_RTTIME -#error "Houston, we have a numbering problem!" -#endif - table[42].data = &c->rlimit_rttime; + table[i++].data = &c->rlimit_rttime; #endif #endif + pa_assert(i == PA_ELEMENTSOF(table)-1); + pa_xfree(c->config_file); c->config_file = NULL; @@ -661,11 +651,16 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { pa_strbuf_printf(s, "log-level = %s\n", log_level_to_string[c->log_level]); pa_strbuf_printf(s, "resample-method = %s\n", pa_resample_method_to_string(c->resample_method)); pa_strbuf_printf(s, "disable-remixing = %s\n", pa_yes_no(c->disable_remixing)); + pa_strbuf_printf(s, "disable-lfe-remixing = %s\n", pa_yes_no(c->disable_lfe_remixing)); 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); 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); + pa_strbuf_printf(s, "shm-size-bytes = %lu\n", (unsigned long) c->shm_size); + 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); #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); pa_strbuf_printf(s, "rlimit-data = %li\n", c->rlimit_data.is_set ? (long int) c->rlimit_data.value : -1); |