- add sample directory
- paman: show scache and sample size
- add timing parameter to write callback of stream in client API
-- add option for disabling module loading
** later ***
- xmlrpc/http
" -C Open a command line on the running TTY\n"
" -n Don't load configuration file (%s)\n"
" -D Daemonize after loading the modules\n"
+ " -d Disallow module loading after startup\n"
" -f Dont quit when the startup fails\n"
" -v Verbose startup\n"
" -h Show this help\n"
assert(argc && argv);
cmdline = pa_xmalloc(sizeof(struct pa_cmdline));
- cmdline->daemonize = cmdline->help = cmdline->verbose = cmdline->high_priority = cmdline->stay_root = cmdline->version = 0;
+ cmdline->daemonize =
+ cmdline->help =
+ cmdline->verbose =
+ cmdline->high_priority =
+ cmdline->stay_root =
+ cmdline->version =
+ cmdline->disallow_module_loading = 0;
cmdline->fail = 1;
buf = pa_strbuf_new();
assert(buf);
- while ((c = getopt(argc, argv, "L:F:CDhfvrRVn")) != -1) {
+ while ((c = getopt(argc, argv, "L:F:CDhfvrRVnd")) != -1) {
switch (c) {
case 'L':
pa_strbuf_printf(buf, "load %s\n", optarg);
cmdline->version = 1;
break;
case 'n':
- no_default_config_file =1;
+ no_default_config_file = 1;
+ break;
+ case 'd':
+ cmdline->disallow_module_loading = 1;
break;
-
default:
goto fail;
}
struct pa_cmdline {
- int daemonize, help, fail, verbose, high_priority, stay_root, version;
+ int daemonize, help, fail, verbose, high_priority, stay_root, version, disallow_module_loading;
char *cli_commands;
};
c->subscriptions = NULL;
c->memblock_stat = pa_memblock_stat_new();
+
+ c->disallow_module_loading = 0;
pa_check_for_sigpipe();
struct pa_subscription *subscriptions;
struct pa_memblock_stat *memblock_stat;
+
+ int disallow_module_loading;
};
struct pa_core* pa_core_new(struct pa_mainloop_api *m);
#include "cpulimit.h"
#include "util.h"
-/* Utilize this much CPU time at most */
+/* Utilize this much CPU time at maximum */
#define CPUTIME_PERCENT 70
#define CPUTIME_INTERVAL_SOFT (5)
if (phase == PHASE_IDLE) {
time_t now;
+
+#ifdef PRINT_CPU_LOAD
char t[256];
+#endif
time(&now);
+#ifdef PRINT_CPU_LOAD
snprintf(t, sizeof(t), "Using %0.1f%% CPU\n", (double)CPUTIME_INTERVAL_SOFT/(now-last_time)*100);
write_err(t);
+#endif
if (CPUTIME_INTERVAL_SOFT >= ((now-last_time)*(double)CPUTIME_PERCENT/100)) {
static const char c = 'X';
}
int pa_cpu_limit_init(struct pa_mainloop_api *m) {
- int r;
struct sigaction sa;
assert(m && !api && !io_event && the_pipe[0] == -1 && the_pipe[1] == -1);
sigemptyset(&sa.sa_mask);
sa.sa_flags = SA_RESTART;
- r = sigaction(SIGXCPU, &sa, &sigaction_prev);
- assert(r >= 0);
+ if (sigaction(SIGXCPU, &sa, &sigaction_prev) < 0) {
+ pa_cpu_limit_done();
+ return -1;
+ }
installed = 1;
retval = 0;
if (cmdline->daemonize)
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval));
+
+ c->disallow_module_loading = cmdline->disallow_module_loading;
+
fprintf(stderr, __FILE__": mainloop entry.\n");
if (pa_mainloop_run(mainloop, &retval) < 0)
retval = 1;
assert(c && name);
+ if (c->disallow_module_loading)
+ goto fail;
+
m = pa_xmalloc(sizeof(struct pa_module));
m->name = pa_xstrdup(name);