[pulseaudio-commits] [SCM] PulseAudio Sound Server branch, master, updated. v0.9.16-test4-35-g17d5741

Lennart Poettering gitmailer-noreply at 0pointer.de
Wed Aug 12 12:42:50 PDT 2009


This is an automated email from the git hooks/post-receive script. It was
generated because of a push to the "PulseAudio Sound Server" repository.

The master branch has been updated
      from  eb40da25d666b2dce9b69ae21cd36513eb885f61 (commit)

- Log -----------------------------------------------------------------
17d5741 start-child: clean up child environment a bit better
5fcb8a3 pacmd: port pacmd from select() to poll() so that we notice writer side hangups
286ab2f memblock: rate limit 'Pool full' message
5921324 context: document why we only do minimal cleanups before the autospawn exec()
27b8cd7 daemon: reset scheduling priority on startup, too
ef176ec core-util: move personality resetting into core-util
9f53aa5 daemon: unconditionally clean up priviliges
facae1f conf: invert all negative boolean configuration option
8998cba conf: add pa_config_parse_not_bool() for parsing inverse boolean configuration options
-----------------------------------------------------------------------

Summary of changes:
 man/pulse-client.conf.5.xml.in |    4 +-
 man/pulse-daemon.conf.5.xml.in |   59 ++++++++++++++++++++-------------------
 src/daemon/caps.c              |    7 +---
 src/daemon/daemon-conf.c       |   18 ++++++++----
 src/daemon/daemon.conf.in      |   12 ++++----
 src/daemon/main.c              |   11 +------
 src/pulse/client-conf.c        |   21 +++++++------
 src/pulse/client.conf.in       |    2 +-
 src/pulse/context.c            |    5 ++-
 src/pulsecore/conf-parser.c    |   24 ++++++++++++++++
 src/pulsecore/conf-parser.h    |    1 +
 src/pulsecore/core-util.c      |   13 ++++++++
 src/pulsecore/core-util.h      |    2 +
 src/pulsecore/memblock.c       |    3 +-
 src/pulsecore/start-child.c    |   15 +++++----
 src/utils/pacmd.c              |   60 ++++++++++++++++++++++++++-------------
 16 files changed, 160 insertions(+), 97 deletions(-)

-----------------------------------------------------------------------

commit 8998cba6839a46f11daec411c83a1b35723c5117
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 20:14:31 2009 +0200

    conf: add pa_config_parse_not_bool() for parsing inverse boolean configuration options

diff --git a/src/pulsecore/conf-parser.c b/src/pulsecore/conf-parser.c
index 2dc9a22..b4ab23c 100644
--- a/src/pulsecore/conf-parser.c
+++ b/src/pulsecore/conf-parser.c
@@ -278,6 +278,30 @@ int pa_config_parse_bool(const char *filename, unsigned line, const char *sectio
     return 0;
 }
 
+int pa_config_parse_not_bool(
+        const char *filename, unsigned line,
+        const char *section,
+        const char *lvalue, const char *rvalue,
+        void *data, void *userdata) {
+
+    int k;
+    pa_bool_t *b = data;
+
+    pa_assert(filename);
+    pa_assert(lvalue);
+    pa_assert(rvalue);
+    pa_assert(data);
+
+    if ((k = pa_parse_boolean(rvalue)) < 0) {
+        pa_log("[%s:%u] Failed to parse boolean value: %s", filename, line, rvalue);
+        return -1;
+    }
+
+    *b = !k;
+
+    return 0;
+}
+
 int pa_config_parse_string(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata) {
     char **s = data;
 
diff --git a/src/pulsecore/conf-parser.h b/src/pulsecore/conf-parser.h
index 08e17ca..c6c8a14 100644
--- a/src/pulsecore/conf-parser.h
+++ b/src/pulsecore/conf-parser.h
@@ -47,6 +47,7 @@ int pa_config_parse_int(const char *filename, unsigned line, const char *section
 int pa_config_parse_unsigned(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
 int pa_config_parse_size(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
 int pa_config_parse_bool(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
+int pa_config_parse_not_bool(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
 int pa_config_parse_string(const char *filename, unsigned line, const char *section, const char *lvalue, const char *rvalue, void *data, void *userdata);
 
 #endif

commit facae1f27504983d7eff7c7c3ffa864f7e002272
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 20:15:28 2009 +0200

    conf: invert all negative boolean configuration option

diff --git a/man/pulse-client.conf.5.xml.in b/man/pulse-client.conf.5.xml.in
index 26e3890..46cc845 100644
--- a/man/pulse-client.conf.5.xml.in
+++ b/man/pulse-client.conf.5.xml.in
@@ -92,9 +92,9 @@ USA.
     </option>
 
     <option>
-      <p><opt>disable-shm=</opt> Disable data transfer via POSIX
+      <p><opt>enable-shm=</opt> Enable data transfer via POSIX
       shared memory. Takes a boolean argument, defaults to
-      <opt>no</opt>.</p>
+      <opt>yes</opt>.</p>
     </option>
 
     <option>
diff --git a/man/pulse-daemon.conf.5.xml.in b/man/pulse-daemon.conf.5.xml.in
index f1d5b8f..82c2b8e 100644
--- a/man/pulse-daemon.conf.5.xml.in
+++ b/man/pulse-daemon.conf.5.xml.in
@@ -65,20 +65,21 @@ USA.
     </option>
 
     <option>
-      <p><opt>disallow-module-loading=</opt> Disallow module loading
-      after startup. This is a security feature that makes sure that
-      no further modules may be loaded into the PulseAudio server
-      after startup completed. It is recommended to enable this when
-      <opt>system-instance</opt> is enabled. Please note that certain
-      features like automatic hot-plug support will not work if this
-      option is enabled. Takes a boolean argument, defaults to
-      <opt>no</opt>. The <opt>--disallow-module-loading</opt> command line
-      option takes precedence.</p>
+      <p><opt>allow-module-loading=</opt> Allow/disallow module
+      loading after startup. This is a security feature that if
+      dsabled makes sure that no further modules may be loaded into
+      the PulseAudio server after startup completed. It is recommended
+      to disable this when <opt>system-instance</opt> is
+      enabled. Please note that certain features like automatic
+      hot-plug support will not work if this option is enabled. Takes
+      a boolean argument, defaults to <opt>yes</opt>. The
+      <opt>--disallow-module-loading</opt> command line option takes
+      precedence.</p>
     </option>
 
     <option>
-      <p><opt>disallow-exit=</opt> Disallow exit on user
-      request. Defaults to <opt>no</opt>.</p>
+      <p><opt>allow-exit=</opt> Allow/disallow exit on user
+      request. Defaults to <opt>yes</opt>.</p>
     </option>
 
     <option>
@@ -105,19 +106,19 @@ USA.
     </option>
 
     <option>
-      <p><opt>disable-remixing=</opt> Never upmix or downmix channels
-      to different channel maps. Instead, do a simple name-based
-      matching only.</p>
+      <p><opt>enable-remixing=</opt> If disabled never upmix or
+      downmix channels to different channel maps. Instead, do a simple
+      name-based matching only. Defaults to <opt>yes.</opt></p>
     </option>
 
     <option>
-      <p><opt>disable-lfe-remixing=</opt> When upmixing or downmixing
-      ignore LFE channels. When this option is on the output LFE
-      channel will only get a signal when an input LFE channel is
-      available as well. If no input LFE channel is available the
-      output LFE channel will always be 0. If no output LFE channel is
-      available the signal on the input LFE channel will be
-      ignored. Defaults to "on".</p>
+      <p><opt>enable-lfe-remixing=</opt> if disabeld when upmixing or
+      downmixing ignore LFE channels. When this option is dsabled the
+      output LFE channel will only get a signal when an input LFE
+      channel is available as well. If no input LFE channel is
+      available the output LFE channel will always be 0. If no output
+      LFE channel is available the signal on the input LFE channel
+      will be ignored. Defaults to <opt>no</opt>.</p>
     </option>
 
     <option>
@@ -132,12 +133,12 @@ USA.
     </option>
 
     <option>
-      <p><opt>no-cpu-limit=</opt> Do not install the CPU load limiter,
-      even on platforms where it is supported. This option is useful
-      when debugging/profiling PulseAudio to disable disturbing
-      SIGXCPU signals. Takes a boolean argument, defaults to <opt>no</opt>. The
-      <opt>--no-cpu-limit</opt> command line argument takes
-      precedence.</p>
+      <p><opt>cpu-limit=</opt> If disabled d not install the CPU load
+      limiter, even on platforms where it is supported. This option is
+      useful when debugging/profiling PulseAudio to disable disturbing
+      SIGXCPU signals. Takes a boolean argument, defaults to
+      <opt>yes</opt>. The <opt>--no-cpu-limit</opt> command line
+      argument takes precedence.</p>
     </option>
 
     <option>
@@ -148,9 +149,9 @@ USA.
     </option>
 
     <option>
-      <p><opt>disable-shm=</opt> Disable data transfer via POSIX
+      <p><opt>enable-shm=</opt> Enable data transfer via POSIX
       shared memory. Takes a boolean argument, defaults to
-      <opt>no</opt>. The <opt>--disable-shm</opt> command line
+      <opt>yes</opt>. The <opt>--disable-shm</opt> command line
       argument takes precedence.</p>
     </option>
 
diff --git a/src/daemon/daemon-conf.c b/src/daemon/daemon-conf.c
index 9010f2f..9a87b55 100644
--- a/src/daemon/daemon-conf.c
+++ b/src/daemon/daemon-conf.c
@@ -441,11 +441,15 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
         { "high-priority",              pa_config_parse_bool,     &c->high_priority, NULL },
         { "realtime-scheduling",        pa_config_parse_bool,     &c->realtime_scheduling, NULL },
         { "disallow-module-loading",    pa_config_parse_bool,     &c->disallow_module_loading, NULL },
+        { "allow-module-loading",       pa_config_parse_not_bool, &c->disallow_module_loading, NULL },
         { "disallow-exit",              pa_config_parse_bool,     &c->disallow_exit, NULL },
+        { "allow-exit",                 pa_config_parse_not_bool, &c->disallow_exit, NULL },
         { "use-pid-file",               pa_config_parse_bool,     &c->use_pid_file, NULL },
         { "system-instance",            pa_config_parse_bool,     &c->system_instance, NULL },
         { "no-cpu-limit",               pa_config_parse_bool,     &c->no_cpu_limit, NULL },
+        { "cpu-limit",                  pa_config_parse_not_bool, &c->no_cpu_limit, NULL },
         { "disable-shm",                pa_config_parse_bool,     &c->disable_shm, NULL },
+        { "enable-shm",                 pa_config_parse_not_bool, &c->disable_shm, NULL },
         { "flat-volumes",               pa_config_parse_bool,     &c->flat_volumes, NULL },
         { "lock-memory",                pa_config_parse_bool,     &c->lock_memory, NULL },
         { "exit-idle-time",             pa_config_parse_int,      &c->exit_idle_time, NULL },
@@ -465,7 +469,9 @@ int pa_daemon_conf_load(pa_daemon_conf *c, const char *filename) {
         { "default-fragment-size-msec", parse_fragment_size_msec, c, NULL },
         { "nice-level",                 parse_nice_level,         c, NULL },
         { "disable-remixing",           pa_config_parse_bool,     &c->disable_remixing, NULL },
+        { "enable-remixing",            pa_config_parse_not_bool, &c->disable_remixing, NULL },
         { "disable-lfe-remixing",       pa_config_parse_bool,     &c->disable_lfe_remixing, NULL },
+        { "enable-lfe-remixing",        pa_config_parse_not_bool, &c->disable_lfe_remixing, NULL },
         { "load-default-script-file",   pa_config_parse_bool,     &c->load_default_script_file, NULL },
         { "shm-size-bytes",             pa_config_parse_size,     &c->shm_size, NULL },
         { "log-meta",                   pa_config_parse_bool,     &c->log_meta, NULL },
@@ -623,12 +629,12 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
     pa_strbuf_printf(s, "nice-level = %i\n", c->nice_level);
     pa_strbuf_printf(s, "realtime-scheduling = %s\n", pa_yes_no(c->realtime_scheduling));
     pa_strbuf_printf(s, "realtime-priority = %i\n", c->realtime_priority);
-    pa_strbuf_printf(s, "disallow-module-loading = %s\n", pa_yes_no(c->disallow_module_loading));
-    pa_strbuf_printf(s, "disallow-exit = %s\n", pa_yes_no(c->disallow_exit));
+    pa_strbuf_printf(s, "allow-module-loading = %s\n", pa_yes_no(!c->disallow_module_loading));
+    pa_strbuf_printf(s, "allow-exit = %s\n", pa_yes_no(!c->disallow_exit));
     pa_strbuf_printf(s, "use-pid-file = %s\n", pa_yes_no(c->use_pid_file));
     pa_strbuf_printf(s, "system-instance = %s\n", pa_yes_no(c->system_instance));
-    pa_strbuf_printf(s, "no-cpu-limit = %s\n", pa_yes_no(c->no_cpu_limit));
-    pa_strbuf_printf(s, "disable-shm = %s\n", pa_yes_no(c->disable_shm));
+    pa_strbuf_printf(s, "cpu-limit = %s\n", pa_yes_no(!c->no_cpu_limit));
+    pa_strbuf_printf(s, "enable-shm = %s\n", pa_yes_no(!c->disable_shm));
     pa_strbuf_printf(s, "flat-volumes = %s\n", pa_yes_no(c->flat_volumes));
     pa_strbuf_printf(s, "lock-memory = %s\n", pa_yes_no(c->lock_memory));
     pa_strbuf_printf(s, "exit-idle-time = %i\n", c->exit_idle_time);
@@ -639,8 +645,8 @@ char *pa_daemon_conf_dump(pa_daemon_conf *c) {
     pa_strbuf_printf(s, "log-target = %s\n", c->auto_log_target ? "auto" : (c->log_target == PA_LOG_SYSLOG ? "syslog" : "stderr"));
     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, "enable-remixing = %s\n", pa_yes_no(!c->disable_remixing));
+    pa_strbuf_printf(s, "enable-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);
diff --git a/src/daemon/daemon.conf.in b/src/daemon/daemon.conf.in
index 6931359..d8b58d8 100644
--- a/src/daemon/daemon.conf.in
+++ b/src/daemon/daemon.conf.in
@@ -21,14 +21,14 @@
 
 ; daemonize = no
 ; fail = yes
-; disallow-module-loading = no
-; disallow-exit = no
+; allow-module-loading = yes
+; allow-exit = yes
 ; use-pid-file = yes
 ; system-instance = no
-; disable-shm = no
+; enable-shm = yes
 ; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB
 ; lock-memory = no
-; no-cpu-limit = no
+; cpu-limit = yes
 
 ; high-priority = yes
 ; nice-level = -11
@@ -51,8 +51,8 @@
 ; log-backtrace = 0
 
 ; resample-method = speex-float-3
-; disable-remixing = no
-; disable-lfe-remixing = yes
+; enable-remixing = yes
+; enable-lfe-remixing = no
 
 ; flat-volumes = yes
 
diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c
index 940d0b6..4aa4ba1 100644
--- a/src/pulse/client-conf.c
+++ b/src/pulse/client-conf.c
@@ -92,16 +92,17 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) {
 
     /* Prepare the configuration parse table */
     pa_config_item table[] = {
-        { "daemon-binary",          pa_config_parse_string,  &c->daemon_binary, NULL },
-        { "extra-arguments",        pa_config_parse_string,  &c->extra_arguments, NULL },
-        { "default-sink",           pa_config_parse_string,  &c->default_sink, NULL },
-        { "default-source",         pa_config_parse_string,  &c->default_source, NULL },
-        { "default-server",         pa_config_parse_string,  &c->default_server, NULL },
-        { "autospawn",              pa_config_parse_bool,    &c->autospawn, NULL },
-        { "cookie-file",            pa_config_parse_string,  &c->cookie_file, NULL },
-        { "disable-shm",            pa_config_parse_bool,    &c->disable_shm, NULL },
-        { "shm-size-bytes",         pa_config_parse_size,    &c->shm_size, NULL },
-        { NULL,                     NULL,                    NULL, NULL },
+        { "daemon-binary",          pa_config_parse_string,   &c->daemon_binary, NULL },
+        { "extra-arguments",        pa_config_parse_string,   &c->extra_arguments, NULL },
+        { "default-sink",           pa_config_parse_string,   &c->default_sink, NULL },
+        { "default-source",         pa_config_parse_string,   &c->default_source, NULL },
+        { "default-server",         pa_config_parse_string,   &c->default_server, NULL },
+        { "autospawn",              pa_config_parse_bool,     &c->autospawn, NULL },
+        { "cookie-file",            pa_config_parse_string,   &c->cookie_file, NULL },
+        { "disable-shm",            pa_config_parse_bool,     &c->disable_shm, NULL },
+        { "enable-shm",             pa_config_parse_not_bool, &c->disable_shm, NULL },
+        { "shm-size-bytes",         pa_config_parse_size,     &c->shm_size, NULL },
+        { NULL,                     NULL,                     NULL, NULL },
     };
 
     if (filename) {
diff --git a/src/pulse/client.conf.in b/src/pulse/client.conf.in
index 579bcc2..6c8d371 100644
--- a/src/pulse/client.conf.in
+++ b/src/pulse/client.conf.in
@@ -29,5 +29,5 @@
 
 ; cookie-file =
 
-; disable-shm = no
+; enable-shm = yes
 ; shm-size-bytes = 0 # setting this 0 will use the system-default, usually 64 MiB

commit 9f53aa5546e7bf9246546c6dda5637d50679483c
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 21:35:48 2009 +0200

    daemon: unconditionally clean up priviliges

diff --git a/src/daemon/caps.c b/src/daemon/caps.c
index 294be49..69e58cc 100644
--- a/src/daemon/caps.c
+++ b/src/daemon/caps.c
@@ -58,11 +58,8 @@ void pa_drop_root(void) {
 #ifdef HAVE_GETUID
     uid_t uid;
 
+    pa_log_debug(_("Cleaning up privileges."));
     uid = getuid();
-    if (uid == 0 || geteuid() != 0)
-        return;
-
-    pa_log_info(_("Dropping root privileges."));
 
 #if defined(HAVE_SETRESUID)
     pa_assert_se(setresuid(uid, uid, uid) >= 0);
@@ -82,7 +79,7 @@ void pa_drop_root(void) {
 #endif
 
 #ifdef HAVE_SYS_CAPABILITY_H
-    {
+    if (uid != 0) {
         cap_t caps;
         pa_assert_se(caps = cap_init());
         pa_assert_se(cap_clear(caps) == 0);

commit ef176ecb62a8f04bd14ca37e7c2a40469f0bb8ba
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 21:36:52 2009 +0200

    core-util: move personality resetting into core-util

diff --git a/src/daemon/main.c b/src/daemon/main.c
index 7a95195..355b0d5 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -65,10 +65,6 @@
 #include <dbus/dbus.h>
 #endif
 
-#ifdef __linux__
-#include <sys/personality.h>
-#endif
-
 #include <pulse/mainloop.h>
 #include <pulse/mainloop-signal.h>
 #include <pulse/timeval.h>
@@ -446,11 +442,7 @@ int main(int argc, char *argv[]) {
      * context we have been started. Let's cleanup our execution
      * context as good as possible */
 
-#ifdef __linux__
-    if (personality(PER_LINUX) < 0)
-        pa_log_warn("Uh, personality() failed: %s", pa_cstrerror(errno));
-#endif
-
+    pa_reset_personality();
     pa_drop_root();
     pa_close_all(passed_fd, -1);
     pa_reset_sigs(-1);
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index d4baf69..6494244 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -101,6 +101,10 @@
 #include "rtkit.h"
 #endif
 
+#ifdef __linux__
+#include <sys/personality.h>
+#endif
+
 #include <pulse/xmalloc.h>
 #include <pulse/util.h>
 #include <pulse/utf8.h>
@@ -2855,3 +2859,12 @@ size_t pa_pipe_buf(int fd) {
     return 4096;
 #endif
 }
+
+void pa_reset_personality(void) {
+
+#ifdef __linux__
+    if (personality(PER_LINUX) < 0)
+        pa_log_warn("Uh, personality() failed: %s", pa_cstrerror(errno));
+#endif
+
+}
diff --git a/src/pulsecore/core-util.h b/src/pulsecore/core-util.h
index 6de4b77..3d3aec7 100644
--- a/src/pulsecore/core-util.h
+++ b/src/pulsecore/core-util.h
@@ -241,4 +241,6 @@ char* pa_maybe_prefix_path(const char *path, const char *prefix);
 /* Returns size of the specified pipe or 4096 on failure */
 size_t pa_pipe_buf(int fd);
 
+void pa_reset_personality(void);
+
 #endif

commit 27b8cd783c2aedb23af8f88fc88632d5c4f387fd
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 21:37:40 2009 +0200

    daemon: reset scheduling priority on startup, too

diff --git a/src/daemon/main.c b/src/daemon/main.c
index 355b0d5..8521e72 100644
--- a/src/daemon/main.c
+++ b/src/daemon/main.c
@@ -447,6 +447,7 @@ int main(int argc, char *argv[]) {
     pa_close_all(passed_fd, -1);
     pa_reset_sigs(-1);
     pa_unblock_sigs(-1);
+    pa_reset_priority();
 
     setlocale(LC_ALL, "");
     pa_init_i18n();

commit 5921324fd3c16e2b3d38d07b200febd90835f169
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 21:40:12 2009 +0200

    context: document why we only do minimal cleanups before the autospawn exec()

diff --git a/src/pulse/context.c b/src/pulse/context.c
index 7c3717f..894ab2e 100644
--- a/src/pulse/context.c
+++ b/src/pulse/context.c
@@ -707,10 +707,13 @@ static int context_autospawn(pa_context *c) {
         if (c->spawn_api.atfork)
             c->spawn_api.atfork();
 
+        /* We leave most of the cleaning up of the process environment
+         * to the executable. We only clean up the file descriptors to
+         * make sure the executable can actually be loaded
+         * correctly. */
         pa_close_all(-1);
 
         /* Setup argv */
-
         argv[n++] = c->conf->daemon_binary;
         argv[n++] = "--start";
 

commit 286ab2f19370c7a0041897435614b2c6aadc8e70
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 21:40:38 2009 +0200

    memblock: rate limit 'Pool full' message

diff --git a/src/pulsecore/memblock.c b/src/pulsecore/memblock.c
index 3bc10de..441b397 100644
--- a/src/pulsecore/memblock.c
+++ b/src/pulsecore/memblock.c
@@ -258,7 +258,8 @@ static struct mempool_slot* mempool_allocate_slot(pa_mempool *p) {
             slot = (struct mempool_slot*) ((uint8_t*) p->memory.ptr + (p->block_size * (size_t) idx));
 
         if (!slot) {
-            pa_log_debug("Pool full");
+            if (pa_log_ratelimit())
+                pa_log_debug("Pool full");
             pa_atomic_inc(&p->stat.n_pool_full);
             return NULL;
         }

commit 5fcb8a3c0838a4ecdb00a0af09b6e1a358b114d0
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 21:42:02 2009 +0200

    pacmd: port pacmd from select() to poll() so that we notice writer side hangups

diff --git a/src/utils/pacmd.c b/src/utils/pacmd.c
index ac60a0b..e4d054b 100644
--- a/src/utils/pacmd.c
+++ b/src/utils/pacmd.c
@@ -25,7 +25,7 @@
 
 #include <assert.h>
 #include <signal.h>
-#include <sys/select.h>
+#include <sys/poll.h>
 #include <sys/socket.h>
 #include <unistd.h>
 #include <errno.h>
@@ -45,6 +45,13 @@
 
 int main(int argc, char*argv[]) {
 
+    enum {
+        WATCH_STDIN,
+        WATCH_STDOUT,
+        WATCH_SOCKET,
+        N_WATCH
+    };
+
     pid_t pid ;
     int fd = -1;
     int ret = 1, i;
@@ -53,6 +60,7 @@ int main(int argc, char*argv[]) {
     size_t ibuf_index, ibuf_length, obuf_index, obuf_length;
     char *cli;
     pa_bool_t ibuf_eof, obuf_eof, ibuf_closed, obuf_closed;
+    struct pollfd pollfd[N_WATCH];
 
     setlocale(LC_ALL, "");
     bindtextdomain(GETTEXT_PACKAGE, PULSE_LOCALEDIR);
@@ -120,38 +128,45 @@ int main(int argc, char*argv[]) {
         ibuf_eof = TRUE;
     }
 
-    for (;;) {
-        fd_set ifds, ofds;
+    pa_zero(pollfd);
 
+    pollfd[WATCH_STDIN].fd = STDIN_FILENO;
+    pollfd[WATCH_STDOUT].fd = STDOUT_FILENO;
+    pollfd[WATCH_SOCKET].fd = fd;
+
+    for (;;) {
         if (ibuf_eof &&
             obuf_eof &&
             ibuf_length <= 0 &&
             obuf_length <= 0)
             break;
 
-        FD_ZERO(&ifds);
-        FD_ZERO(&ofds);
+        pollfd[WATCH_STDIN].events = pollfd[WATCH_STDOUT].events = pollfd[WATCH_SOCKET].events = 0;
 
         if (obuf_length > 0)
-            FD_SET(1, &ofds);
+            pollfd[WATCH_STDOUT].events |= POLLOUT;
         else if (!obuf_eof)
-            FD_SET(fd, &ifds);
+            pollfd[WATCH_SOCKET].events |= POLLIN;
 
         if (ibuf_length > 0)
-            FD_SET(fd, &ofds);
+            pollfd[WATCH_SOCKET].events |= POLLOUT;
         else if (!ibuf_eof)
-            FD_SET(0, &ifds);
+            pollfd[WATCH_STDIN].events |= POLLIN;
 
-        if (select(FD_SETSIZE, &ifds, &ofds, NULL, NULL) < 0) {
-            pa_log(_("select(): %s"), strerror(errno));
+        if (poll(pollfd, N_WATCH, -1) < 0) {
+
+            if (errno == EINTR)
+                continue;
+
+            pa_log(_("poll(): %s"), strerror(errno));
             goto fail;
         }
 
-        if (FD_ISSET(0, &ifds)) {
+        if (pollfd[WATCH_STDIN].revents & POLLIN) {
             ssize_t r;
             pa_assert(!ibuf_length);
 
-            if ((r = pa_read(0, ibuf, sizeof(ibuf), NULL)) <= 0) {
+            if ((r = pa_read(STDIN_FILENO, ibuf, sizeof(ibuf), NULL)) <= 0) {
                 if (r < 0) {
                     pa_log(_("read(): %s"), strerror(errno));
                     goto fail;
@@ -164,7 +179,7 @@ int main(int argc, char*argv[]) {
             }
         }
 
-        if (FD_ISSET(fd, &ifds)) {
+        if (pollfd[WATCH_SOCKET].revents & POLLIN) {
             ssize_t r;
             pa_assert(!obuf_length);
 
@@ -181,21 +196,26 @@ int main(int argc, char*argv[]) {
             }
         }
 
-        if (FD_ISSET(1, &ofds)) {
+        if (pollfd[WATCH_STDOUT].revents & POLLHUP) {
+            obuf_eof = TRUE;
+            obuf_length = 0;
+        } else if (pollfd[WATCH_STDOUT].revents & POLLOUT) {
             ssize_t r;
             pa_assert(obuf_length);
 
-            if ((r = pa_write(1, obuf + obuf_index, obuf_length, NULL)) < 0) {
+            if ((r = pa_write(STDOUT_FILENO, obuf + obuf_index, obuf_length, NULL)) < 0) {
                 pa_log(_("write(): %s"), strerror(errno));
                 goto fail;
             }
 
             obuf_length -= (size_t) r;
             obuf_index += obuf_index;
-
         }
 
-        if (FD_ISSET(fd, &ofds)) {
+        if (pollfd[WATCH_SOCKET].revents & POLLHUP) {
+            ibuf_eof = TRUE;
+            ibuf_length = 0;
+        } if (pollfd[WATCH_SOCKET].revents & POLLOUT) {
             ssize_t r;
             pa_assert(ibuf_length);
 
@@ -209,14 +229,14 @@ int main(int argc, char*argv[]) {
         }
 
         if (ibuf_length <= 0 && ibuf_eof && !ibuf_closed) {
-            pa_close(0);
+            pa_close(STDIN_FILENO);
             shutdown(fd, SHUT_WR);
             ibuf_closed = TRUE;
         }
 
         if (obuf_length <= 0 && obuf_eof && !obuf_closed) {
             shutdown(fd, SHUT_RD);
-            pa_close(1);
+            pa_close(STDOUT_FILENO);
             obuf_closed = TRUE;
         }
     }

commit 17d57415f5abad5b7c30301227054b4c899bc705
Author: Lennart Poettering <lennart at poettering.net>
Date:   Wed Aug 12 21:43:06 2009 +0200

    start-child: clean up child environment a bit better

diff --git a/src/pulsecore/start-child.c b/src/pulsecore/start-child.c
index 7774bde..b3bce13 100644
--- a/src/pulsecore/start-child.c
+++ b/src/pulsecore/start-child.c
@@ -68,23 +68,24 @@ int pa_start_child_for_read(const char *name, const char *argv1, pid_t *pid) {
     } else {
         /* child */
 
-        pa_reset_priority();
+        pa_reset_personality();
 
         pa_assert_se(pa_close(pipe_fds[0]) == 0);
-        pa_assert_se(dup2(pipe_fds[1], 1) == 1);
+        pa_assert_se(dup2(pipe_fds[1], STDOUT_FILENO) == STDOUT_FILENO);
 
-        if (pipe_fds[1] != 1)
+        if (pipe_fds[1] != STDOUT_FILENO)
             pa_assert_se(pa_close(pipe_fds[1]) == 0);
 
-        pa_close(0);
-        pa_assert_se(open("/dev/null", O_RDONLY) == 0);
+        pa_close(STDIN_FILENO);
+        pa_assert_se(open("/dev/null", O_RDONLY) == STDIN_FILENO);
 
-        pa_close(2);
-        pa_assert_se(open("/dev/null", O_WRONLY) == 2);
+        pa_close(STDERR_FILENO);
+        pa_assert_se(open("/dev/null", O_WRONLY) == STDERR_FILENO);
 
         pa_close_all(-1);
         pa_reset_sigs(-1);
         pa_unblock_sigs(-1);
+        pa_reset_priority();
 
 #ifdef PR_SET_PDEATHSIG
         /* On Linux we can use PR_SET_PDEATHSIG to have the helper

-- 
hooks/post-receive
PulseAudio Sound Server



More information about the pulseaudio-commits mailing list