pa_random(&c->cookie, sizeof(c->cookie));
+#ifdef SIGPIPE
pa_check_signal_is_blocked(SIGPIPE);
+#endif
return c;
}
pa_log_info(__FILE__": Got signal %s.\n", pa_strsignal(sig));
switch (sig) {
+#ifdef SIGUSR1
case SIGUSR1:
pa_module_load(userdata, "module-cli", NULL);
break;
+#endif
+#ifdef SIGUSR2
case SIGUSR2:
pa_module_load(userdata, "module-cli-protocol-unix", NULL);
break;
+#endif
+#ifdef SIGHUP
case SIGHUP: {
char *c = pa_full_status_string(userdata);
pa_log_notice(c);
pa_xfree(c);
return;
}
+#endif
case SIGINT:
case SIGTERM:
open("/dev/null", O_WRONLY);
open("/dev/null", O_WRONLY);
+#ifdef SIGTTOU
signal(SIGTTOU, SIG_IGN);
+#endif
+#ifdef SIGTTIN
signal(SIGTTIN, SIG_IGN);
+#endif
+#ifdef SIGTSTP
signal(SIGTSTP, SIG_IGN);
+#endif
if ((tty_fd = open("/dev/tty", O_RDWR)) >= 0) {
ioctl(tty_fd, TIOCNOTTY, (char*) 0);
assert(r == 0);
pa_signal_new(SIGINT, signal_callback, c);
pa_signal_new(SIGTERM, signal_callback, c);
+#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
+#endif
c = pa_core_new(pa_mainloop_get_api(mainloop));
assert(c);
if (conf->daemonize)
c->running_as_daemon = 1;
+#ifdef SIGUSR1
pa_signal_new(SIGUSR1, signal_callback, c);
+#endif
+#ifdef SIGUSR2
pa_signal_new(SIGUSR2, signal_callback, c);
+#endif
+#ifdef SIGHUP
pa_signal_new(SIGHUP, signal_callback, c);
+#endif
r = pa_cpu_limit_init(pa_mainloop_get_api(mainloop));
assert(r == 0);
assert(r == 0);
pa_signal_new(SIGINT, exit_signal_callback, NULL);
pa_signal_new(SIGTERM, exit_signal_callback, NULL);
+#ifdef SIGUSR1
pa_signal_new(SIGUSR1, sigusr1_signal_callback, NULL);
+#endif
+#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
+#endif
if (!(stdio_event = mainloop_api->io_new(mainloop_api,
mode == PLAYBACK ? STDIN_FILENO : STDOUT_FILENO,
r = pa_signal_init(mainloop_api);
assert(r == 0);
pa_signal_new(SIGINT, exit_signal_callback, NULL);
+#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
+#endif
if (!(context = pa_context_new(mainloop_api, client_name))) {
fprintf(stderr, "pa_context_new() failed.\n");
r = pa_signal_init(mainloop_api);
assert(r == 0);
pa_signal_new(SIGINT, exit_signal_callback, NULL);
+#ifdef SIGPIPE
signal(SIGPIPE, SIG_IGN);
+#endif
/* Create a new connection context */
if (!(context = pa_context_new(mainloop_api, client_name))) {
c->autospawn_lock_fd = -1;
memset(&c->spawn_api, 0, sizeof(c->spawn_api));
c->do_autospawn = 0;
-
+
+#ifdef SIGPIPE
pa_check_signal_is_blocked(SIGPIPE);
+#endif
c->conf = pa_client_conf_new();
pa_client_conf_load(c->conf, NULL);
switch(sig) {
case SIGINT: return "SIGINT";
case SIGTERM: return "SIGTERM";
+#ifdef SIGUSR1
case SIGUSR1: return "SIGUSR1";
+#endif
+#ifdef SIGUSR2
case SIGUSR2: return "SIGUSR2";
+#endif
+#ifdef SIGXCPU
case SIGXCPU: return "SIGXCPU";
+#endif
+#ifdef SIGPIPE
case SIGPIPE: return "SIGPIPE";
+#endif
+#ifdef SIGCHLD
case SIGCHLD: return "SIGCHLD";
+#endif
+#ifdef SIGHUP
case SIGHUP: return "SIGHUP";
+#endif
default: return "UNKNOWN SIGNAL";
}
}