mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
update simple API
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@193 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
f05a4ac806
commit
b772564a4e
7 changed files with 153 additions and 11 deletions
25
polyp/util.c
25
polyp/util.c
|
|
@ -39,6 +39,7 @@
|
|||
#include <sys/time.h>
|
||||
#include <sched.h>
|
||||
#include <sys/resource.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include "util.h"
|
||||
#include "xmalloc.h"
|
||||
|
|
@ -322,3 +323,27 @@ int pa_fd_set_cloexec(int fd, int b) {
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
char *pa_get_binary_name(char *s, size_t l) {
|
||||
char path[PATH_MAX];
|
||||
int i;
|
||||
assert(s && l);
|
||||
|
||||
/* This works on Linux only */
|
||||
|
||||
snprintf(path, sizeof(path), "/proc/%u/exe", (unsigned) getpid());
|
||||
if ((i = readlink(path, s, l-1)) < 0)
|
||||
return NULL;
|
||||
|
||||
s[i] = 0;
|
||||
return s;
|
||||
}
|
||||
|
||||
char *pa_path_get_filename(const char *p) {
|
||||
char *fn;
|
||||
|
||||
if ((fn = strrchr(p, '/')))
|
||||
return fn+1;
|
||||
|
||||
return (char*) p;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue