]> code.delx.au - pulseaudio/commitdiff
add dependency script
authorLennart Poettering <lennart@poettering.net>
Sun, 11 Jul 2004 01:09:46 +0000 (01:09 +0000)
committerLennart Poettering <lennart@poettering.net>
Sun, 11 Jul 2004 01:09:46 +0000 (01:09 +0000)
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

28 files changed:
src/Makefile.am
src/cli.c
src/client.c
src/client.h
src/clitext.c [new file with mode: 0644]
src/clitext.h [new file with mode: 0644]
src/depmod.py [new file with mode: 0755]
src/iochannel.c
src/module-protocol-stub.c
src/module.c
src/module.h
src/protocol-esound.c
src/protocol-simple.c
src/sink.c
src/sink.h
src/sinkinput.c
src/sinkinput.h
src/socket-client.c
src/socket-server.c
src/socket-util.c [new file with mode: 0644]
src/socket-util.h [new file with mode: 0644]
src/source.c
src/source.h
src/sourceoutput.c
src/sourceoutput.h
src/todo
src/util.c
src/util.h

index b02bfba6c7ec47a78e3c1ef5b9f765986a86f90e..51129534dd9cd2b1874c79291e438529aa665c80 100644 (file)
@@ -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)
index b7fc787a2641f1d4c54dceb5f4b3eda10957ce0d..d5b46c461a380c1a728921a5f74a9a956a710831 100644 (file)
--- 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;
index fa1a28d4a4912a8ecdae16b1fa3b21d5fecac440..c170e49a1861f1cc9cf576a863d3bc64ad6eff57 100644 (file)
@@ -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);
index d603411df143f6aca0581d194398d7793555e2fe..10ffa8f31a6e65a20f0516a21c331f3fcf957e62 100644 (file)
@@ -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 (file)
index 0000000..701cf2c
--- /dev/null
@@ -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 (file)
index 0000000..5b17c2d
--- /dev/null
@@ -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 (executable)
index 0000000..d11cceb
--- /dev/null
@@ -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], " "))
index 775c61394053dddc6184cc81fa0f197750d32c6e..3843003460b84dd8c8d47918adc16cb6bb35a23a 100644 (file)
@@ -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) {
index 3bb0a072911a9dfbae8f6948b46444ef30c77ef4..0547f7e60e3fa4200acf7e4ebd4036afaeadcc4b 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "module.h"
 #include "socket-server.h"
+#include "socket-util.h"
 #include "util.h"
 
 #ifdef USE_PROTOCOL_SIMPLE
index 87df3b38dbf5adc27b524bfa12305ce39d7ee4a5..b6a706c3527355f3d34bfe460e0b1a9407a4ab56 100644 (file)
@@ -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;
index 2a9cf55830f09f51bfd9722439b1934b5472493c..174a8d092ebdca4a85bbf9b25541294579b1323f 100644 (file)
@@ -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);
index fc4444c357891201ad32a74acf9a380b6d224176..955ab93cc9b7af5ce7e0dd98c6300d613a1d188d 100644 (file)
@@ -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);
 
index 518d5f24bd20e40b4658230ec263a049f35af348..b57f324abc860c2f6c35f330c72d8a5c5e99566e 100644 (file)
@@ -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);
 
index 6a9f3580304b87ed95ec430207479375215cbd59..9ba79e39e79f1ddb9f93009327def3b9a918a23b 100644 (file)
@@ -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;
 
index 071ad0947af3d4faec0b93aac2994804ec51f05f..a25a4377b20921b628f9c66a3bb687d1b9b275ba 100644 (file)
@@ -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);
index 3cfe49b32e3cb2f7c3d365b99b9df71c63090d8e..54778a81e1be27d1eab8a6ca976d1bbbc3991a14 100644 (file)
@@ -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);
 
index 8c9813e55fd341d222d0473398d02e9aff5a04a6..02a2a117207a8a8b8d460ab59cd32f3ec1d2b4fb 100644 (file)
@@ -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);
index 9a8c56078673843816f6128935664e8a6bb420fe..8b2bd384cbe33a0fe4d4d16a25ca0dcc2ac7af67 100644 (file)
@@ -9,6 +9,7 @@
 #include <arpa/inet.h>
 
 #include "socket-client.h"
+#include "socket-util.h"
 #include "util.h"
 
 struct pa_socket_client {
index 23d8f7e7c39663be18c1073502c69b231b648774..02b4328fc0bad057a5d4493c997aec03a03d8073 100644 (file)
@@ -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 (file)
index 0000000..f9451af
--- /dev/null
@@ -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 (file)
index 0000000..1c4dbe3
--- /dev/null
@@ -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
index 45ccfb2713cd19e18e150fda68b61570cdae2957..c0eec3ead045b7dc960255551c40542c6a5747d2 100644 (file)
@@ -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;
index 2bc5bea8c6b37f063194e3582c6eeb47e124acbd..9e57bc0fb87a38c3fb22d30f691e7b077b622dfa 100644 (file)
@@ -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);
index ea727576870f5d4b410dc24baa6af5527d22aaf7..25c661a98c7bda978415caca1649ad8ed74894e1 100644 (file)
@@ -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);
index dfd076db3708690bc510c95a231db9f375d9317d..a8ea5a9f60a0471b05bbfce0fe8373c0b32c088d 100644 (file)
@@ -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
index 36e69a1812e1f52174b8e5858aa4a37b7771c8a6..bf01a4c4b946477dfabf11912eb9f102984c4a75 100644 (file)
--- 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
index aceb772d2f0da51a271a2304533b284f3f4c566f..773922b554661c5886fbce13e5f54cb6f6eb8e9b 100644 (file)
@@ -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;
 
index c5c6db823ebfa49ac6d1e58b02a8941cef9326a2..3e4944347f9aa8b5cf35fe03fb73e576b6a970c2 100644 (file)
@@ -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)));