summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-07-11 01:09:46 +0000
committerLennart Poettering <lennart@poettering.net>2004-07-11 01:09:46 +0000
commitccfd55420ebec191d7a3ed842ecb2740ceeb76ba (patch)
treedaa9eb191995053753a43e27a955b7ddec46f1e1
parentc7bd759cdb2b8f16693750f89ed781707a53e5a9 (diff)
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
-rw-r--r--src/Makefile.am52
-rw-r--r--src/cli.c1
-rw-r--r--src/client.c23
-rw-r--r--src/client.h2
-rw-r--r--src/clitext.c178
-rw-r--r--src/clitext.h14
-rwxr-xr-xsrc/depmod.py56
-rw-r--r--src/iochannel.c3
-rw-r--r--src/module-protocol-stub.c1
-rw-r--r--src/module.c19
-rw-r--r--src/module.h3
-rw-r--r--src/protocol-esound.c2
-rw-r--r--src/protocol-simple.c2
-rw-r--r--src/sink.c39
-rw-r--r--src/sink.h2
-rw-r--r--src/sinkinput.c35
-rw-r--r--src/sinkinput.h1
-rw-r--r--src/socket-client.c1
-rw-r--r--src/socket-server.c2
-rw-r--r--src/socket-util.c152
-rw-r--r--src/socket-util.h17
-rw-r--r--src/source.c30
-rw-r--r--src/source.h2
-rw-r--r--src/sourceoutput.c31
-rw-r--r--src/sourceoutput.h2
-rw-r--r--src/todo3
-rw-r--r--src/util.c140
-rw-r--r--src/util.h11
28 files changed, 456 insertions, 368 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index b02bfba6..51129534 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -35,6 +35,8 @@ pkglib_LTLIBRARIES=libiochannel.la \
libpstream-util.la \
libpdispatch.la \
libauthkey.la \
+ libclitext.la \
+ libsocket-util.la \
libprotocol-simple.la \
libprotocol-esound.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_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_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_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_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_LDFLAGS = -avoid-version
-libpdispatch_la_LIBADD = libpacket.la libtagstruct.la
+libpdispatch_la_LIBADD = libtagstruct.la
libiochannel_la_SOURCES = iochannel.c iochannel.h
libiochannel_la_LDFLAGS = -avoid-version
+libiochannel_la_LIBDADD = libsocket-util.la
libpacket_la_SOURCES = packet.c packet.h
libpacket_la_LDFLAGS = -avoid-version
@@ -127,7 +130,7 @@ libioline_la_LIBADD = libiochannel.la
libcli_la_SOURCES = cli.c cli.h
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_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_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_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_LIBADD = libsocket-server.la libiochannel.la libauthkey.la
libauthkey_la_SOURCES = authkey.c authkey.h
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_CFLAGS = -DUSE_TCP_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
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_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_SIMPLE $(AM_CFLAGS)
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_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_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_CLI $(AM_CFLAGS)
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_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_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_NATIVE $(AM_CFLAGS)
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_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_CFLAGS = -DUSE_UNIX_SOCKETS -DUSE_PROTOCOL_ESOUND $(AM_CFLAGS)
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_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_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_LDFLAGS = -module -avoid-version
@@ -229,9 +238,9 @@ libpolyp_la_SOURCES = polyp.c polyp.h \
queue.c queue.h \
dynarray.c dynarray.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_LIBADD = libpolyp-error.la
libpolyp_error_la_SOURCES = polyp-error.c polyp-error.h
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_CFLAGS = $(AM_CFLAGS)
libpolyp_simple_la_LIBADD = libpolyp.la
-#libpolyp-error.la
-pacat_SOURCES = pacat.c $(libpolyp_la_SOURCES) $(libpolyp_error_la_SOURCES)
-#pacat_LDADD = libpolyp.la
+pacat_SOURCES = pacat.c #$(libpolyp_la_SOURCES) $(libpolyp_error_la_SOURCES)
+pacat_LDADD = libpolyp.la libpolyp-error.la
pacat_CFLAGS = $(AM_CFLAGS)
-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_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_CFLAGS = $(AM_CFLAGS)
-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_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_CFLAGS = $(AM_CFLAGS)
diff --git a/src/cli.c b/src/cli.c
index b7fc787a..d5b46c46 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -14,6 +14,7 @@
#include "tokenizer.h"
#include "strbuf.h"
#include "namereg.h"
+#include "clitext.h"
struct pa_cli {
struct pa_core *core;
diff --git a/src/client.c b/src/client.c
index fa1a28d4..c170e49a 100644
--- a/src/client.c
+++ b/src/client.c
@@ -4,7 +4,6 @@
#include <string.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 *c;
@@ -48,28 +47,6 @@ void pa_client_kill(struct pa_client *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) {
assert(c);
free(c->name);
diff --git a/src/client.h b/src/client.h
index d603411d..10ffa8f3 100644
--- a/src/client.h
+++ b/src/client.h
@@ -25,8 +25,6 @@ void pa_client_free(struct pa_client *c);
* request destruction of the client */
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);
#endif
diff --git a/src/clitext.c b/src/clitext.c
new file mode 100644
index 00000000..701cf2c0
--- /dev/null
+++ b/src/clitext.c
@@ -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);
+}
diff --git a/src/clitext.h b/src/clitext.h
new file mode 100644
index 00000000..5b17c2d7
--- /dev/null
+++ b/src/clitext.h
@@ -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
+
diff --git a/src/depmod.py b/src/depmod.py
new file mode 100755
index 00000000..d11cceb4
--- /dev/null
+++ b/src/depmod.py
@@ -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], " "))
diff --git a/src/iochannel.c b/src/iochannel.c
index 775c6139..38430034 100644
--- a/src/iochannel.c
+++ b/src/iochannel.c
@@ -5,6 +5,7 @@
#include "iochannel.h"
#include "util.h"
+#include "socket-util.h"
struct pa_iochannel {
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) {
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) {
diff --git a/src/module-protocol-stub.c b/src/module-protocol-stub.c
index 3bb0a072..0547f7e6 100644
--- a/src/module-protocol-stub.c
+++ b/src/module-protocol-stub.c
@@ -7,6 +7,7 @@
#include "module.h"
#include "socket-server.h"
+#include "socket-util.h"
#include "util.h"
#ifdef USE_PROTOCOL_SIMPLE
diff --git a/src/module.c b/src/module.c
index 87df3b38..b6a706c3 100644
--- a/src/module.c
+++ b/src/module.c
@@ -6,7 +6,6 @@
#include <errno.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 *m = NULL;
@@ -112,24 +111,6 @@ void pa_module_unload_all(struct pa_core *c) {
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 pa_core *core;
uint32_t index;
diff --git a/src/module.h b/src/module.h
index 2a9cf558..174a8d09 100644
--- a/src/module.h
+++ b/src/module.h
@@ -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);
-char *pa_module_list_to_string(struct pa_core *c);
-
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 */
int pa_module_init(struct pa_core *c, struct pa_module*m);
void pa_module_done(struct pa_core *c, struct pa_module*m);
diff --git a/src/protocol-esound.c b/src/protocol-esound.c
index fc4444c3..955ab93c 100644
--- a/src/protocol-esound.c
+++ b/src/protocol-esound.c
@@ -660,7 +660,7 @@ static void io_callback(struct pa_iochannel*io, void *userdata) {
/*** 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;
assert(a && c && c->fixed_source == id);
diff --git a/src/protocol-simple.c b/src/protocol-simple.c
index 518d5f24..b57f324a 100644
--- a/src/protocol-simple.c
+++ b/src/protocol-simple.c
@@ -229,7 +229,7 @@ static void io_callback(struct pa_iochannel*io, void *userdata) {
/*** 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;
assert(a && c && c->fixed_source == id);
diff --git a/src/sink.c b/src/sink.c
index 6a9f3580..9ba79e39 100644
--- a/src/sink.c
+++ b/src/sink.c
@@ -5,10 +5,9 @@
#include "sink.h"
#include "sinkinput.h"
-#include "strbuf.h"
-#include "sample-util.h"
#include "namereg.h"
#include "util.h"
+#include "sample-util.h"
#define MAX_MIX_CHANNELS 32
@@ -260,42 +259,6 @@ struct pa_sink* pa_sink_get_default(struct pa_core *c) {
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) {
sink->owner = m;
diff --git a/src/sink.h b/src/sink.h
index 071ad094..a25a4377 100644
--- a/src/sink.h
+++ b/src/sink.h
@@ -39,8 +39,6 @@ uint32_t pa_sink_get_latency(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);
void pa_sink_set_owner(struct pa_sink *sink, struct pa_module *m);
diff --git a/src/sinkinput.c b/src/sinkinput.c
index 3cfe49b3..54778a81 100644
--- a/src/sinkinput.c
+++ b/src/sinkinput.c
@@ -4,7 +4,6 @@
#include <string.h>
#include "sinkinput.h"
-#include "strbuf.h"
#include "sample-util.h"
#define CONVERT_BUFFER_LENGTH 4096
@@ -75,39 +74,6 @@ void pa_sink_input_kill(struct pa_sink_input*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 l = 0;
@@ -121,7 +87,6 @@ uint32_t pa_sink_input_get_latency(struct pa_sink_input *i) {
return l;
}
-
int pa_sink_input_peek(struct pa_sink_input *i, struct pa_memchunk *chunk) {
assert(i && chunk && i->peek && i->drop);
diff --git a/src/sinkinput.h b/src/sinkinput.h
index 8c9813e5..02a2a117 100644
--- a/src/sinkinput.h
+++ b/src/sinkinput.h
@@ -39,7 +39,6 @@ void pa_sink_input_free(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);
-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);
void pa_sink_input_drop(struct pa_sink_input *i, size_t length);
diff --git a/src/socket-client.c b/src/socket-client.c
index 9a8c5607..8b2bd384 100644
--- a/src/socket-client.c
+++ b/src/socket-client.c
@@ -9,6 +9,7 @@
#include <arpa/inet.h>
#include "socket-client.h"
+#include "socket-util.h"
#include "util.h"
struct pa_socket_client {
diff --git a/src/socket-server.c b/src/socket-server.c
index 23d8f7e7..02b4328f 100644
--- a/src/socket-server.c
+++ b/src/socket-server.c
@@ -11,7 +11,7 @@
#include <arpa/inet.h>
#include "socket-server.h"
-#include "util.h"
+#include "socket-util.h"
struct pa_socket_server {
int fd;
diff --git a/src/socket-util.c b/src/socket-util.c
new file mode 100644
index 00000000..f9451af8
--- /dev/null
+++ b/src/socket-util.c
@@ -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;
+}
diff --git a/src/socket-util.h b/src/socket-util.h
new file mode 100644
index 00000000..1c4dbe35
--- /dev/null
+++ b/src/socket-util.h
@@ -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
diff --git a/src/source.c b/src/source.c
index 45ccfb27..c0eec3ea 100644
--- a/src/source.c
+++ b/src/source.c
@@ -5,7 +5,6 @@
#include "source.h"
#include "sourceoutput.h"
-#include "strbuf.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) {
@@ -101,35 +100,6 @@ struct pa_source* pa_source_get_default(struct pa_core *c) {
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) {
assert(s);
s->owner = m;
diff --git a/src/source.h b/src/source.h
index 2bc5bea8..9e57bc0f 100644
--- a/src/source.h
+++ b/src/source.h
@@ -33,8 +33,6 @@ void pa_source_post(struct pa_source*s, struct pa_memchunk *b);
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);
void pa_source_set_owner(struct pa_source *s, struct pa_module *m);
diff --git a/src/sourceoutput.c b/src/sourceoutput.c
index ea727576..25c661a9 100644
--- a/src/sourceoutput.c
+++ b/src/sourceoutput.c
@@ -3,7 +3,6 @@
#include <string.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 *o;
@@ -58,36 +57,6 @@ void pa_source_output_kill(struct pa_source_output*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) {
struct pa_memchunk rchunk;
assert(o && chunk && chunk->length && o->push);
diff --git a/src/sourceoutput.h b/src/sourceoutput.h
index dfd076db..a8ea5a9f 100644
--- a/src/sourceoutput.h
+++ b/src/sourceoutput.h
@@ -32,8 +32,6 @@ void pa_source_output_free(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);
#endif
diff --git a/src/todo b/src/todo
index 36e69a18..bf01a4c4 100644
--- a/src/todo
+++ b/src/todo
@@ -5,7 +5,6 @@
- move more stuff from module-oss[-dma] to liboss-util
-- create libstatustext, libsocketutil
- prefix modules/libraries with pa_
- xmms+esound latency testing
@@ -14,8 +13,6 @@
- svn-id and license in every file
- documentation
-- dependency checking script
-
-- post 0.1
- future cancellation
- client-ui
diff --git a/src/util.c b/src/util.c
index aceb772d..773922b5 100644
--- a/src/util.c
+++ b/src/util.c
@@ -5,13 +5,9 @@
#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 "util.h"
@@ -23,52 +19,6 @@ void pa_make_nonblock_fd(int fd) {
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) {
struct stat st;
@@ -89,54 +39,6 @@ fail:
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 ret = 0;
assert(fd >= 0 && data && size);
@@ -179,48 +81,6 @@ ssize_t pa_loop_write(int fd, const void*data, size_t size) {
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) {
struct sigaction sa;
diff --git a/src/util.h b/src/util.h
index c5c6db82..3e494434 100644
--- a/src/util.h
+++ b/src/util.h
@@ -5,22 +5,11 @@
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_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_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);
char *pa_sprintf_malloc(const char *format, ...) __attribute__ ((format (printf, 1, 2)));