diff options
Diffstat (limited to 'src/daemon')
-rw-r--r-- | src/daemon/caps.c | 2 | ||||
-rw-r--r-- | src/daemon/cmdline.c | 29 | ||||
-rw-r--r-- | src/daemon/cpulimit.c | 2 | ||||
-rw-r--r-- | src/daemon/daemon-conf.c | 133 | ||||
-rw-r--r-- | src/daemon/daemon-conf.h | 5 | ||||
-rw-r--r-- | src/daemon/daemon.conf.in | 3 | ||||
-rwxr-xr-x | src/daemon/default.pa.in | 9 | ||||
-rw-r--r-- | src/daemon/ltdl-bind-now.c | 110 | ||||
-rw-r--r-- | src/daemon/main.c | 58 |
9 files changed, 179 insertions, 172 deletions
diff --git a/src/daemon/caps.c b/src/daemon/caps.c index 707b5323..b5cbbc63 100644 --- a/src/daemon/caps.c +++ b/src/daemon/caps.c @@ -60,7 +60,7 @@ void pa_drop_root(void) { if (uid == 0 || geteuid() != 0) return; - pa_log_info(_("Dropping root priviliges.")); + pa_log_info(_("Dropping root privileges.")); #if defined(HAVE_SETRESUID) pa_assert_se(setresuid(uid, uid, uid) >= 0); diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c index fbd6dc32..cc3d714b 100644 --- a/src/daemon/cmdline.c +++ b/src/daemon/cmdline.c @@ -55,6 +55,9 @@ enum { ARG_MODULE_IDLE_TIME, ARG_SCACHE_IDLE_TIME, ARG_LOG_TARGET, + ARG_LOG_META, + ARG_LOG_TIME, + ARG_LOG_BACKTRACE, ARG_LOAD, ARG_FILE, ARG_DL_SEARCH_PATH, @@ -88,6 +91,9 @@ static const struct option long_options[] = { {"module-idle-time", 2, 0, ARG_MODULE_IDLE_TIME}, {"scache-idle-time", 2, 0, ARG_SCACHE_IDLE_TIME}, {"log-target", 1, 0, ARG_LOG_TARGET}, + {"log-meta", 2, 0, ARG_LOG_META}, + {"log-time", 2, 0, ARG_LOG_TIME}, + {"log-backtrace", 1, 0, ARG_LOG_BACKTRACE}, {"load", 1, 0, ARG_LOAD}, {"file", 1, 0, ARG_FILE}, {"dl-search-path", 1, 0, ARG_DL_SEARCH_PATH}, @@ -124,7 +130,7 @@ void pa_cmdline_help(const char *argv0) { " --cleanup-shm Cleanup stale shared memory segments\n" " --start Start the daemon if it is not running\n" " -k --kill Kill a running daemon\n" - " --check Check for a running daemon\n\n" + " --check Check for a running daemon (only returns exit code)\n\n" "OPTIONS:\n" " --system[=BOOL] Run as system-wide instance\n" @@ -148,6 +154,9 @@ void pa_cmdline_help(const char *argv0) { " --log-level[=LEVEL] Increase or set verbosity level\n" " -v Increase the verbosity level\n" " --log-target={auto,syslog,stderr} Specify the log target\n" + " --log-meta[=BOOL] Include code location in log messages\n" + " --log-time[=BOOL] Include timestamps in log messages\n" + " --log-backtrace=FRAMES Include a backtrace in log messages\n" " -p, --dl-search-path=PATH Set the search path for dynamic shared\n" " objects (plugins)\n" " --resample-method=METHOD Use the specified resampling method\n" @@ -321,6 +330,24 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d } break; + case ARG_LOG_TIME: + if ((conf->log_time = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) { + pa_log(_("--log-time boolean argument")); + goto fail; + } + break; + + case ARG_LOG_META: + if ((conf->log_meta = optarg ? pa_parse_boolean(optarg) : TRUE) < 0) { + pa_log(_("--log-meta boolean argument")); + goto fail; + } + break; + + case ARG_LOG_BACKTRACE: + conf->log_backtrace = (unsigned) atoi(optarg); + break; + case ARG_EXIT_IDLE_TIME: conf->exit_idle_time = atoi(optarg); break; diff --git a/src/daemon/cpulimit.c b/src/daemon/cpulimit.c index a909600e..5f24474d 100644 --- a/src/daemon/cpulimit.c +++ b/src/daemon/cpulimit.c @@ -167,7 +167,7 @@ static void callback(pa_mainloop_api*m, pa_io_event*e, int fd, pa_io_event_flags pa_assert(e == io_event); pa_assert(fd == the_pipe[0]); - pa_log("Recevied request to terminate due to CPU overload."); + pa_log("Received request to terminate due to CPU overload."); pa_read(the_pipe[0], &c, sizeof(c), NULL); m->quit(m, 1); /* Quit the main loop */ diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c index 939b25d7..d7ffc105 100644 --- a/src/daemon/daemon-conf.c +++ b/src/daemon/daemon-conf.c @@ -74,6 +74,9 @@ 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, @@ -399,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 }, @@ -431,6 +435,9 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) { { "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 }, @@ -467,98 +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->disable_lfe_remixing; - table[28].data = &c->load_default_script_file; - table[29].data = &c->shm_size; + 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[30].data = &c->rlimit_fsize; - table[31].data = &c->rlimit_data; - table[32].data = &c->rlimit_stack; - table[33].data = &c->rlimit_as; - table[34].data = &c->rlimit_core; - table[35].data = &c->rlimit_nofile; - table[36].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[37].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[38].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[39].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[40].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[41].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[42].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[43].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[44].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; @@ -674,6 +658,9 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) { 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); diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h index 90329268..04a4ebe7 100644 --- a/src/daemon/daemon-conf.h +++ b/src/daemon/daemon-conf.h @@ -68,7 +68,9 @@ typedef struct pa_daemon_conf { disable_remixing, disable_lfe_remixing, load_default_script_file, - disallow_exit; + disallow_exit, + log_meta, + log_time; int exit_idle_time, module_idle_time, scache_idle_time, @@ -79,6 +81,7 @@ typedef struct pa_daemon_conf { char *script_commands, *dl_search_path, *default_script_file; pa_log_target_t log_target; pa_log_level_t log_level; + unsigned log_backtrace; char *config_file; #ifdef HAVE_SYS_RESOURCE_H diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in index c672d420..00a95932 100644 --- a/src/daemon/daemon.conf.in +++ b/src/daemon/daemon.conf.in @@ -45,6 +45,9 @@ ; log-target = auto ; log-level = notice +; log-meta = no +; log-time = no +; log-backtrace = 0 ; resample-method = speex-float-3 ; disable-remixing = no diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in index 7032038d..7de4c071 100755 --- a/src/daemon/default.pa.in +++ b/src/daemon/default.pa.in @@ -29,6 +29,10 @@ .fail +### Automatically restore the volume of streams and devices +load-module module-device-restore +load-module module-stream-restore + ### Load audio drivers statically (it's probably better to not load ### these drivers manually, but instead use module-hal-detect -- ### see below -- for doing this automatically) @@ -72,9 +76,8 @@ load-module module-native-protocol-unix #load-module module-null-sink sink_name=rtp format=s16be channels=2 rate=44100 description="RTP Multicast Sink" #load-module module-rtp-send source=rtp.monitor -### Automatically restore the volume of streams and devices -load-module module-stream-restore -load-module module-device-restore +### Enable flat volumes where possible +load-module module-flat-volume ### Automatically restore the default sink/source when changed by the user during runtime load-module module-default-device-restore diff --git a/src/daemon/ltdl-bind-now.c b/src/daemon/ltdl-bind-now.c index 92e5d40d..8444cfb4 100644 --- a/src/daemon/ltdl-bind-now.c +++ b/src/daemon/ltdl-bind-now.c @@ -1,7 +1,7 @@ /*** This file is part of PulseAudio. - Copyright 2004-2006 Lennart Poettering + Copyright 2004-2008 Lennart Poettering Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB PulseAudio is free software; you can redistribute it and/or modify @@ -39,8 +39,6 @@ #include <pulse/i18n.h> #include <pulsecore/macro.h> -#include <pulsecore/mutex.h> -#include <pulsecore/thread.h> #include <pulsecore/log.h> #include "ltdl-bind-now.h" @@ -53,30 +51,6 @@ #undef PA_BIND_NOW #endif -#ifdef HAVE_LT_DLMUTEX_REGISTER - -static pa_mutex *libtool_mutex = NULL; - -static void libtool_lock(void) { - pa_mutex_lock(libtool_mutex); -} - -static void libtool_unlock(void) { - pa_mutex_unlock(libtool_mutex); -} - -#endif - -PA_STATIC_TLS_DECLARE_NO_FREE(libtool_tls); - -static void libtool_set_error(const char *error) { - PA_STATIC_TLS_SET(libtool_tls, (char*) error); -} - -static const char *libtool_get_error(void) { - return PA_STATIC_TLS_GET(libtool_tls); -} - #ifdef PA_BIND_NOW /* @@ -91,20 +65,13 @@ static const char *libtool_get_error(void) { to set $LT_BIND_NOW before starting the pulsaudio binary. */ -#ifndef HAVE_LT_DLADVISE -static lt_module bind_now_open(lt_user_data d, const char *fname) -#else -static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) -#endif -{ +static lt_module bind_now_open(lt_user_data d, const char *fname, lt_dladvise advise) { lt_module m; pa_assert(fname); if (!(m = dlopen(fname, PA_BIND_NOW))) { -#ifdef HAVE_LT_DLMUTEX_REGISTER - libtool_set_error(dlerror()); -#endif + lt_dlseterror(LT_ERROR_CANNOT_OPEN); return NULL; } @@ -116,9 +83,7 @@ static int bind_now_close(lt_user_data d, lt_module m) { pa_assert(m); if (dlclose(m) != 0){ -#ifdef HAVE_LT_DLMUTEX_REGISTER - libtool_set_error(dlerror()); -#endif + lt_dlseterror(LT_ERROR_CANNOT_CLOSE); return 1; } @@ -132,78 +97,61 @@ static lt_ptr bind_now_find_sym(lt_user_data d, lt_module m, const char *symbol) pa_assert(symbol); if (!(ptr = dlsym(m, symbol))) { -#ifdef HAVE_LT_DLMUTEX_REGISTER - libtool_set_error(dlerror()); -#endif + lt_dlseterror(LT_ERROR_SYMBOL_NOT_FOUND); return NULL; } return ptr; } +static lt_dlvtable *bindnow_loader = NULL; #endif void pa_ltdl_init(void) { #ifdef PA_BIND_NOW -# ifdef HAVE_STRUCT_LT_USER_DLLOADER - lt_dlloader *place; - static const struct lt_user_dlloader loader = { - .module_open = bind_now_open, - .module_close = bind_now_close, - .find_sym = bind_now_find_sym - }; -# else - static const lt_dlvtable *dlopen_loader; - static lt_dlvtable bindnow_loader; -# endif + const lt_dlvtable *dlopen_loader; #endif pa_assert_se(lt_dlinit() == 0); -#ifdef HAVE_LT_DLMUTEX_REGISTER - pa_assert_se(libtool_mutex = pa_mutex_new(TRUE, FALSE)); - pa_assert_se(lt_dlmutex_register(libtool_lock, libtool_unlock, libtool_set_error, libtool_get_error) == 0); -#endif - #ifdef PA_BIND_NOW -# ifdef HAVE_STRUCT_LT_USER_DLLOADER - - if (!(place = lt_dlloader_find("dlopen"))) - place = lt_dlloader_next(NULL); - - /* Add our BIND_NOW loader as the default module loader. */ - if (lt_dlloader_add(place, &loader, "bind-now-loader") != 0) - pa_log_warn(_("Failed to add bind-now-loader.")); -# else /* Already initialised */ - if (dlopen_loader) + if (bindnow_loader) return; - if (!(dlopen_loader = lt_dlloader_find("dlopen"))) { - pa_log_warn(_("Failed to find original dlopen loader.")); + if (!(dlopen_loader = lt_dlloader_find((char*) "lt_dlopen"))) { + pa_log_warn(_("Failed to find original lt_dlopen loader.")); return; } - memcpy(&bindnow_loader, dlopen_loader, sizeof(bindnow_loader)); - bindnow_loader.name = "bind-now-loader"; - bindnow_loader.module_open = bind_now_open; - bindnow_loader.module_close = bind_now_close; - bindnow_loader.find_sym = bind_now_find_sym; - bindnow_loader.priority = LT_DLLOADER_PREPEND; + if (!(bindnow_loader = malloc(sizeof(lt_dlvtable)))) { + pa_log_error(_("Failed to allocate new dl loader.")); + return; + } + + memcpy(bindnow_loader, dlopen_loader, sizeof(*bindnow_loader)); + bindnow_loader->name = "bind-now-loader"; + bindnow_loader->module_open = bind_now_open; + bindnow_loader->module_close = bind_now_close; + bindnow_loader->find_sym = bind_now_find_sym; + bindnow_loader->priority = LT_DLLOADER_PREPEND; /* Add our BIND_NOW loader as the default module loader. */ - if (lt_dlloader_add(&bindnow_loader) != 0) + if (lt_dlloader_add(bindnow_loader) != 0) { pa_log_warn(_("Failed to add bind-now-loader.")); -# endif + free(bindnow_loader); + bindnow_loader = NULL; + } #endif } void pa_ltdl_done(void) { pa_assert_se(lt_dlexit() == 0); -#ifdef HAVE_LT_DLMUTEX_REGISTER - pa_mutex_free(libtool_mutex); - libtool_mutex = NULL; +#ifdef PA_BIND_NOW + /* lt_dlexit() will free our loader vtable, hence reset our + * pointer to it here */ + bindnow_loader = NULL; #endif } diff --git a/src/daemon/main.c b/src/daemon/main.c index bc8bc63e..9c419efc 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -222,7 +222,7 @@ static int change_user(void) { #elif defined(HAVE_SETREGID) r = setregid(gr->gr_gid, gr->gr_gid); #else -#error "No API to drop priviliges" +#error "No API to drop privileges" #endif if (r < 0) { @@ -238,7 +238,7 @@ static int change_user(void) { #elif defined(HAVE_SETREUID) r = setreuid(pw->pw_uid, pw->pw_uid); #else -#error "No API to drop priviliges" +#error "No API to drop privileges" #endif if (r < 0) { @@ -382,7 +382,7 @@ int main(int argc, char *argv[]) { /* Drop all capabilities except CAP_SYS_NICE */ pa_limit_caps(); - /* Drop priviliges, but keep CAP_SYS_NICE */ + /* Drop privileges, but keep CAP_SYS_NICE */ pa_drop_root(); /* After dropping root, the effective set is reset, hence, @@ -428,10 +428,16 @@ int main(int argc, char *argv[]) { pa_log_set_maximal_level(conf->log_level); pa_log_set_target(conf->auto_log_target ? PA_LOG_STDERR : conf->log_target, NULL); + pa_log_set_show_meta(conf->log_meta); + pa_log_set_show_backtrace(conf->log_backtrace); + pa_log_set_show_time(conf->log_time); pa_log_debug("Started as real root: %s, suid root: %s", pa_yes_no(real_root), pa_yes_no(suid_root)); if (!real_root && pa_have_caps()) { +#ifdef HAVE_SYS_RESOURCE_H + struct rlimit rl; +#endif pa_bool_t allow_high_priority = FALSE, allow_realtime = FALSE; /* Let's better not enable high prio or RT by default */ @@ -474,12 +480,35 @@ int main(int argc, char *argv[]) { * let's give it up early */ pa_drop_caps(); - - if (conf->high_priority || conf->realtime_scheduling) - pa_log_notice(_("Called SUID root and real-time/high-priority scheduling was requested in the configuration. However, we lack the necessary priviliges:\n" - "We are not in group '"PA_REALTIME_GROUP"' and PolicyKit refuse to grant us priviliges. Dropping SUID again.\n" - "For enabling real-time scheduling please acquire the appropriate PolicyKit priviliges, or become a member of '"PA_REALTIME_GROUP"', or increase the RLIMIT_NICE/RLIMIT_RTPRIO resource limits for this user.")); } + +#ifdef RLIMIT_RTPRIO + if (getrlimit(RLIMIT_RTPRIO, &rl) >= 0) + if (rl.rlim_cur > 0) { + pa_log_info("RLIMIT_RTPRIO is set to %u, allowing real-time scheduling.", (unsigned) rl.rlim_cur); + allow_realtime = TRUE; + } +#endif +#ifdef RLIMIT_NICE + if (getrlimit(RLIMIT_NICE, &rl) >= 0) + if (rl.rlim_cur > 20 ) { + pa_log_info("RLIMIT_NICE is set to %u, allowing high-priority scheduling.", (unsigned) rl.rlim_cur); + allow_high_priority = TRUE; + } +#endif + + if ((conf->high_priority && !allow_high_priority) || + (conf->realtime_scheduling && !allow_realtime)) + pa_log_notice(_("Called SUID root and real-time and/or high-priority scheduling was requested in the configuration. However, we lack the necessary privileges:\n" + "We are not in group '"PA_REALTIME_GROUP"', PolicyKit refuse to grant us the requested privileges and we have no increase RLIMIT_NICE/RLIMIT_RTPRIO resource limits.\n" + "For enabling real-time/high-priority scheduling please acquire the appropriate PolicyKit privileges, or become a member of '"PA_REALTIME_GROUP"', or increase the RLIMIT_NICE/RLIMIT_RTPRIO resource limits for this user.")); + + + if (!allow_realtime) + conf->realtime_scheduling = FALSE; + + if (!allow_high_priority) + conf->high_priority = FALSE; } #ifdef HAVE_SYS_RESOURCE_H @@ -493,12 +522,16 @@ int main(int argc, char *argv[]) { set_all_rlimits(conf); #endif - if (conf->high_priority && !pa_can_high_priority()) + if (conf->high_priority && !pa_can_high_priority()) { pa_log_warn(_("High-priority scheduling enabled in configuration but not allowed by policy.")); + conf->high_priority = FALSE; + } if (conf->high_priority && (conf->cmd == PA_CMD_DAEMON || conf->cmd == PA_CMD_START)) pa_raise_priority(conf->nice_level); + pa_log_debug("Can realtime: %s, can high-priority: %s", pa_yes_no(pa_can_realtime()), pa_yes_no(pa_can_high_priority())); + if (!real_root && pa_have_caps()) { pa_bool_t drop; @@ -535,8 +568,10 @@ int main(int argc, char *argv[]) { } } - if (conf->realtime_scheduling && !pa_can_realtime()) + if (conf->realtime_scheduling && !pa_can_realtime()) { pa_log_warn(_("Real-time scheduling enabled in configuration but not allowed by policy.")); + conf->realtime_scheduling = FALSE; + } pa_log_debug("Can realtime: %s, can high-priority: %s", pa_yes_no(pa_can_realtime()), pa_yes_no(pa_can_high_priority())); @@ -577,6 +612,7 @@ int main(int argc, char *argv[]) { if (pa_resample_method_supported(i)) printf("%s\n", pa_resample_method_to_string(i)); + retval = 0; goto finish; } @@ -626,7 +662,7 @@ int main(int argc, char *argv[]) { if (real_root && !conf->system_instance) pa_log_warn(_("This program is not intended to be run as root (unless --system is specified).")); else if (!real_root && conf->system_instance) { - pa_log(_("Root priviliges required.")); + pa_log(_("Root privileges required.")); goto finish; } |