mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
add dependency script
fix some dependencies split off socket-util.c and clitext.c git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@60 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
c7bd759cdb
commit
ccfd55420e
28 changed files with 456 additions and 368 deletions
|
|
@ -35,6 +35,8 @@ pkglib_LTLIBRARIES=libiochannel.la \
|
||||||
libpstream-util.la \
|
libpstream-util.la \
|
||||||
libpdispatch.la \
|
libpdispatch.la \
|
||||||
libauthkey.la \
|
libauthkey.la \
|
||||||
|
libclitext.la \
|
||||||
|
libsocket-util.la \
|
||||||
libprotocol-simple.la \
|
libprotocol-simple.la \
|
||||||
libprotocol-esound.la \
|
libprotocol-esound.la \
|
||||||
libprotocol-native.la \
|
libprotocol-native.la \
|
||||||
|
|
@ -94,26 +96,27 @@ libprotocol_simple_la_LIBADD = libsocket-server.la libiochannel.la
|
||||||
|
|
||||||
libsocket_server_la_SOURCES = socket-server.c socket-server.h
|
libsocket_server_la_SOURCES = socket-server.c socket-server.h
|
||||||
libsocket_server_la_LDFLAGS = -avoid-version
|
libsocket_server_la_LDFLAGS = -avoid-version
|
||||||
libsocket_server_la_LIBADD = libiochannel.la
|
libsocket_server_la_LIBADD = libiochannel.la libsocket-util.la
|
||||||
|
|
||||||
libsocket_client_la_SOURCES = socket-client.c socket-client.h
|
libsocket_client_la_SOURCES = socket-client.c socket-client.h
|
||||||
libsocket_client_la_LDFLAGS = -avoid-version
|
libsocket_client_la_LDFLAGS = -avoid-version
|
||||||
libsocket_client_la_LIBADD = libiochannel.la
|
libsocket_client_la_LIBADD = libiochannel.la libsocket-util.la
|
||||||
|
|
||||||
libpstream_la_SOURCES = pstream.c pstream.h
|
libpstream_la_SOURCES = pstream.c pstream.h
|
||||||
libpstream_la_LDFLAGS = -avoid-version
|
libpstream_la_LDFLAGS = -avoid-version
|
||||||
libpstream_la_LIBADD = libpacket.la
|
libpstream_la_LIBADD = libpacket.la libiochannel.la
|
||||||
|
|
||||||
libpstream_util_la_SOURCES = pstream-util.c pstream-util.h
|
libpstream_util_la_SOURCES = pstream-util.c pstream-util.h
|
||||||
libpstream_util_la_LDFLAGS = -avoid-version
|
libpstream_util_la_LDFLAGS = -avoid-version
|
||||||
libpstream_util_la_LIBADD = libpstream.la libtagstruct.la
|
libpstream_util_la_LIBADD = libpacket.la libpstream.la libtagstruct.la
|
||||||
|
|
||||||
libpdispatch_la_SOURCES = pdispatch.c pdispatch.h
|
libpdispatch_la_SOURCES = pdispatch.c pdispatch.h
|
||||||
libpdispatch_la_LDFLAGS = -avoid-version
|
libpdispatch_la_LDFLAGS = -avoid-version
|
||||||
libpdispatch_la_LIBADD = libpacket.la libtagstruct.la
|
libpdispatch_la_LIBADD = libtagstruct.la
|
||||||
|
|
||||||
libiochannel_la_SOURCES = iochannel.c iochannel.h
|
libiochannel_la_SOURCES = iochannel.c iochannel.h
|
||||||
libiochannel_la_LDFLAGS = -avoid-version
|
libiochannel_la_LDFLAGS = -avoid-version
|
||||||
|
libiochannel_la_LIBDADD = libsocket-util.la
|
||||||
|
|
||||||
libpacket_la_SOURCES = packet.c packet.h
|
libpacket_la_SOURCES = packet.c packet.h
|
||||||
libpacket_la_LDFLAGS = -avoid-version
|
libpacket_la_LDFLAGS = -avoid-version
|
||||||
|
|
@ -127,7 +130,7 @@ libioline_la_LIBADD = libiochannel.la
|
||||||
|
|
||||||
libcli_la_SOURCES = cli.c cli.h
|
libcli_la_SOURCES = cli.c cli.h
|
||||||
libcli_la_LDFLAGS = -avoid-version
|
libcli_la_LDFLAGS = -avoid-version
|
||||||
libcli_la_LIBADD = libiochannel.la libioline.la
|
libcli_la_LIBADD = libiochannel.la libioline.la libclitext.la libtokenizer.la
|
||||||
|
|
||||||
libdynarray_la_SOURCES = dynarray.c dynarray.h
|
libdynarray_la_SOURCES = dynarray.c dynarray.h
|
||||||
libdynarray_la_LDFLAGS = -avoid-version
|
libdynarray_la_LDFLAGS = -avoid-version
|
||||||
|
|
@ -142,18 +145,24 @@ libprotocol_cli_la_LIBADD = libsocket-server.la libiochannel.la libcli.la
|
||||||
|
|
||||||
libprotocol_native_la_SOURCES = protocol-native.c protocol-native.h
|
libprotocol_native_la_SOURCES = protocol-native.c protocol-native.h
|
||||||
libprotocol_native_la_LDFLAGS = -avoid-version
|
libprotocol_native_la_LDFLAGS = -avoid-version
|
||||||
libprotocol_native_la_LIBADD = libsocket-server.la libiochannel.la libpacket.la libpstream.la libpstream-util.la libpdispatch.la libtagstruct.la libauthkey.la
|
libprotocol_native_la_LIBADD = libsocket-server.la libpstream.la libpstream-util.la libpdispatch.la libtagstruct.la libauthkey.la
|
||||||
|
|
||||||
libtagstruct_la_SOURCES = tagstruct.c tagstruct.h
|
libtagstruct_la_SOURCES = tagstruct.c tagstruct.h
|
||||||
libtagstruct_la_LDFLAGS = -avoid-version
|
libtagstruct_la_LDFLAGS = -avoid-version
|
||||||
|
|
||||||
libprotocol_esound_la_SOURCES = protocol-esound.c protocol-esound.h protocol-esound-spec.h
|
libprotocol_esound_la_SOURCES = protocol-esound.c protocol-esound.h esound-spec.h
|
||||||
libprotocol_esound_la_LDFLAGS = -avoid-version
|
libprotocol_esound_la_LDFLAGS = -avoid-version
|
||||||
libprotocol_esound_la_LIBADD = libsocket-server.la libiochannel.la libauthkey.la
|
libprotocol_esound_la_LIBADD = libsocket-server.la libiochannel.la libauthkey.la
|
||||||
|
|
||||||
libauthkey_la_SOURCES = authkey.c authkey.h
|
libauthkey_la_SOURCES = authkey.c authkey.h
|
||||||
libauthkey_la_LDFLAGS = -avoid-version
|
libauthkey_la_LDFLAGS = -avoid-version
|
||||||
|
|
||||||
|
libclitext_la_SOURCES = clitext.c clitext.h
|
||||||
|
libclitext_la_LDFLAGS = -avoid-version
|
||||||
|
|
||||||
|
libsocket_util_la_SOURCES = socket-util.c socket-util.h
|
||||||
|
libsocket_util_la_LDFLAGS = -avoid-version
|
||||||
|
|
||||||
module_simple_protocol_tcp_la_SOURCES = module-protocol-stub.c
|
module_simple_protocol_tcp_la_SOURCES = module-protocol-stub.c
|
||||||
module_simple_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
|
module_simple_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
|
||||||
module_simple_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
module_simple_protocol_tcp_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
@ -162,7 +171,7 @@ module_simple_protocol_tcp_la_LIBADD = libprotocol-simple.la libsocket-server.la
|
||||||
module_simple_protocol_unix_la_SOURCES = module-protocol-stub.c
|
module_simple_protocol_unix_la_SOURCES = module-protocol-stub.c
|
||||||
module_simple_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
|
module_simple_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
|
||||||
module_simple_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_simple_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
module_simple_protocol_unix_la_LIBADD = libprotocol-simple.la libsocket-server.la
|
module_simple_protocol_unix_la_LIBADD = libprotocol-simple.la libsocket-server.la libsocket-util.la
|
||||||
|
|
||||||
module_cli_protocol_tcp_la_SOURCES = module-protocol-stub.c
|
module_cli_protocol_tcp_la_SOURCES = module-protocol-stub.c
|
||||||
module_cli_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
|
module_cli_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
|
||||||
|
|
@ -172,7 +181,7 @@ module_cli_protocol_tcp_la_LIBADD = libprotocol-cli.la libsocket-server.la
|
||||||
module_cli_protocol_unix_la_SOURCES = module-protocol-stub.c
|
module_cli_protocol_unix_la_SOURCES = module-protocol-stub.c
|
||||||
module_cli_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
|
module_cli_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
|
||||||
module_cli_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_cli_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
module_cli_protocol_unix_la_LIBADD = libprotocol-cli.la libsocket-server.la
|
module_cli_protocol_unix_la_LIBADD = libprotocol-cli.la libsocket-server.la libsocket-util.la
|
||||||
|
|
||||||
module_native_protocol_tcp_la_SOURCES = module-protocol-stub.c
|
module_native_protocol_tcp_la_SOURCES = module-protocol-stub.c
|
||||||
module_native_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
|
module_native_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
|
||||||
|
|
@ -182,7 +191,7 @@ module_native_protocol_tcp_la_LIBADD = libprotocol-native.la libsocket-server.la
|
||||||
module_native_protocol_unix_la_SOURCES = module-protocol-stub.c
|
module_native_protocol_unix_la_SOURCES = module-protocol-stub.c
|
||||||
module_native_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
|
module_native_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
|
||||||
module_native_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_native_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
module_native_protocol_unix_la_LIBADD = libprotocol-native.la libsocket-server.la
|
module_native_protocol_unix_la_LIBADD = libprotocol-native.la libsocket-server.la libsocket-util.la
|
||||||
|
|
||||||
module_esound_protocol_tcp_la_SOURCES = module-protocol-stub.c
|
module_esound_protocol_tcp_la_SOURCES = module-protocol-stub.c
|
||||||
module_esound_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
|
module_esound_protocol_tcp_la_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
|
||||||
|
|
@ -192,7 +201,7 @@ module_esound_protocol_tcp_la_LIBADD = libprotocol-esound.la libsocket-server.la
|
||||||
module_esound_protocol_unix_la_SOURCES = module-protocol-stub.c
|
module_esound_protocol_unix_la_SOURCES = module-protocol-stub.c
|
||||||
module_esound_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
|
module_esound_protocol_unix_la_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
|
||||||
module_esound_protocol_unix_la_LDFLAGS = -module -avoid-version
|
module_esound_protocol_unix_la_LDFLAGS = -module -avoid-version
|
||||||
module_esound_protocol_unix_la_LIBADD = libprotocol-esound.la libsocket-server.la
|
module_esound_protocol_unix_la_LIBADD = libprotocol-esound.la libsocket-server.la libsocket-util.la
|
||||||
|
|
||||||
module_pipe_sink_la_SOURCES = module-pipe-sink.c
|
module_pipe_sink_la_SOURCES = module-pipe-sink.c
|
||||||
module_pipe_sink_la_LDFLAGS = -module -avoid-version
|
module_pipe_sink_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
@ -204,7 +213,7 @@ module_oss_la_LIBADD = libiochannel.la liboss-util.la
|
||||||
|
|
||||||
module_oss_mmap_la_SOURCES = module-oss-mmap.c
|
module_oss_mmap_la_SOURCES = module-oss-mmap.c
|
||||||
module_oss_mmap_la_LDFLAGS = -module -avoid-version
|
module_oss_mmap_la_LDFLAGS = -module -avoid-version
|
||||||
module_oss_mmap_la_LIBADD = libiochannel.la liboss-util.la
|
module_oss_mmap_la_LIBADD = liboss-util.la
|
||||||
|
|
||||||
module_cli_la_SOURCES = module-cli.c
|
module_cli_la_SOURCES = module-cli.c
|
||||||
module_cli_la_LDFLAGS = -module -avoid-version
|
module_cli_la_LDFLAGS = -module -avoid-version
|
||||||
|
|
@ -229,9 +238,9 @@ libpolyp_la_SOURCES = polyp.c polyp.h \
|
||||||
queue.c queue.h \
|
queue.c queue.h \
|
||||||
dynarray.c dynarray.h \
|
dynarray.c dynarray.h \
|
||||||
memchunk.c memchunk.h \
|
memchunk.c memchunk.h \
|
||||||
authkey.c authkey.h
|
authkey.c authkey.h \
|
||||||
|
socket-util.c socket-util.h
|
||||||
libpolyp_la_CFLAGS = $(AM_CFLAGS)
|
libpolyp_la_CFLAGS = $(AM_CFLAGS)
|
||||||
#libpolyp_la_LIBADD = libpolyp-error.la
|
|
||||||
|
|
||||||
libpolyp_error_la_SOURCES = polyp-error.c polyp-error.h
|
libpolyp_error_la_SOURCES = polyp-error.c polyp-error.h
|
||||||
libpolyp_error_la_CFLAGS = $(AM_CFLAGS)
|
libpolyp_error_la_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
@ -239,16 +248,15 @@ libpolyp_error_la_CFLAGS = $(AM_CFLAGS)
|
||||||
libpolyp_simple_la_SOURCES = simple.c simple.h
|
libpolyp_simple_la_SOURCES = simple.c simple.h
|
||||||
libpolyp_simple_la_CFLAGS = $(AM_CFLAGS)
|
libpolyp_simple_la_CFLAGS = $(AM_CFLAGS)
|
||||||
libpolyp_simple_la_LIBADD = libpolyp.la
|
libpolyp_simple_la_LIBADD = libpolyp.la
|
||||||
#libpolyp-error.la
|
|
||||||
|
|
||||||
pacat_SOURCES = pacat.c $(libpolyp_la_SOURCES) $(libpolyp_error_la_SOURCES)
|
pacat_SOURCES = pacat.c #$(libpolyp_la_SOURCES) $(libpolyp_error_la_SOURCES)
|
||||||
#pacat_LDADD = libpolyp.la
|
pacat_LDADD = libpolyp.la libpolyp-error.la
|
||||||
pacat_CFLAGS = $(AM_CFLAGS)
|
pacat_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
||||||
pacat_simple_SOURCES = pacat-simple.c $(libpolyp_la_SOURCES) $(libpolyp_simple_la_SOURCES) $(libpolyp_error_la_SOURCES)
|
pacat_simple_SOURCES = pacat-simple.c #$(libpolyp_la_SOURCES) $(libpolyp_simple_la_SOURCES) $(libpolyp_error_la_SOURCES)
|
||||||
#pacat_simple_LDADD = libpolyp-simple.la libpolyp-error.la
|
pacat_simple_LDADD = libpolyp-simple.la libpolyp-error.la
|
||||||
pacat_simple_CFLAGS = $(AM_CFLAGS)
|
pacat_simple_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
||||||
parec_simple_SOURCES = parec-simple.c $(libpolyp_la_SOURCES) $(libpolyp_simple_la_SOURCES) $(libpolyp_error_la_SOURCES)
|
parec_simple_SOURCES = parec-simple.c #$(libpolyp_la_SOURCES) $(libpolyp_simple_la_SOURCES) $(libpolyp_error_la_SOURCES)
|
||||||
#parec_simple_LDADD = libpolyp-simple.la libpolyp-error.la
|
parec_simple_LDADD = libpolyp-simple.la libpolyp-error.la
|
||||||
parec_simple_CFLAGS = $(AM_CFLAGS)
|
parec_simple_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@
|
||||||
#include "tokenizer.h"
|
#include "tokenizer.h"
|
||||||
#include "strbuf.h"
|
#include "strbuf.h"
|
||||||
#include "namereg.h"
|
#include "namereg.h"
|
||||||
|
#include "clitext.h"
|
||||||
|
|
||||||
struct pa_cli {
|
struct pa_cli {
|
||||||
struct pa_core *core;
|
struct pa_core *core;
|
||||||
|
|
|
||||||
23
src/client.c
23
src/client.c
|
|
@ -4,7 +4,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "strbuf.h"
|
|
||||||
|
|
||||||
struct pa_client *pa_client_new(struct pa_core *core, const char *protocol_name, char *name) {
|
struct pa_client *pa_client_new(struct pa_core *core, const char *protocol_name, char *name) {
|
||||||
struct pa_client *c;
|
struct pa_client *c;
|
||||||
|
|
@ -48,28 +47,6 @@ void pa_client_kill(struct pa_client *c) {
|
||||||
c->kill(c);
|
c->kill(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pa_client_list_to_string(struct pa_core *c) {
|
|
||||||
struct pa_strbuf *s;
|
|
||||||
struct pa_client *client;
|
|
||||||
uint32_t index = PA_IDXSET_INVALID;
|
|
||||||
assert(c);
|
|
||||||
|
|
||||||
s = pa_strbuf_new();
|
|
||||||
assert(s);
|
|
||||||
|
|
||||||
pa_strbuf_printf(s, "%u client(s).\n", pa_idxset_ncontents(c->clients));
|
|
||||||
|
|
||||||
for (client = pa_idxset_first(c->clients, &index); client; client = pa_idxset_next(c->clients, &index)) {
|
|
||||||
pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\tprotocol_name: <%s>\n", client->index, client->name, client->protocol_name);
|
|
||||||
|
|
||||||
if (client->owner)
|
|
||||||
pa_strbuf_printf(s, "\towner module: <%u>\n", client->owner->index);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pa_strbuf_tostring_free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void pa_client_rename(struct pa_client *c, const char *name) {
|
void pa_client_rename(struct pa_client *c, const char *name) {
|
||||||
assert(c);
|
assert(c);
|
||||||
free(c->name);
|
free(c->name);
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,6 @@ void pa_client_free(struct pa_client *c);
|
||||||
* request destruction of the client */
|
* request destruction of the client */
|
||||||
void pa_client_kill(struct pa_client *c);
|
void pa_client_kill(struct pa_client *c);
|
||||||
|
|
||||||
char *pa_client_list_to_string(struct pa_core *c);
|
|
||||||
|
|
||||||
void pa_client_rename(struct pa_client *c, const char *name);
|
void pa_client_rename(struct pa_client *c, const char *name);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
178
src/clitext.c
Normal file
178
src/clitext.c
Normal file
|
|
@ -0,0 +1,178 @@
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
#include "clitext.h"
|
||||||
|
#include "module.h"
|
||||||
|
#include "client.h"
|
||||||
|
#include "sink.h"
|
||||||
|
#include "source.h"
|
||||||
|
#include "sinkinput.h"
|
||||||
|
#include "sourceoutput.h"
|
||||||
|
#include "strbuf.h"
|
||||||
|
#include "sample-util.h"
|
||||||
|
|
||||||
|
char *pa_module_list_to_string(struct pa_core *c) {
|
||||||
|
struct pa_strbuf *s;
|
||||||
|
struct pa_module *m;
|
||||||
|
uint32_t index = PA_IDXSET_INVALID;
|
||||||
|
assert(c);
|
||||||
|
|
||||||
|
s = pa_strbuf_new();
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_ncontents(c->modules));
|
||||||
|
|
||||||
|
for (m = pa_idxset_first(c->modules, &index); m; m = pa_idxset_next(c->modules, &index))
|
||||||
|
pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\targument: <%s>\n", m->index, m->name, m->argument);
|
||||||
|
|
||||||
|
return pa_strbuf_tostring_free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *pa_client_list_to_string(struct pa_core *c) {
|
||||||
|
struct pa_strbuf *s;
|
||||||
|
struct pa_client *client;
|
||||||
|
uint32_t index = PA_IDXSET_INVALID;
|
||||||
|
assert(c);
|
||||||
|
|
||||||
|
s = pa_strbuf_new();
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
pa_strbuf_printf(s, "%u client(s).\n", pa_idxset_ncontents(c->clients));
|
||||||
|
|
||||||
|
for (client = pa_idxset_first(c->clients, &index); client; client = pa_idxset_next(c->clients, &index)) {
|
||||||
|
pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\tprotocol_name: <%s>\n", client->index, client->name, client->protocol_name);
|
||||||
|
|
||||||
|
if (client->owner)
|
||||||
|
pa_strbuf_printf(s, "\towner module: <%u>\n", client->owner->index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pa_strbuf_tostring_free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *pa_sink_list_to_string(struct pa_core *c) {
|
||||||
|
struct pa_strbuf *s;
|
||||||
|
struct pa_sink *sink, *default_sink;
|
||||||
|
uint32_t index = PA_IDXSET_INVALID;
|
||||||
|
assert(c);
|
||||||
|
|
||||||
|
s = pa_strbuf_new();
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
pa_strbuf_printf(s, "%u sink(s) available.\n", pa_idxset_ncontents(c->sinks));
|
||||||
|
|
||||||
|
default_sink = pa_sink_get_default(c);
|
||||||
|
|
||||||
|
for (sink = pa_idxset_first(c->sinks, &index); sink; sink = pa_idxset_next(c->sinks, &index)) {
|
||||||
|
char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH];
|
||||||
|
pa_sample_snprint(ss, sizeof(ss), &sink->sample_spec);
|
||||||
|
assert(sink->monitor_source);
|
||||||
|
pa_strbuf_printf(
|
||||||
|
s,
|
||||||
|
" %c index: %u\n\tname: <%s>\n\tvolume: <0x%04x>\n\tlatency: <%u usec>\n\tmonitor_source: <%u>\n\tsample_spec: <%s>\n",
|
||||||
|
sink == default_sink ? '*' : ' ',
|
||||||
|
sink->index, sink->name,
|
||||||
|
(unsigned) sink->volume,
|
||||||
|
pa_sink_get_latency(sink),
|
||||||
|
sink->monitor_source->index,
|
||||||
|
ss);
|
||||||
|
|
||||||
|
if (sink->owner)
|
||||||
|
pa_strbuf_printf(s, "\towner module: <%u>\n", sink->owner->index);
|
||||||
|
if (sink->description)
|
||||||
|
pa_strbuf_printf(s, "\tdescription: <%s>\n", sink->description);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pa_strbuf_tostring_free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *pa_source_list_to_string(struct pa_core *c) {
|
||||||
|
struct pa_strbuf *s;
|
||||||
|
struct pa_source *source, *default_source;
|
||||||
|
uint32_t index = PA_IDXSET_INVALID;
|
||||||
|
assert(c);
|
||||||
|
|
||||||
|
s = pa_strbuf_new();
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
pa_strbuf_printf(s, "%u source(s) available.\n", pa_idxset_ncontents(c->sources));
|
||||||
|
|
||||||
|
default_source = pa_source_get_default(c);
|
||||||
|
|
||||||
|
for (source = pa_idxset_first(c->sources, &index); source; source = pa_idxset_next(c->sources, &index)) {
|
||||||
|
char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH];
|
||||||
|
pa_sample_snprint(ss, sizeof(ss), &source->sample_spec);
|
||||||
|
pa_strbuf_printf(s, " %c index: %u\n\tname: <%s>\n\tsample_spec: <%s>\n", source == default_source ? '*' : ' ', source->index, source->name, ss);
|
||||||
|
|
||||||
|
if (source->monitor_of)
|
||||||
|
pa_strbuf_printf(s, "\tmonitor_of: <%u>\n", source->monitor_of->index);
|
||||||
|
if (source->owner)
|
||||||
|
pa_strbuf_printf(s, "\towner module: <%u>\n", source->owner->index);
|
||||||
|
if (source->description)
|
||||||
|
pa_strbuf_printf(s, "\tdescription: <%s>\n", source->description);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pa_strbuf_tostring_free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
char *pa_source_output_list_to_string(struct pa_core *c) {
|
||||||
|
struct pa_strbuf *s;
|
||||||
|
struct pa_source_output *o;
|
||||||
|
uint32_t index = PA_IDXSET_INVALID;
|
||||||
|
assert(c);
|
||||||
|
|
||||||
|
s = pa_strbuf_new();
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
pa_strbuf_printf(s, "%u source outputs(s) available.\n", pa_idxset_ncontents(c->source_outputs));
|
||||||
|
|
||||||
|
for (o = pa_idxset_first(c->source_outputs, &index); o; o = pa_idxset_next(c->source_outputs, &index)) {
|
||||||
|
char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH];
|
||||||
|
pa_sample_snprint(ss, sizeof(ss), &o->sample_spec);
|
||||||
|
assert(o->source);
|
||||||
|
pa_strbuf_printf(
|
||||||
|
s, " index: %u\n\tname: <%s>\n\tsource: <%u>\n\tsample_spec: <%s>\n",
|
||||||
|
o->index,
|
||||||
|
o->name,
|
||||||
|
o->source->index,
|
||||||
|
ss);
|
||||||
|
if (o->owner)
|
||||||
|
pa_strbuf_printf(s, "\towner module: <%u>\n", o->owner->index);
|
||||||
|
if (o->client)
|
||||||
|
pa_strbuf_printf(s, "\tclient: <%u>\n", o->client->index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pa_strbuf_tostring_free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *pa_sink_input_list_to_string(struct pa_core *c) {
|
||||||
|
struct pa_strbuf *s;
|
||||||
|
struct pa_sink_input *i;
|
||||||
|
uint32_t index = PA_IDXSET_INVALID;
|
||||||
|
assert(c);
|
||||||
|
|
||||||
|
s = pa_strbuf_new();
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
pa_strbuf_printf(s, "%u sink input(s) available.\n", pa_idxset_ncontents(c->sink_inputs));
|
||||||
|
|
||||||
|
for (i = pa_idxset_first(c->sink_inputs, &index); i; i = pa_idxset_next(c->sink_inputs, &index)) {
|
||||||
|
char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH];
|
||||||
|
pa_sample_snprint(ss, sizeof(ss), &i->sample_spec);
|
||||||
|
assert(i->sink);
|
||||||
|
pa_strbuf_printf(
|
||||||
|
s, " index: %u\n\tname: <%s>\n\tsink: <%u>\n\tvolume: <0x%04x>\n\tlatency: <%u usec>\n\tsample_spec: <%s>\n",
|
||||||
|
i->index,
|
||||||
|
i->name,
|
||||||
|
i->sink->index,
|
||||||
|
(unsigned) i->volume,
|
||||||
|
pa_sink_input_get_latency(i),
|
||||||
|
ss);
|
||||||
|
|
||||||
|
if (i->owner)
|
||||||
|
pa_strbuf_printf(s, "\towner module: <%u>\n", i->owner->index);
|
||||||
|
if (i->client)
|
||||||
|
pa_strbuf_printf(s, "\tclient: <%u>\n", i->client->index);
|
||||||
|
}
|
||||||
|
|
||||||
|
return pa_strbuf_tostring_free(s);
|
||||||
|
}
|
||||||
14
src/clitext.h
Normal file
14
src/clitext.h
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
#ifndef fooclitexthfoo
|
||||||
|
#define fooclitexthfoo
|
||||||
|
|
||||||
|
#include "core.h"
|
||||||
|
|
||||||
|
char *pa_sink_input_list_to_string(struct pa_core *c);
|
||||||
|
char *pa_source_output_list_to_string(struct pa_core *c);
|
||||||
|
char *pa_sink_list_to_string(struct pa_core *core);
|
||||||
|
char *pa_source_list_to_string(struct pa_core *c);
|
||||||
|
char *pa_client_list_to_string(struct pa_core *c);
|
||||||
|
char *pa_module_list_to_string(struct pa_core *c);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
56
src/depmod.py
Executable file
56
src/depmod.py
Executable file
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# $Id$
|
||||||
|
|
||||||
|
import sys, os, string
|
||||||
|
|
||||||
|
exported_symbols = {}
|
||||||
|
imported_symbols = {}
|
||||||
|
|
||||||
|
for fn in sys.argv[1:]:
|
||||||
|
f = os.popen("nm '%s'" % fn, "r")
|
||||||
|
|
||||||
|
imported_symbols[fn] = []
|
||||||
|
|
||||||
|
for line in f:
|
||||||
|
sym_address = line[:7].strip()
|
||||||
|
sym_type = line[9].strip()
|
||||||
|
sym_name = line[11:].strip()
|
||||||
|
|
||||||
|
if sym_name in ('_fini', '_init'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
if sym_type in ('T', 'B', 'R', 'D' 'G', 'S', 'D'):
|
||||||
|
if exported_symbols.has_key(sym_name):
|
||||||
|
sys.stderr.write("CONFLICT: %s defined in both '%s' and '%s'.\n" % (sym_name, fn, exported_symbols[sym_name]))
|
||||||
|
else:
|
||||||
|
exported_symbols[sym_name] = fn
|
||||||
|
elif sym_type in ('U',):
|
||||||
|
if sym_name[:3] == 'pa_':
|
||||||
|
imported_symbols[fn].append(sym_name)
|
||||||
|
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
dependencies = {}
|
||||||
|
unresolved_symbols = {}
|
||||||
|
|
||||||
|
for fn in imported_symbols:
|
||||||
|
dependencies[fn] = []
|
||||||
|
|
||||||
|
for sym in imported_symbols[fn]:
|
||||||
|
if exported_symbols.has_key(sym):
|
||||||
|
if exported_symbols[sym] not in dependencies[fn]:
|
||||||
|
dependencies[fn].append(exported_symbols[sym])
|
||||||
|
else:
|
||||||
|
if unresolved_symbols.has_key(sym):
|
||||||
|
unresolved_symbols[sym].append(fn)
|
||||||
|
else:
|
||||||
|
unresolved_symbols[sym] = [fn]
|
||||||
|
|
||||||
|
for sym, files in unresolved_symbols.iteritems():
|
||||||
|
print "WARNING: Unresolved symbol '%s' in %s" % (sym, `files`)
|
||||||
|
|
||||||
|
k = dependencies.keys()
|
||||||
|
k.sort()
|
||||||
|
for fn in k:
|
||||||
|
dependencies[fn].sort()
|
||||||
|
print "%s: %s" % (fn, string.join(dependencies[fn], " "))
|
||||||
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
#include "iochannel.h"
|
#include "iochannel.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "socket-util.h"
|
||||||
|
|
||||||
struct pa_iochannel {
|
struct pa_iochannel {
|
||||||
int ifd, ofd;
|
int ifd, ofd;
|
||||||
|
|
@ -182,7 +183,7 @@ void pa_iochannel_set_noclose(struct pa_iochannel*io, int b) {
|
||||||
|
|
||||||
void pa_iochannel_socket_peer_to_string(struct pa_iochannel*io, char*s, size_t l) {
|
void pa_iochannel_socket_peer_to_string(struct pa_iochannel*io, char*s, size_t l) {
|
||||||
assert(io && s && l);
|
assert(io && s && l);
|
||||||
pa_peer_to_string(s, l, io->ifd);
|
pa_socket_peer_to_string(io->ifd, s, l);
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_iochannel_socket_set_rcvbuf(struct pa_iochannel *io, size_t l) {
|
int pa_iochannel_socket_set_rcvbuf(struct pa_iochannel *io, size_t l) {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include "socket-server.h"
|
#include "socket-server.h"
|
||||||
|
#include "socket-util.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#ifdef USE_PROTOCOL_SIMPLE
|
#ifdef USE_PROTOCOL_SIMPLE
|
||||||
|
|
|
||||||
19
src/module.c
19
src/module.c
|
|
@ -6,7 +6,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "module.h"
|
#include "module.h"
|
||||||
#include "strbuf.h"
|
|
||||||
|
|
||||||
struct pa_module* pa_module_load(struct pa_core *c, const char *name, const char *argument) {
|
struct pa_module* pa_module_load(struct pa_core *c, const char *name, const char *argument) {
|
||||||
struct pa_module *m = NULL;
|
struct pa_module *m = NULL;
|
||||||
|
|
@ -112,24 +111,6 @@ void pa_module_unload_all(struct pa_core *c) {
|
||||||
c->modules = NULL;
|
c->modules = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pa_module_list_to_string(struct pa_core *c) {
|
|
||||||
struct pa_strbuf *s;
|
|
||||||
struct pa_module *m;
|
|
||||||
uint32_t index = PA_IDXSET_INVALID;
|
|
||||||
assert(c);
|
|
||||||
|
|
||||||
s = pa_strbuf_new();
|
|
||||||
assert(s);
|
|
||||||
|
|
||||||
pa_strbuf_printf(s, "%u module(s) loaded.\n", pa_idxset_ncontents(c->modules));
|
|
||||||
|
|
||||||
for (m = pa_idxset_first(c->modules, &index); m; m = pa_idxset_next(c->modules, &index))
|
|
||||||
pa_strbuf_printf(s, " index: %u\n\tname: <%s>\n\targument: <%s>\n", m->index, m->name, m->argument);
|
|
||||||
|
|
||||||
return pa_strbuf_tostring_free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
struct once_info {
|
struct once_info {
|
||||||
struct pa_core *core;
|
struct pa_core *core;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,8 @@ void pa_module_unload_by_index(struct pa_core *c, uint32_t index);
|
||||||
|
|
||||||
void pa_module_unload_all(struct pa_core *c);
|
void pa_module_unload_all(struct pa_core *c);
|
||||||
|
|
||||||
char *pa_module_list_to_string(struct pa_core *c);
|
|
||||||
|
|
||||||
void pa_module_unload_request(struct pa_core *c, struct pa_module *m);
|
void pa_module_unload_request(struct pa_core *c, struct pa_module *m);
|
||||||
|
|
||||||
|
|
||||||
/* These to following prototypes are for module entrypoints and not implemented by the core */
|
/* These to following prototypes are for module entrypoints and not implemented by the core */
|
||||||
int pa_module_init(struct pa_core *c, struct pa_module*m);
|
int pa_module_init(struct pa_core *c, struct pa_module*m);
|
||||||
void pa_module_done(struct pa_core *c, struct pa_module*m);
|
void pa_module_done(struct pa_core *c, struct pa_module*m);
|
||||||
|
|
|
||||||
|
|
@ -660,7 +660,7 @@ static void io_callback(struct pa_iochannel*io, void *userdata) {
|
||||||
|
|
||||||
/*** fixed callback ***/
|
/*** fixed callback ***/
|
||||||
|
|
||||||
void fixed_callback(struct pa_mainloop_api*a, void *id, void *userdata) {
|
static void fixed_callback(struct pa_mainloop_api*a, void *id, void *userdata) {
|
||||||
struct connection *c = userdata;
|
struct connection *c = userdata;
|
||||||
assert(a && c && c->fixed_source == id);
|
assert(a && c && c->fixed_source == id);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,7 @@ static void io_callback(struct pa_iochannel*io, void *userdata) {
|
||||||
|
|
||||||
/*** fixed callback ***/
|
/*** fixed callback ***/
|
||||||
|
|
||||||
void fixed_callback(struct pa_mainloop_api*a, void *id, void *userdata) {
|
static void fixed_callback(struct pa_mainloop_api*a, void *id, void *userdata) {
|
||||||
struct connection *c = userdata;
|
struct connection *c = userdata;
|
||||||
assert(a && c && c->fixed_source == id);
|
assert(a && c && c->fixed_source == id);
|
||||||
|
|
||||||
|
|
|
||||||
39
src/sink.c
39
src/sink.c
|
|
@ -5,10 +5,9 @@
|
||||||
|
|
||||||
#include "sink.h"
|
#include "sink.h"
|
||||||
#include "sinkinput.h"
|
#include "sinkinput.h"
|
||||||
#include "strbuf.h"
|
|
||||||
#include "sample-util.h"
|
|
||||||
#include "namereg.h"
|
#include "namereg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include "sample-util.h"
|
||||||
|
|
||||||
#define MAX_MIX_CHANNELS 32
|
#define MAX_MIX_CHANNELS 32
|
||||||
|
|
||||||
|
|
@ -260,42 +259,6 @@ struct pa_sink* pa_sink_get_default(struct pa_core *c) {
|
||||||
return sink;
|
return sink;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pa_sink_list_to_string(struct pa_core *c) {
|
|
||||||
struct pa_strbuf *s;
|
|
||||||
struct pa_sink *sink, *default_sink;
|
|
||||||
uint32_t index = PA_IDXSET_INVALID;
|
|
||||||
assert(c);
|
|
||||||
|
|
||||||
s = pa_strbuf_new();
|
|
||||||
assert(s);
|
|
||||||
|
|
||||||
pa_strbuf_printf(s, "%u sink(s) available.\n", pa_idxset_ncontents(c->sinks));
|
|
||||||
|
|
||||||
default_sink = pa_sink_get_default(c);
|
|
||||||
|
|
||||||
for (sink = pa_idxset_first(c->sinks, &index); sink; sink = pa_idxset_next(c->sinks, &index)) {
|
|
||||||
char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH];
|
|
||||||
pa_sample_snprint(ss, sizeof(ss), &sink->sample_spec);
|
|
||||||
assert(sink->monitor_source);
|
|
||||||
pa_strbuf_printf(
|
|
||||||
s,
|
|
||||||
" %c index: %u\n\tname: <%s>\n\tvolume: <0x%04x>\n\tlatency: <%u usec>\n\tmonitor_source: <%u>\n\tsample_spec: <%s>\n",
|
|
||||||
sink == default_sink ? '*' : ' ',
|
|
||||||
sink->index, sink->name,
|
|
||||||
(unsigned) sink->volume,
|
|
||||||
pa_sink_get_latency(sink),
|
|
||||||
sink->monitor_source->index,
|
|
||||||
ss);
|
|
||||||
|
|
||||||
if (sink->owner)
|
|
||||||
pa_strbuf_printf(s, "\towner module: <%u>\n", sink->owner->index);
|
|
||||||
if (sink->description)
|
|
||||||
pa_strbuf_printf(s, "\tdescription: <%s>\n", sink->description);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pa_strbuf_tostring_free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pa_sink_set_owner(struct pa_sink *sink, struct pa_module *m) {
|
void pa_sink_set_owner(struct pa_sink *sink, struct pa_module *m) {
|
||||||
sink->owner = m;
|
sink->owner = m;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,8 +39,6 @@ uint32_t pa_sink_get_latency(struct pa_sink *s);
|
||||||
|
|
||||||
void pa_sink_notify(struct pa_sink*s);
|
void pa_sink_notify(struct pa_sink*s);
|
||||||
|
|
||||||
char *pa_sink_list_to_string(struct pa_core *core);
|
|
||||||
|
|
||||||
struct pa_sink* pa_sink_get_default(struct pa_core *c);
|
struct pa_sink* pa_sink_get_default(struct pa_core *c);
|
||||||
|
|
||||||
void pa_sink_set_owner(struct pa_sink *sink, struct pa_module *m);
|
void pa_sink_set_owner(struct pa_sink *sink, struct pa_module *m);
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "sinkinput.h"
|
#include "sinkinput.h"
|
||||||
#include "strbuf.h"
|
|
||||||
#include "sample-util.h"
|
#include "sample-util.h"
|
||||||
|
|
||||||
#define CONVERT_BUFFER_LENGTH 4096
|
#define CONVERT_BUFFER_LENGTH 4096
|
||||||
|
|
@ -75,39 +74,6 @@ void pa_sink_input_kill(struct pa_sink_input*i) {
|
||||||
i->kill(i);
|
i->kill(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pa_sink_input_list_to_string(struct pa_core *c) {
|
|
||||||
struct pa_strbuf *s;
|
|
||||||
struct pa_sink_input *i;
|
|
||||||
uint32_t index = PA_IDXSET_INVALID;
|
|
||||||
assert(c);
|
|
||||||
|
|
||||||
s = pa_strbuf_new();
|
|
||||||
assert(s);
|
|
||||||
|
|
||||||
pa_strbuf_printf(s, "%u sink input(s) available.\n", pa_idxset_ncontents(c->sink_inputs));
|
|
||||||
|
|
||||||
for (i = pa_idxset_first(c->sink_inputs, &index); i; i = pa_idxset_next(c->sink_inputs, &index)) {
|
|
||||||
char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH];
|
|
||||||
pa_sample_snprint(ss, sizeof(ss), &i->sample_spec);
|
|
||||||
assert(i->sink);
|
|
||||||
pa_strbuf_printf(
|
|
||||||
s, " index: %u\n\tname: <%s>\n\tsink: <%u>\n\tvolume: <0x%04x>\n\tlatency: <%u usec>\n\tsample_spec: <%s>\n",
|
|
||||||
i->index,
|
|
||||||
i->name,
|
|
||||||
i->sink->index,
|
|
||||||
(unsigned) i->volume,
|
|
||||||
pa_sink_input_get_latency(i),
|
|
||||||
ss);
|
|
||||||
|
|
||||||
if (i->owner)
|
|
||||||
pa_strbuf_printf(s, "\towner module: <%u>\n", i->owner->index);
|
|
||||||
if (i->client)
|
|
||||||
pa_strbuf_printf(s, "\tclient: <%u>\n", i->client->index);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pa_strbuf_tostring_free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t pa_sink_input_get_latency(struct pa_sink_input *i) {
|
uint32_t pa_sink_input_get_latency(struct pa_sink_input *i) {
|
||||||
uint32_t l = 0;
|
uint32_t l = 0;
|
||||||
|
|
||||||
|
|
@ -121,7 +87,6 @@ uint32_t pa_sink_input_get_latency(struct pa_sink_input *i) {
|
||||||
return l;
|
return l;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int pa_sink_input_peek(struct pa_sink_input *i, struct pa_memchunk *chunk) {
|
int pa_sink_input_peek(struct pa_sink_input *i, struct pa_memchunk *chunk) {
|
||||||
assert(i && chunk && i->peek && i->drop);
|
assert(i && chunk && i->peek && i->drop);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,6 @@ void pa_sink_input_free(struct pa_sink_input* i);
|
||||||
void pa_sink_input_kill(struct pa_sink_input *i);
|
void pa_sink_input_kill(struct pa_sink_input *i);
|
||||||
|
|
||||||
uint32_t pa_sink_input_get_latency(struct pa_sink_input *i);
|
uint32_t pa_sink_input_get_latency(struct pa_sink_input *i);
|
||||||
char *pa_sink_input_list_to_string(struct pa_core *c);
|
|
||||||
|
|
||||||
int pa_sink_input_peek(struct pa_sink_input *i, struct pa_memchunk *chunk);
|
int pa_sink_input_peek(struct pa_sink_input *i, struct pa_memchunk *chunk);
|
||||||
void pa_sink_input_drop(struct pa_sink_input *i, size_t length);
|
void pa_sink_input_drop(struct pa_sink_input *i, size_t length);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "socket-client.h"
|
#include "socket-client.h"
|
||||||
|
#include "socket-util.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
struct pa_socket_client {
|
struct pa_socket_client {
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "socket-server.h"
|
#include "socket-server.h"
|
||||||
#include "util.h"
|
#include "socket-util.h"
|
||||||
|
|
||||||
struct pa_socket_server {
|
struct pa_socket_server {
|
||||||
int fd;
|
int fd;
|
||||||
|
|
|
||||||
152
src/socket-util.c
Normal file
152
src/socket-util.c
Normal file
|
|
@ -0,0 +1,152 @@
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <assert.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <sys/un.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <netinet/tcp.h>
|
||||||
|
#include <netinet/ip.h>
|
||||||
|
|
||||||
|
#include "socket-util.h"
|
||||||
|
|
||||||
|
void pa_socket_peer_to_string(int fd, char *c, size_t l) {
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
assert(c && l && fd >= 0);
|
||||||
|
|
||||||
|
if (fstat(fd, &st) < 0) {
|
||||||
|
snprintf(c, l, "Invalid client fd");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (S_ISSOCK(st.st_mode)) {
|
||||||
|
union {
|
||||||
|
struct sockaddr sa;
|
||||||
|
struct sockaddr_in in;
|
||||||
|
struct sockaddr_un un;
|
||||||
|
} sa;
|
||||||
|
socklen_t sa_len = sizeof(sa);
|
||||||
|
|
||||||
|
if (getpeername(fd, &sa.sa, &sa_len) >= 0) {
|
||||||
|
|
||||||
|
if (sa.sa.sa_family == AF_INET) {
|
||||||
|
uint32_t ip = ntohl(sa.in.sin_addr.s_addr);
|
||||||
|
|
||||||
|
snprintf(c, l, "TCP/IP client from %i.%i.%i.%i:%u",
|
||||||
|
ip >> 24,
|
||||||
|
(ip >> 16) & 0xFF,
|
||||||
|
(ip >> 8) & 0xFF,
|
||||||
|
ip & 0xFF,
|
||||||
|
ntohs(sa.in.sin_port));
|
||||||
|
return;
|
||||||
|
} else if (sa.sa.sa_family == AF_LOCAL) {
|
||||||
|
snprintf(c, l, "UNIX socket client");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
snprintf(c, l, "Unknown network client");
|
||||||
|
return;
|
||||||
|
} else if (S_ISCHR(st.st_mode) && (fd == 0 || fd == 1)) {
|
||||||
|
snprintf(c, l, "STDIN/STDOUT client");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
snprintf(c, l, "Unknown client");
|
||||||
|
}
|
||||||
|
|
||||||
|
int pa_socket_low_delay(int fd) {
|
||||||
|
int priority;
|
||||||
|
assert(fd >= 0);
|
||||||
|
|
||||||
|
priority = 7;
|
||||||
|
if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pa_socket_tcp_low_delay(int fd) {
|
||||||
|
int ret, tos;
|
||||||
|
|
||||||
|
assert(fd >= 0);
|
||||||
|
|
||||||
|
ret = pa_socket_low_delay(fd);
|
||||||
|
|
||||||
|
/* on = 1; */
|
||||||
|
/* if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &on, sizeof(on)) < 0) */
|
||||||
|
/* ret = -1; */
|
||||||
|
|
||||||
|
tos = IPTOS_LOWDELAY;
|
||||||
|
if (setsockopt(fd, SOL_IP, IP_TOS, &tos, sizeof(tos)) < 0)
|
||||||
|
ret = -1;
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int pa_socket_set_rcvbuf(int fd, size_t l) {
|
||||||
|
assert(fd >= 0);
|
||||||
|
|
||||||
|
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &l, sizeof(l)) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pa_socket_set_sndbuf(int fd, size_t l) {
|
||||||
|
assert(fd >= 0);
|
||||||
|
|
||||||
|
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &l, sizeof(l)) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pa_unix_socket_is_stale(const char *fn) {
|
||||||
|
struct sockaddr_un sa;
|
||||||
|
int fd = -1, ret = -1;
|
||||||
|
|
||||||
|
if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
|
||||||
|
fprintf(stderr, "socket(): %s\n", strerror(errno));
|
||||||
|
goto finish;
|
||||||
|
}
|
||||||
|
|
||||||
|
sa.sun_family = AF_LOCAL;
|
||||||
|
strncpy(sa.sun_path, fn, sizeof(sa.sun_path)-1);
|
||||||
|
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
|
||||||
|
|
||||||
|
if (connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
|
||||||
|
if (errno == ECONNREFUSED)
|
||||||
|
ret = 1;
|
||||||
|
} else
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
finish:
|
||||||
|
if (fd >= 0)
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
int pa_unix_socket_remove_stale(const char *fn) {
|
||||||
|
int r;
|
||||||
|
|
||||||
|
if ((r = pa_unix_socket_is_stale(fn)) < 0)
|
||||||
|
return errno != ENOENT ? -1 : 0;
|
||||||
|
|
||||||
|
if (!r)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
/* Yes, here is a race condition. But who cares? */
|
||||||
|
if (unlink(fn) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
17
src/socket-util.h
Normal file
17
src/socket-util.h
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
#ifndef foosocketutilhfoo
|
||||||
|
#define foosocketutilhfoo
|
||||||
|
|
||||||
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
void pa_socket_peer_to_string(int fd, char *c, size_t l);
|
||||||
|
|
||||||
|
int pa_socket_low_delay(int fd);
|
||||||
|
int pa_socket_tcp_low_delay(int fd);
|
||||||
|
|
||||||
|
int pa_socket_set_sndbuf(int fd, size_t l);
|
||||||
|
int pa_socket_set_rcvbuf(int fd, size_t l);
|
||||||
|
|
||||||
|
int pa_unix_socket_is_stale(const char *fn);
|
||||||
|
int pa_unix_socket_remove_stale(const char *fn);
|
||||||
|
|
||||||
|
#endif
|
||||||
30
src/source.c
30
src/source.c
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
#include "source.h"
|
#include "source.h"
|
||||||
#include "sourceoutput.h"
|
#include "sourceoutput.h"
|
||||||
#include "strbuf.h"
|
|
||||||
#include "namereg.h"
|
#include "namereg.h"
|
||||||
|
|
||||||
struct pa_source* pa_source_new(struct pa_core *core, const char *name, int fail, const struct pa_sample_spec *spec) {
|
struct pa_source* pa_source_new(struct pa_core *core, const char *name, int fail, const struct pa_sample_spec *spec) {
|
||||||
|
|
@ -101,35 +100,6 @@ struct pa_source* pa_source_get_default(struct pa_core *c) {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pa_source_list_to_string(struct pa_core *c) {
|
|
||||||
struct pa_strbuf *s;
|
|
||||||
struct pa_source *source, *default_source;
|
|
||||||
uint32_t index = PA_IDXSET_INVALID;
|
|
||||||
assert(c);
|
|
||||||
|
|
||||||
s = pa_strbuf_new();
|
|
||||||
assert(s);
|
|
||||||
|
|
||||||
pa_strbuf_printf(s, "%u source(s) available.\n", pa_idxset_ncontents(c->sources));
|
|
||||||
|
|
||||||
default_source = pa_source_get_default(c);
|
|
||||||
|
|
||||||
for (source = pa_idxset_first(c->sources, &index); source; source = pa_idxset_next(c->sources, &index)) {
|
|
||||||
char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH];
|
|
||||||
pa_sample_snprint(ss, sizeof(ss), &source->sample_spec);
|
|
||||||
pa_strbuf_printf(s, " %c index: %u\n\tname: <%s>\n\tsample_spec: <%s>\n", source == default_source ? '*' : ' ', source->index, source->name, ss);
|
|
||||||
|
|
||||||
if (source->monitor_of)
|
|
||||||
pa_strbuf_printf(s, "\tmonitor_of: <%u>\n", source->monitor_of->index);
|
|
||||||
if (source->owner)
|
|
||||||
pa_strbuf_printf(s, "\towner module: <%u>\n", source->owner->index);
|
|
||||||
if (source->description)
|
|
||||||
pa_strbuf_printf(s, "\tdescription: <%s>\n", source->description);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pa_strbuf_tostring_free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pa_source_set_owner(struct pa_source *s, struct pa_module *m) {
|
void pa_source_set_owner(struct pa_source *s, struct pa_module *m) {
|
||||||
assert(s);
|
assert(s);
|
||||||
s->owner = m;
|
s->owner = m;
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,6 @@ void pa_source_post(struct pa_source*s, struct pa_memchunk *b);
|
||||||
|
|
||||||
void pa_source_notify(struct pa_source *s);
|
void pa_source_notify(struct pa_source *s);
|
||||||
|
|
||||||
char *pa_source_list_to_string(struct pa_core *c);
|
|
||||||
|
|
||||||
struct pa_source* pa_source_get_default(struct pa_core *c);
|
struct pa_source* pa_source_get_default(struct pa_core *c);
|
||||||
|
|
||||||
void pa_source_set_owner(struct pa_source *s, struct pa_module *m);
|
void pa_source_set_owner(struct pa_source *s, struct pa_module *m);
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "sourceoutput.h"
|
#include "sourceoutput.h"
|
||||||
#include "strbuf.h"
|
|
||||||
|
|
||||||
struct pa_source_output* pa_source_output_new(struct pa_source *s, const char *name, const struct pa_sample_spec *spec) {
|
struct pa_source_output* pa_source_output_new(struct pa_source *s, const char *name, const struct pa_sample_spec *spec) {
|
||||||
struct pa_source_output *o;
|
struct pa_source_output *o;
|
||||||
|
|
@ -58,36 +57,6 @@ void pa_source_output_kill(struct pa_source_output*i) {
|
||||||
i->kill(i);
|
i->kill(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *pa_source_output_list_to_string(struct pa_core *c) {
|
|
||||||
struct pa_strbuf *s;
|
|
||||||
struct pa_source_output *o;
|
|
||||||
uint32_t index = PA_IDXSET_INVALID;
|
|
||||||
assert(c);
|
|
||||||
|
|
||||||
s = pa_strbuf_new();
|
|
||||||
assert(s);
|
|
||||||
|
|
||||||
pa_strbuf_printf(s, "%u source outputs(s) available.\n", pa_idxset_ncontents(c->source_outputs));
|
|
||||||
|
|
||||||
for (o = pa_idxset_first(c->source_outputs, &index); o; o = pa_idxset_next(c->source_outputs, &index)) {
|
|
||||||
char ss[PA_SAMPLE_SNPRINT_MAX_LENGTH];
|
|
||||||
pa_sample_snprint(ss, sizeof(ss), &o->sample_spec);
|
|
||||||
assert(o->source);
|
|
||||||
pa_strbuf_printf(
|
|
||||||
s, " index: %u\n\tname: <%s>\n\tsource: <%u>\n\tsample_spec: <%s>\n",
|
|
||||||
o->index,
|
|
||||||
o->name,
|
|
||||||
o->source->index,
|
|
||||||
ss);
|
|
||||||
if (o->owner)
|
|
||||||
pa_strbuf_printf(s, "\towner module: <%u>\n", o->owner->index);
|
|
||||||
if (o->client)
|
|
||||||
pa_strbuf_printf(s, "\tclient: <%u>\n", o->client->index);
|
|
||||||
}
|
|
||||||
|
|
||||||
return pa_strbuf_tostring_free(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
void pa_source_output_push(struct pa_source_output *o, const struct pa_memchunk *chunk) {
|
void pa_source_output_push(struct pa_source_output *o, const struct pa_memchunk *chunk) {
|
||||||
struct pa_memchunk rchunk;
|
struct pa_memchunk rchunk;
|
||||||
assert(o && chunk && chunk->length && o->push);
|
assert(o && chunk && chunk->length && o->push);
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,6 @@ void pa_source_output_free(struct pa_source_output* o);
|
||||||
|
|
||||||
void pa_source_output_kill(struct pa_source_output*o);
|
void pa_source_output_kill(struct pa_source_output*o);
|
||||||
|
|
||||||
char *pa_source_output_list_to_string(struct pa_core *c);
|
|
||||||
|
|
||||||
void pa_source_output_push(struct pa_source_output *o, const struct pa_memchunk *chunk);
|
void pa_source_output_push(struct pa_source_output *o, const struct pa_memchunk *chunk);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
3
src/todo
3
src/todo
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
- move more stuff from module-oss[-dma] to liboss-util
|
- move more stuff from module-oss[-dma] to liboss-util
|
||||||
|
|
||||||
- create libstatustext, libsocketutil
|
|
||||||
- prefix modules/libraries with pa_
|
- prefix modules/libraries with pa_
|
||||||
|
|
||||||
- xmms+esound latency testing
|
- xmms+esound latency testing
|
||||||
|
|
@ -14,8 +13,6 @@
|
||||||
- svn-id and license in every file
|
- svn-id and license in every file
|
||||||
- documentation
|
- documentation
|
||||||
|
|
||||||
- dependency checking script
|
|
||||||
|
|
||||||
-- post 0.1
|
-- post 0.1
|
||||||
- future cancellation
|
- future cancellation
|
||||||
- client-ui
|
- client-ui
|
||||||
|
|
|
||||||
140
src/util.c
140
src/util.c
|
|
@ -5,13 +5,9 @@
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/un.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <netinet/tcp.h>
|
|
||||||
#include <netinet/ip.h>
|
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
|
|
@ -23,52 +19,6 @@ void pa_make_nonblock_fd(int fd) {
|
||||||
fcntl(fd, F_SETFL, v|O_NONBLOCK);
|
fcntl(fd, F_SETFL, v|O_NONBLOCK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void pa_peer_to_string(char *c, size_t l, int fd) {
|
|
||||||
struct stat st;
|
|
||||||
|
|
||||||
assert(c && l && fd >= 0);
|
|
||||||
|
|
||||||
if (fstat(fd, &st) < 0) {
|
|
||||||
snprintf(c, l, "Invalid client fd");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (S_ISSOCK(st.st_mode)) {
|
|
||||||
union {
|
|
||||||
struct sockaddr sa;
|
|
||||||
struct sockaddr_in in;
|
|
||||||
struct sockaddr_un un;
|
|
||||||
} sa;
|
|
||||||
socklen_t sa_len = sizeof(sa);
|
|
||||||
|
|
||||||
if (getpeername(fd, &sa.sa, &sa_len) >= 0) {
|
|
||||||
|
|
||||||
if (sa.sa.sa_family == AF_INET) {
|
|
||||||
uint32_t ip = ntohl(sa.in.sin_addr.s_addr);
|
|
||||||
|
|
||||||
snprintf(c, l, "TCP/IP client from %i.%i.%i.%i:%u",
|
|
||||||
ip >> 24,
|
|
||||||
(ip >> 16) & 0xFF,
|
|
||||||
(ip >> 8) & 0xFF,
|
|
||||||
ip & 0xFF,
|
|
||||||
ntohs(sa.in.sin_port));
|
|
||||||
return;
|
|
||||||
} else if (sa.sa.sa_family == AF_LOCAL) {
|
|
||||||
snprintf(c, l, "UNIX socket client");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
snprintf(c, l, "Unknown network client");
|
|
||||||
return;
|
|
||||||
} else if (S_ISCHR(st.st_mode) && (fd == 0 || fd == 1)) {
|
|
||||||
snprintf(c, l, "STDIN/STDOUT client");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
snprintf(c, l, "Unknown client");
|
|
||||||
}
|
|
||||||
|
|
||||||
int pa_make_secure_dir(const char* dir) {
|
int pa_make_secure_dir(const char* dir) {
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
|
|
@ -89,54 +39,6 @@ fail:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_socket_low_delay(int fd) {
|
|
||||||
int priority;
|
|
||||||
assert(fd >= 0);
|
|
||||||
|
|
||||||
priority = 7;
|
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_PRIORITY, &priority, sizeof(priority)) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pa_socket_tcp_low_delay(int fd) {
|
|
||||||
int ret, tos;
|
|
||||||
|
|
||||||
assert(fd >= 0);
|
|
||||||
|
|
||||||
ret = pa_socket_low_delay(fd);
|
|
||||||
|
|
||||||
/* on = 1; */
|
|
||||||
/* if (setsockopt(fd, SOL_TCP, TCP_NODELAY, &on, sizeof(on)) < 0) */
|
|
||||||
/* ret = -1; */
|
|
||||||
|
|
||||||
tos = IPTOS_LOWDELAY;
|
|
||||||
if (setsockopt(fd, SOL_IP, IP_TOS, &tos, sizeof(tos)) < 0)
|
|
||||||
ret = -1;
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
int pa_socket_set_rcvbuf(int fd, size_t l) {
|
|
||||||
assert(fd >= 0);
|
|
||||||
|
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &l, sizeof(l)) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pa_socket_set_sndbuf(int fd, size_t l) {
|
|
||||||
assert(fd >= 0);
|
|
||||||
|
|
||||||
if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &l, sizeof(l)) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ssize_t pa_loop_read(int fd, void*data, size_t size) {
|
ssize_t pa_loop_read(int fd, void*data, size_t size) {
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
assert(fd >= 0 && data && size);
|
assert(fd >= 0 && data && size);
|
||||||
|
|
@ -179,48 +81,6 @@ ssize_t pa_loop_write(int fd, const void*data, size_t size) {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pa_unix_socket_is_stale(const char *fn) {
|
|
||||||
struct sockaddr_un sa;
|
|
||||||
int fd = -1, ret = -1;
|
|
||||||
|
|
||||||
if ((fd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) {
|
|
||||||
fprintf(stderr, "socket(): %s\n", strerror(errno));
|
|
||||||
goto finish;
|
|
||||||
}
|
|
||||||
|
|
||||||
sa.sun_family = AF_LOCAL;
|
|
||||||
strncpy(sa.sun_path, fn, sizeof(sa.sun_path)-1);
|
|
||||||
sa.sun_path[sizeof(sa.sun_path) - 1] = 0;
|
|
||||||
|
|
||||||
if (connect(fd, (struct sockaddr*) &sa, sizeof(sa)) < 0) {
|
|
||||||
if (errno == ECONNREFUSED)
|
|
||||||
ret = 1;
|
|
||||||
} else
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
finish:
|
|
||||||
if (fd >= 0)
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
int pa_unix_socket_remove_stale(const char *fn) {
|
|
||||||
int r;
|
|
||||||
|
|
||||||
if ((r = pa_unix_socket_is_stale(fn)) < 0)
|
|
||||||
return errno != ENOENT ? -1 : 0;
|
|
||||||
|
|
||||||
if (!r)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Yes, here is a race condition. But who cares? */
|
|
||||||
if (unlink(fn) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void pa_check_for_sigpipe(void) {
|
void pa_check_for_sigpipe(void) {
|
||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
|
|
||||||
|
|
|
||||||
11
src/util.h
11
src/util.h
|
|
@ -5,22 +5,11 @@
|
||||||
|
|
||||||
void pa_make_nonblock_fd(int fd);
|
void pa_make_nonblock_fd(int fd);
|
||||||
|
|
||||||
void pa_peer_to_string(char *c, size_t l, int fd);
|
|
||||||
|
|
||||||
int pa_make_secure_dir(const char* dir);
|
int pa_make_secure_dir(const char* dir);
|
||||||
|
|
||||||
int pa_socket_low_delay(int fd);
|
|
||||||
int pa_socket_tcp_low_delay(int fd);
|
|
||||||
|
|
||||||
int pa_socket_set_sndbuf(int fd, size_t l);
|
|
||||||
int pa_socket_set_rcvbuf(int fd, size_t l);
|
|
||||||
|
|
||||||
ssize_t pa_loop_read(int fd, void*data, size_t size);
|
ssize_t pa_loop_read(int fd, void*data, size_t size);
|
||||||
ssize_t pa_loop_write(int fd, const void*data, size_t size);
|
ssize_t pa_loop_write(int fd, const void*data, size_t size);
|
||||||
|
|
||||||
int pa_unix_socket_is_stale(const char *fn);
|
|
||||||
int pa_unix_socket_remove_stale(const char *fn);
|
|
||||||
|
|
||||||
void pa_check_for_sigpipe(void);
|
void pa_check_for_sigpipe(void);
|
||||||
|
|
||||||
char *pa_sprintf_malloc(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
char *pa_sprintf_malloc(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue