mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-12-30 11:08:50 -05:00
- Check process name when dealing with PID files
- Add new PA_STREAM_FIX_CHANNELS, FIX_RATE, FIX_FORMAT, DONT_MOVE, VARIABLE_RATES to pa_sream_flags_t adn implement it - Expose those flags in pacat - Add notifications about device suspend/resume to the protocol and expose them in libpulse - Allow changing of buffer_attr during playback - allow disabling for remixing globally - hookup polkit support git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@2067 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
4ac6b53478
commit
14a9b80afb
27 changed files with 1498 additions and 231 deletions
|
|
@ -42,6 +42,7 @@
|
|||
#endif
|
||||
|
||||
#include <pulse/xmalloc.h>
|
||||
#include <pulse/util.h>
|
||||
|
||||
#include <pulsecore/core-error.h>
|
||||
#include <pulsecore/core-util.h>
|
||||
|
|
@ -260,8 +261,8 @@ fail:
|
|||
* exists and the PID therein too. Returns 0 on succcess, -1
|
||||
* otherwise. If pid is non-NULL and a running daemon was found,
|
||||
* return its PID therein */
|
||||
int pa_pid_file_check_running(pid_t *pid) {
|
||||
return pa_pid_file_kill(0, pid);
|
||||
int pa_pid_file_check_running(pid_t *pid, const char *binary_name) {
|
||||
return pa_pid_file_kill(0, pid, binary_name);
|
||||
}
|
||||
|
||||
#ifndef OS_IS_WIN32
|
||||
|
|
@ -269,12 +270,14 @@ int pa_pid_file_check_running(pid_t *pid) {
|
|||
/* Kill a current running daemon. Return non-zero on success, -1
|
||||
* otherwise. If successful *pid contains the PID of the daemon
|
||||
* process. */
|
||||
int pa_pid_file_kill(int sig, pid_t *pid) {
|
||||
int pa_pid_file_kill(int sig, pid_t *pid, const char *binary_name) {
|
||||
int fd = -1;
|
||||
char fn[PATH_MAX];
|
||||
int ret = -1;
|
||||
pid_t _pid;
|
||||
|
||||
#ifdef __linux__
|
||||
char *e = NULL;
|
||||
#endif
|
||||
if (!pid)
|
||||
pid = &_pid;
|
||||
|
||||
|
|
@ -286,6 +289,23 @@ int pa_pid_file_kill(int sig, pid_t *pid) {
|
|||
if ((*pid = read_pid(fn, fd)) == (pid_t) -1)
|
||||
goto fail;
|
||||
|
||||
#ifdef __linux__
|
||||
if (binary_name) {
|
||||
pa_snprintf(fn, sizeof(fn), "/proc/%lu/exe", (unsigned long) pid);
|
||||
|
||||
if ((e = pa_readlink(fn))) {
|
||||
char *f = pa_path_get_filename(e);
|
||||
if (strcmp(f, binary_name)
|
||||
#if defined(__OPTIMIZE__)
|
||||
/* libtool likes to rename our binary names ... */
|
||||
&& !(pa_startswith(f, "lt-") && strcmp(f+3, binary_name) == 0)
|
||||
#endif
|
||||
)
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = kill(*pid, sig);
|
||||
|
||||
fail:
|
||||
|
|
@ -295,13 +315,17 @@ fail:
|
|||
pa_close(fd);
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
pa_xfree(e);
|
||||
#endif
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
#else /* OS_IS_WIN32 */
|
||||
|
||||
int pa_pid_file_kill(int sig, pid_t *pid) {
|
||||
int pa_pid_file_kill(int sig, pid_t *pid, const char *exe_name) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue