diff options
| author | Lennart Poettering <lennart@poettering.net> | 2007-09-11 23:12:24 +0000 |
|---|---|---|
| committer | Lennart Poettering <lennart@poettering.net> | 2007-09-11 23:12:24 +0000 |
| commit | 54506ab44a9ac61e79b3a5c632db56bde41beded (patch) | |
| tree | 2066264d7bdd45aa2495c0e3db04ddfb0d65b8bd /src/daemon | |
| parent | d5bedbcd98c10ef187f1daa326b32c6f3ba8d3af (diff) | |
on systems where we know that POSIX shm is mapped to /dev/shm, add the ability to cleanup stale SHM segments. (Right now only Linux)
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1810 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'src/daemon')
| -rw-r--r-- | src/daemon/cmdline.c | 9 | ||||
| -rw-r--r-- | src/daemon/daemon-conf.h | 3 | ||||
| -rw-r--r-- | src/daemon/main.c | 11 |
3 files changed, 19 insertions, 4 deletions
diff --git a/src/daemon/cmdline.c b/src/daemon/cmdline.c index a3f1ff03..d14002f6 100644 --- a/src/daemon/cmdline.c +++ b/src/daemon/cmdline.c @@ -64,7 +64,8 @@ enum { ARG_NO_CPU_LIMIT, ARG_DISABLE_SHM, ARG_DUMP_RESAMPLE_METHODS, - ARG_SYSTEM + ARG_SYSTEM, + ARG_CLEANUP_SHM }; /* Tabel for getopt_long() */ @@ -94,6 +95,7 @@ static struct option long_options[] = { {"no-cpu-limit", 2, 0, ARG_NO_CPU_LIMIT}, {"disable-shm", 2, 0, ARG_DISABLE_SHM}, {"dump-resample-methods", 2, 0, ARG_DUMP_RESAMPLE_METHODS}, + {"cleanup-shm", 2, 0, ARG_CLEANUP_SHM}, {NULL, 0, 0, 0} }; @@ -114,6 +116,7 @@ void pa_cmdline_help(const char *argv0) { " --dump-conf Dump default configuration\n" " --dump-modules Dump list of available modules\n" " --dump-resample-methods Dump available resample methods\n" + " --cleanup-shm Cleanup stale shared memory segments\n" " -k --kill Kill a running daemon\n" " --check Check for a running daemon\n\n" @@ -188,6 +191,10 @@ int pa_cmdline_parse(pa_daemon_conf *conf, int argc, char *const argv [], int *d case ARG_DUMP_RESAMPLE_METHODS: conf->cmd = PA_CMD_DUMP_RESAMPLE_METHODS; break; + + case ARG_CLEANUP_SHM: + conf->cmd = PA_CMD_CLEANUP_SHM; + break; case 'k': case ARG_KILL: diff --git a/src/daemon/daemon-conf.h b/src/daemon/daemon-conf.h index 76334271..4d37861d 100644 --- a/src/daemon/daemon-conf.h +++ b/src/daemon/daemon-conf.h @@ -41,7 +41,8 @@ typedef enum pa_daemon_conf_cmd { PA_CMD_DUMP_MODULES, PA_CMD_KILL, PA_CMD_CHECK, - PA_CMD_DUMP_RESAMPLE_METHODS + PA_CMD_DUMP_RESAMPLE_METHODS, + PA_CMD_CLEANUP_SHM } pa_daemon_conf_cmd_t; #ifdef HAVE_SYS_RESOURCE_H diff --git a/src/daemon/main.c b/src/daemon/main.c index 87f3f01d..4509e7f9 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -58,13 +58,12 @@ #include <tcpd.h> #endif -#include "../pulsecore/winsock.h" - #include <pulse/mainloop.h> #include <pulse/mainloop-signal.h> #include <pulse/timeval.h> #include <pulse/xmalloc.h> +#include <pulsecore/winsock.h> #include <pulsecore/core-error.h> #include <pulsecore/core.h> #include <pulsecore/memblock.h> @@ -83,6 +82,7 @@ #include <pulsecore/mutex.h> #include <pulsecore/thread.h> #include <pulsecore/once.h> +#include <pulsecore/shm.h> #include "cmdline.h" #include "cpulimit.h" @@ -496,6 +496,13 @@ int main(int argc, char *argv[]) { goto finish; + case PA_CMD_CLEANUP_SHM: + + if (pa_shm_cleanup() >= 0) + retval = 0; + + goto finish; + default: pa_assert(conf->cmd == PA_CMD_DAEMON); } |
