mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-10 13:29:58 -05:00
try to use send(,,MSG_NOSIGNAL) instead of write() wherever possible (which
will allow us to drop the SIGPIPE check). Cache the results of the last write()/send() to make sure that we do not issue more than necessary system calls. git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1083 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
350a253dc5
commit
860be2e70b
17 changed files with 100 additions and 58 deletions
|
|
@ -111,7 +111,7 @@ static void reset_cpu_time(int t) {
|
|||
|
||||
/* A simple, thread-safe puts() work-alike */
|
||||
static void write_err(const char *p) {
|
||||
pa_loop_write(2, p, strlen(p));
|
||||
pa_loop_write(2, p, strlen(p), NULL);
|
||||
}
|
||||
|
||||
/* The signal handler, called on every SIGXCPU */
|
||||
|
|
@ -159,7 +159,7 @@ static void signal_handler(int sig) {
|
|||
static void callback(pa_mainloop_api*m, pa_io_event*e, int fd, pa_io_event_flags_t f, void *userdata) {
|
||||
char c;
|
||||
assert(m && e && f == PA_IO_EVENT_INPUT && e == io_event && fd == the_pipe[0]);
|
||||
read(the_pipe[0], &c, sizeof(c));
|
||||
pa_read(the_pipe[0], &c, sizeof(c), NULL);
|
||||
m->quit(m, 1); /* Quit the main loop */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ int main(int argc, char *argv[]) {
|
|||
close(daemon_pipe[1]);
|
||||
daemon_pipe[1] = -1;
|
||||
|
||||
if (pa_loop_read(daemon_pipe[0], &retval, sizeof(retval)) != sizeof(retval)) {
|
||||
if (pa_loop_read(daemon_pipe[0], &retval, sizeof(retval), NULL) != sizeof(retval)) {
|
||||
pa_log(__FILE__": read() failed: %s", pa_cstrerror(errno));
|
||||
retval = 1;
|
||||
}
|
||||
|
|
@ -368,7 +368,7 @@ int main(int argc, char *argv[]) {
|
|||
pa_log(__FILE__": pa_pid_file_create() failed.");
|
||||
#ifdef HAVE_FORK
|
||||
if (conf->daemonize)
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval));
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval), NULL);
|
||||
#endif
|
||||
goto finish;
|
||||
}
|
||||
|
|
@ -428,20 +428,20 @@ int main(int argc, char *argv[]) {
|
|||
pa_log(__FILE__": failed to initialize daemon.");
|
||||
#ifdef HAVE_FORK
|
||||
if (conf->daemonize)
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval));
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval), NULL);
|
||||
#endif
|
||||
} else if (!c->modules || pa_idxset_size(c->modules) == 0) {
|
||||
pa_log(__FILE__": daemon startup without any loaded modules, refusing to work.");
|
||||
#ifdef HAVE_FORK
|
||||
if (conf->daemonize)
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval));
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval), NULL);
|
||||
#endif
|
||||
} else {
|
||||
|
||||
retval = 0;
|
||||
#ifdef HAVE_FORK
|
||||
if (conf->daemonize)
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval));
|
||||
pa_loop_write(daemon_pipe[1], &retval, sizeof(retval), NULL);
|
||||
#endif
|
||||
|
||||
c->disallow_module_loading = conf->disallow_module_loading;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue