Merge branch 'refs/heads/t/com_tasks'
authorAndre Noll <maan@tuebingen.mpg.de>
Sun, 14 Dec 2014 20:48:06 +0000 (21:48 +0100)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 14 Dec 2014 20:49:45 +0000 (21:49 +0100)
cooking for almost a month.

16 files changed:
.gitignore
Doxyfile
Makefile.in
Makefile.real
NEWS
audioc.c
audiod.c
audiod_command.c
autogen.sh
client.c
command.c
configure.ac
depend.sh [deleted file]
m4/gengetopt/makefile
oss_write.c
play.c

index d340f2075c05f99ad6b8a3ccb85dd4f293fbcc19..6df2e505aba059b933bad7056e4cc12f1a303207 100644 (file)
@@ -14,9 +14,7 @@ config.log
 config.status
 Makefile
 TODO
-*_command_list.h
-*_command_list.man
-paraslash-git.tar.bz2
+paraslash-*.tar.bz2
 web/dia/overview.pdf
 *.swp
 error2.h
@@ -25,4 +23,3 @@ confdefs.h
 conftest
 conftest.c
 git-version.h
-*_completion.h
index 239cd2622ddb2a2db238749b4e815fae72a1e3cf..4f9743c74fdd5e136874cf7e80167ff086761497 100644 (file)
--- a/Doxyfile
+++ b/Doxyfile
@@ -621,8 +621,8 @@ EXCLUDE_SYMLINKS       = NO
 EXCLUDE_PATTERNS       = *.cmdline.* \
                          gcc-compat.h \
                          fade.c \
-                       *_command_list.h \
-                       *_completion.h
+                       *.command_list.h \
+                       *.completion.h
 
 # The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
 # (namespaces, classes, functions, etc.) that should be excluded from the
index a869c8900a73cb99ac058c53189f4058673115e2..8e7e77604e3930c0a3ac87e05203bf0060938453 100644 (file)
@@ -45,6 +45,9 @@ mad_cppflags := @mad_cppflags@
 faad_cppflags := @faad_cppflags@
 curses_cppflags := @curses_cppflags@
 ao_cppflags := @ao_cppflags@
+flac_cppflags := @flac_cppflags@
+samplerate_cppflags := @samplerate_cppflags@
+readline_cppflags := @readline_cppflags@
 
 clock_gettime_ldflags := @clock_gettime_ldflags@
 id3tag_ldflags := @id3tag_ldflags@
index ab2389536fd29a9b1cb6196c068a33b122600fd8..fb99679a0b1da2b62994be493b2d67f75a942d28 100644 (file)
@@ -21,6 +21,7 @@ object_dir := $(build_dir)/objects
 dep_dir := $(build_dir)/deps
 man_dir := $(build_dir)/man/man1
 cmdline_dir := $(build_dir)/cmdline
+cmdlist_dir := $(build_dir)/cmdlist
 m4depdir := $(build_dir)/m4deps
 help2man_dir := $(build_dir)/help2man
 hostbin_dir := $(build_dir)/host/bin
@@ -31,7 +32,7 @@ test_dir := t
 all_objs := $(sort $(recv_objs) $(filter_objs) $(client_objs) $(gui_objs) \
        $(audiod_objs) $(audioc_objs) $(fade_objs) $(server_objs) \
        $(write_objs) $(afh_objs) $(play_objs))
-deps := $(addprefix $(dep_dir)/, $(all_objs:.o=.d))
+deps := $(addprefix $(dep_dir)/, $(filter-out %.cmdline.d, $(all_objs:.o=.d)))
 m4_deps := $(addprefix $(m4depdir)/, $(addsuffix .m4d, $(executables)))
 
 # now prefix all objects with object dir
@@ -50,7 +51,7 @@ play_objs := $(addprefix $(object_dir)/, $(play_objs))
 man_pages := $(patsubst %, $(man_dir)/%.1, $(prefixed_executables))
 
 autocrap := config.h.in configure
-tarball_pfx := $(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
+tarball_pfx := $(PACKAGE_TARNAME)-$(shell git describe --dirty)
 tarball_delete := $(addprefix $(tarball_pfx)/, web .gitignore)
 tarball := $(tarball_pfx).tar.bz2
 
@@ -68,7 +69,7 @@ ifeq ($(findstring clean, $(MAKECMDGOALS)),)
 endif
 
 $(object_dir) $(man_dir) $(ggo_dir) $(cmdline_dir) $(dep_dir) $(m4depdir) \
-               $(help2man_dir) $(hostbin_dir):
+               $(help2man_dir) $(hostbin_dir) $(cmdlist_dir):
        $(Q) $(MKDIR_P) $@
 
 # When in doubt, use brute force (Ken Thompson)
@@ -80,40 +81,42 @@ $(subst p,P,$(subst q,Q,$(subst r,R,$(subst s,S,$(subst t,T,\
 $(subst u,U,$(subst v,V,$(subst w,W,$(subst x,X,$(subst y,Y,\
 $(subst z,Z,$1))))))))))))))))))))))))))
 
-
-DEBUG_CPPFLAGS += -g -Wunused -Wundef -W
-DEBUG_CPPFLAGS += -Wredundant-decls
-DEBUG_CPPFLAGS += -Wall -Wno-sign-compare -Wno-unknown-pragmas
-DEBUG_CPPFLAGS += -Wformat-security
-DEBUG_CPPFLAGS += -Wmissing-format-attribute
-
-ifeq ($(uname_s),Linux)
-       CPPFLAGS += -fdata-sections -ffunction-sections
-       LDFLAGS += -Wl,--gc-sections
-       CPPFLAGS += -Wstrict-prototypes
-       CPPFLAGS += -Wshadow
-       # causes warnings on *BSD for the feature test macros
-       CPPFLAGS += -Wunused-macros
-endif
-CPPFLAGS += -Os
-CPPFLAGS += -Wuninitialized
-CPPFLAGS += -Wchar-subscripts
 CPPFLAGS += -DBINDIR='"$(BINDIR)"'
 CPPFLAGS += -DBUILD_DATE='"$(build_date)"'
 CPPFLAGS += -DUNAME_RS='"$(uname_rs)"'
 CPPFLAGS += -DCC_VERSION='"$(cc_version)"'
-CPPFLAGS += -Werror-implicit-function-declaration
-CPPFLAGS += -Wmissing-noreturn
-CPPFLAGS += -Wbad-function-cast
-CPPFLAGS += -fno-strict-aliasing
 CPPFLAGS += -DMAIN_INPUT_FILE_IS_$(*F)
 CPPFLAGS += $(arch_cppflags)
 CPPFLAGS += -I/usr/local/include
 CPPFLAGS += -I$(cmdline_dir)
-CPPFLAGS += $(osl_cppflags)
+CPPFLAGS += -I$(cmdlist_dir)
+
+CFLAGS += -Os
+CFLAGS += -Wuninitialized
+CFLAGS += -Wchar-subscripts
+CFLAGS += -Werror-implicit-function-declaration
+CFLAGS += -Wmissing-noreturn
+CFLAGS += -Wbad-function-cast
+CFLAGS += -fno-strict-aliasing
+
+STRICT_CFLAGS = $(CFLAGS)
+STRICT_CFLAGS += -g -Wundef -W
+STRICT_CFLAGS += -Wredundant-decls
+STRICT_CFLAGS += -Wno-sign-compare -Wno-unknown-pragmas
+STRICT_CFLAGS += -Wformat -Wformat-security
+STRICT_CFLAGS += -Wmissing-format-attribute
 
 LDFLAGS += $(clock_gettime_ldflags)
 
+ifeq ($(uname_s),Linux)
+       # these cause warnings on *BSD
+       STRICT_CFLAGS += -fdata-sections -ffunction-sections
+       STRICT_CFLAGS += -Wstrict-prototypes
+       STRICT_CFLAGS += -Wshadow
+       STRICT_CFLAGS += -Wunused -Wall
+       LDFLAGS += -Wl,--gc-sections
+endif
+
 # To put more focus on warnings, be less verbose as default
 # Use 'make V=1' to see the full commands
 ifeq ("$(origin V)", "command line")
@@ -122,24 +125,36 @@ else
        Q := @
 endif
 
-%_command_list.h: %.cmd %.c
+$(cmdlist_dir)/%.command_list.h: %.cmd %.c | $(cmdlist_dir)
        @[ -z "$(Q)" ] || echo 'GEN $@'
        $(Q) ./command_util.bash h < $< >$@
-%_command_list.man: %.cmd %.c
+$(cmdlist_dir)/%.command_list.man: %.cmd %.c | $(cmdlist_dir)
        @[ -z "$(Q)" ] || echo 'GEN $@'
        $(Q) ./command_util.bash man < $< > $@
-%_completion.h: %.cmd %.c
+$(cmdlist_dir)/%.completion.h: %.cmd %.c | $(cmdlist_dir)
        @[ -z "$(Q)" ] || echo 'GEN $@'
        $(Q) ./command_util.bash compl $(strip $(call TOUPPER,$(*F)))_COMPLETERS \
                $(strip $(call TOUPPER,$(*F)))_COMMANDS < $< > $@
 
-server_command_list.h server_command_list.man server_completion.h: command.c
-afs_command_list.h afs_command_list.man afs_completion.h: afs.c aft.c attribute.c
-audiod_command_list.h audiod_command_list.man audiod_completion.h: audiod_command.c
+$(cmdlist_dir)/server.command_list.h \
+$(cmdlist_dir)/server.command_list.man \
+$(cmdlist_dir)/server.completion.h \
+: command.c
+
+$(cmdlist_dir)/afs.command_list.h \
+$(cmdlist_dir)/afs.command_list.man \
+$(cmdlist_dir)/afs.completion.h \
+: afs.c aft.c attribute.c
 
-server_command_lists := server_command_list.man afs_command_list.man
-audiod_command_lists := audiod_command_list.man
-play_command_lists := play_command_list.man
+$(cmdlist_dir)/audiod,command_list.h \
+$(cmdlist_dir)/audiod,command_list.man \
+$(cmdlist_dir)/audiod,completion.h \
+: audiod_command.c
+
+server_command_lists := $(cmdlist_dir)/server.command_list.man \
+       $(cmdlist_dir)/afs.command_list.man
+audiod_command_lists := $(cmdlist_dir)/audiod.command_list.man
+play_command_lists := $(cmdlist_dir)/play.command_list.man
 
 $(man_dir)/para_server.1: $(server_command_lists)
 $(man_dir)/para_audiod.1: $(audiod_command_lists)
@@ -166,58 +181,86 @@ $(man_dir)/para_%.1: $(ggo_dir)/%.ggo man_util.bash | $(man_dir) $(help2man_dir)
 $(hostbin_dir)/error2: error2.c | $(hostbin_dir)
        @[ -z "$(Q)" ] || echo 'HCC $<'
        $(Q) $(HOSTCC) -o $@ $<
-error2.h: $(hostbin_dir)/error2 Makefile
+error2.h: $(hostbin_dir)/error2 config.h
        @[ -z "$(Q)" ] || echo 'ER2 $<'
        @echo "$(object_executable_matrix)" | $< > $@
 
 $(object_dir)/%.o: %.c | $(object_dir)
-$(object_dir)/opus%.o: CPPFLAGS += $(opus_cppflags)
-$(object_dir)/gui%.o: CPPFLAGS += $(curses_cppflags)
-$(object_dir)/spx%.o: CPPFLAGS += $(speex_cppflags)
-$(object_dir)/%.cmdline.o: CPPFLAGS += -Wno-unused-function
-
-$(object_dir)/mp3_afh.o: CPPFLAGS += $(id3tag_cppflags)
-$(object_dir)/crypt.o: CPPFLAGS += $(openssl_cppflags)
-$(object_dir)/gcrypt.o: CPPFLAGS += $(gcrypt_cppflags)
-$(object_dir)/mp3dec_filter.o: CPPFLAGS += $(mad_cppflags)
-$(object_dir)/compress_filter.o: CPPFLAGS += -O3
-$(object_dir)/ao_write.o: CPPFLAGS += $(ao_cppflags)
-
-$(object_dir)/aacdec_filter.o \
-$(object_dir)/aac_common.o \
-$(object_dir)/aac_afh.o \
+
+$(object_dir)/opus%.o $(dep_dir)/opus%.d: CPPFLAGS += $(opus_cppflags)
+$(object_dir)/gui%.o $(dep_dir)/gui%.d: CPPFLAGS += $(curses_cppflags)
+$(object_dir)/spx%.o $(dep_dir)/spx%.d: CPPFLAGS += $(speex_cppflags)
+$(object_dir)/flac%.o $(dep_dir)/flac%.d: CPPFLAGS += $(flac_cppflags)
+
+$(object_dir)/mp3_afh.o $(dep_dir)/mp3_afh.d: CPPFLAGS += $(id3tag_cppflags)
+$(object_dir)/crypt.o $(dep_dir)/crypt.d: CPPFLAGS += $(openssl_cppflags)
+$(object_dir)/gcrypt.o $(dep_dir)/gcrypt.d: CPPFLAGS += $(gcrypt_cppflags)
+$(object_dir)/ao_write.o $(dep_dir)/ao_write.d: CPPFLAGS += $(ao_cppflags)
+
+$(object_dir)/interactive.o $(dep_dir)/interactive.d \
+: CPPFLAGS += $(readline_cppflags)
+
+$(object_dir)/resample_filter.o $(dep_dir)/resample_filter.d \
+: CPPFLAGS += $(samplerate_cppflags)
+
+$(object_dir)/mp3dec_filter.o $(dep_dir)/mp3dec_filter.d \
+: CPPFLAGS += $(mad_cppflags)
+
+$(object_dir)/aacdec_filter.o $(dep_dir)/aacdec_filter.d \
+$(object_dir)/aac_common.o $(dep_dir)/aac_common.d \
+$(object_dir)/aac_afh.o $(dep_dir)/aac_afh.d \
 : CPPFLAGS += $(faad_cppflags)
 
-$(object_dir)/ogg_afh.o \
-$(object_dir)/oggdec_filter.o \
+$(object_dir)/ogg_afh.o $(dep_dir)/ogg_afh.d \
+$(object_dir)/oggdec_filter.o $(dep_dir)/oggdec_filter.d \
 : CPPFLAGS += $(vorbis_cppflags)
 
-$(object_dir)/spx_common.o \
-$(object_dir)/spxdec_filter.o \
-$(object_dir)/spx_afh.o \
-$(object_dir)/oggdec_filter.o \
-$(object_dir)/ogg_afh.o \
-$(object_dir)/ogg_afh_common.o \
-$(object_dir)/opus%.o \
+$(object_dir)/spx_common.o $(dep_dir)/spx_common.d \
+$(object_dir)/spxdec_filter.o $(dep_dir)/spxdec_filter.d \
+$(object_dir)/spx_afh.o $(dep_dir)/spx_afh.d \
+$(object_dir)/oggdec_filter.o $(dep_dir)/oggdec_filter.d \
+$(object_dir)/ogg_afh.o $(dep_dir)/ogg_afh.d \
+$(object_dir)/ogg_afh_common.o $(dep_dir)/ogg_afh_common.d \
+$(object_dir)/opus%.o $(dep_dir)/opus%.d \
 : CPPFLAGS += $(ogg_cppflags)
 
+$(object_dir)/afs.o $(dep_dir)/afs.d \
+$(object_dir)/aft.o $(dep_dir)/aft.d \
+$(object_dir)/attribute.o $(dep_dir)/attribute.d \
+$(object_dir)/blob.o $(dep_dir)/blob.d  \
+$(object_dir)/mood.o $(dep_dir)/mood.d \
+$(object_dir)/playlist.o $(dep_dir)/playlist.d \
+$(object_dir)/score.o $(dep_dir)/score.d \
+$(object_dir)/server.o $(dep_dir)/server.d \
+$(object_dir)/vss.o $(dep_dir)/vss.d \
+$(object_dir)/command.o $(dep_dir)/command.d \
+$(object_dir)/http_send.o $(dep_dir)/http_send.d \
+$(object_dir)/dccp_send.o $(dep_dir)/dccp_send.d \
+$(object_dir)/udp_send.o $(dep_dir)/udp_send.d \
+$(object_dir)/send_common.o $(dep_dir)/send_common.d \
+$(object_dir)/mm.o $(dep_dir)/mm.d \
+: CPPFLAGS += $(osl_cppflags)
+
+$(object_dir)/%.cmdline.o: CFLAGS += -Wno-unused-function
+$(object_dir)/compress_filter.o: CFLAGS += -O3
+
 $(object_dir)/%.o: %.c | $(object_dir)
        @[ -z "$(Q)" ] || echo 'CC $<'
-       $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(DEBUG_CPPFLAGS) $<
+       $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(STRICT_CFLAGS) $<
 
 $(object_dir)/%.cmdline.o: $(cmdline_dir)/%.cmdline.c $(cmdline_dir)/%.cmdline.h | $(object_dir)
        @[ -z "$(Q)" ] || echo 'CC $<'
-       $(Q) $(CC) -c $(CPPFLAGS) -Wno-unused-function -o $@ $<
-
-$(dep_dir)/%.cmdline.d: $(cmdline_dir)/%.cmdline.c error2.h | $(dep_dir)
-       @[ -z "$(Q)" ] || echo 'DEP $<'
-       $(Q) ./depend.sh $(dep_dir) $(object_dir) $(cmdline_dir) \
-               $(CPPFLAGS) $< > $@
+       $(Q) $(CC) -c -o $@ $(CPPFLAGS) $(CFLAGS) $<
 
+# The compiler outputs dependencies either as foo.h or as some_directory/foo.h,
+# depending on whether the latter file exists. Since make needs the directory
+# part we prefix the dependency as appropriate.
 $(dep_dir)/%.d: %.c error2.h | $(dep_dir)
        @[ -z "$(Q)" ] || echo 'DEP $<'
-       $(Q) ./depend.sh $(dep_dir) $(object_dir) $(cmdline_dir) \
-               $(CPPFLAGS) $< > $@
+       $(Q) $(CC) $(CPPFLAGS) -MM -MG -MP -MT $@ -MT $(object_dir)/$(*F).o $< \
+               | sed -e "s@ \([a-zA-Z0-9_]\{1,\}\.cmdline.h\)@ $(cmdline_dir)/\1@g" \
+               -e "s@ \([a-zA-Z0-9_]\{1,\}\.command_list.h\)@ $(cmdlist_dir)/\1@g" \
+               -e "s@ \([a-zA-Z0-9_]\{1,\}\.completion.h\)@ $(cmdlist_dir)/\1@g" > $@
 
 para_recv para_afh para_play para_server: LDFLAGS += $(id3tag_ldflags)
 para_write para_play para_audiod: LDFLAGS += $(ao_ldflags) $(core_audio_ldflags)
@@ -276,22 +319,21 @@ $(prefixed_executables):
 
 clean:
        @[ -z "$(Q)" ] || echo 'CLEAN'
-       $(Q) rm -f $(prefixed_executables)
+       $(Q) rm -f para_*
        $(Q) rm -rf $(object_dir)
 
 clean2: clean
        @[ -z "$(Q)" ] || echo 'CLEAN2'
-       $(Q) rm -f *_command_list.* *_completion.h
        $(Q) rm -rf $(build_dir)
 distclean: clean2 test-clean
        @[ -z "$(Q)" ] || echo 'DISTCLEAN'
        $(Q) rm -f Makefile autoscan.log config.status config.log error2.h
-       $(Q) rm -rf autom4te.cache
        $(Q) rm -f GPATH GRTAGS GSYMS GTAGS
 
 maintainer-clean: distclean
-       rm -f *.tar.bz2 config.h configure config.h.in
-       rm -rf web_sync
+       @[ -z "$(Q)" ] || echo 'MAINTAINER-CLEAN'
+       $(Q) rm -f *.tar.bz2 config.h configure config.h.in
+       $(Q) rm -rf web_sync
 
 install: all man
        $(MKDIR_P) $(BINDIR) $(MANDIR)
@@ -301,13 +343,14 @@ install: all man
        $(MKDIR_P) $(VARDIR) >/dev/null 2>&1 || true # not fatal, so don't complain
 
 $(tarball):
-       rm -rf $(tarball_pfx).tar.bz2 $(tarball_pfx)
-       git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
+       $(Q) rm -rf $(tarball) $(tarball_pfx)
+       $(Q) git archive --format=tar --prefix=$(tarball_pfx)/ HEAD \
                | tar --delete $(tarball_delete) > $(tarball_pfx).tar
-       $(MKDIR_P) $(tarball_pfx)
-       ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION
-       cp -r $(autocrap) $(tarball_pfx)
-       tar rf $(tarball_pfx).tar $(tarball_pfx)/*
-       bzip2 -9 $(tarball_pfx).tar
-       ls -l $(tarball_pfx).tar.bz2
-       rm -rf $(tarball_pfx)
+       $(Q) $(MKDIR_P) $(tarball_pfx)
+       $(Q) ./GIT-VERSION-GEN > $(tarball_pfx)/VERSION
+       $(Q) cp $(autocrap) $(tarball_pfx)
+       $(Q) tar rf $(tarball_pfx).tar $(tarball_pfx)/*
+       $(Q) bzip2 -9 $(tarball_pfx).tar
+       $(Q) ls -l $(tarball)
+       $(Q) ln -sf $(tarball) paraslash-git.tar.bz2
+       $(Q) rm -rf $(tarball_pfx)
diff --git a/NEWS b/NEWS
index 305d9147b2f0be1a3f02697be4a769fed2024449..b945484b19fe4c3ae6276ad9088a1a71dc4b9558 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,12 +5,17 @@ NEWS
 0.5.4 (to be announced) "exponential alignment"
 -----------------------------------------------
 
+Another cleanup and bugfix release.
+
+       - New server command: tasks.
        - Minor cleanups to daemon.c.
        - New URLs for home page and git services.
        - Improved error diagnostics for the mvblob commands.
        - New sender subcommand: status.
        - Improved help text for server and afs commands.
        - audiod memory leak fixes.
+       - Miscellaneous improvements to the build system.
+       - oss_writer improvements.
 
 Download: ./releases/paraslash-git.tar.bz2
 
index 001619d5eb07f6a0da0368c2055a263be7f381e1..a2bfeb1995abc458daf953b036a0d2edcdd3aed1 100644 (file)
--- a/audioc.c
+++ b/audioc.c
@@ -72,7 +72,7 @@ fail:
 #include "sched.h"
 #include "buffer_tree.h"
 #include "interactive.h"
-#include "audiod_completion.h"
+#include "audiod.completion.h"
 
 static struct sched sched;
 
index d9df3847b61c1ff93f7fcf8389ccb90baadff17e..f8eeccee395a0a01a0fdd512e0449433c5b0da93 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -390,6 +390,7 @@ static void close_receiver(int slot_num)
        task_reap(&s->receiver_node->task);
        free(s->receiver_node);
        s->receiver_node = NULL;
+       stat_task->current_audio_format_num = -1;
        tv_add(now, &(struct timeval)EMBRACE(0, 200 * 1000),
                &a->restart_barrier);
 }
index 2aae0d805e8286303a43df96b8a172b73e21e093..df8f3936faf89a2c5b5550901d2e6e9bcf12ebdb 100644 (file)
@@ -30,7 +30,7 @@
 #include "write.h"
 #include "fd.h"
 #include "version.h"
-#include "audiod_command_list.h"
+#include "audiod.command_list.h"
 
 extern struct sched sched;
 extern char *stat_item_values[NUM_STAT_ITEMS];
index 2e138de2d5d98dc78796539a30d6f21bd94979c9..d432adbb64aa08a74e4dab7bd21360ebb2ef4227 100755 (executable)
@@ -14,7 +14,12 @@ echo preparing, parallel=$n...
 if test -f Makefile; then
        make maintainer-clean > /dev/null 2>&1
 fi
-autoconf
+autom4te \
+       --language=autoconf \
+       --output=configure \
+       --no-cache \
+       --warnings=all \
+       configure.ac
 autoheader
 echo configuring...
 ./configure $@ > /dev/null
index e0c978261980b01759fbe66d6d55f2bb541a82fc..f53147f1c8d6f1ae03cac62496c6fcf1aae65847 100644 (file)
--- a/client.c
+++ b/client.c
@@ -35,8 +35,8 @@ __printf_2_3 void (*para_log)(int, const char*, ...) = stderr_log;
 
 #ifdef HAVE_READLINE
 #include "interactive.h"
-#include "server_completion.h"
-#include "afs_completion.h"
+#include "server.completion.h"
+#include "afs.completion.h"
 
 struct exec_task {
        struct task *task;
index 6880cb4091a008b7063f5d7bed43f1ceda8ee5ac..a9f5aa697be2e3f7ab51819898b14afb7d0535c6 100644 (file)
--- a/command.c
+++ b/command.c
@@ -35,8 +35,8 @@
 #include "fd.h"
 #include "ipc.h"
 #include "user_list.h"
-#include "server_command_list.h"
-#include "afs_command_list.h"
+#include "server.command_list.h"
+#include "afs.command_list.h"
 #include "signal.h"
 #include "version.h"
 
@@ -363,8 +363,10 @@ static int com_sender(struct command_context *cc)
        for (i = 0; i < 10; i++) {
                mutex_lock(mmd_mutex);
                if (mmd->sender_cmd_data.cmd_num >= 0) {
+                       /* another sender command is active, retry in 100ms */
+                       struct timespec ts = {.tv_nsec = 100 * 1000 * 1000};
                        mutex_unlock(mmd_mutex);
-                       usleep(100 * 1000);
+                       nanosleep(&ts, NULL);
                        continue;
                }
                mmd->sender_cmd_data = scd;
index 37f2fbc6135d92d532570a0edfc0c1d8503cfe08..79b41a3addcf36f0066838c68edfea2b8de0b7c9 100644 (file)
@@ -3,8 +3,9 @@
 
 AC_PREREQ([2.61])
 
-AC_INIT([paraslash],[git],[maan@tuebingen.mpg.de])
-AC_CONFIG_HEADER([config.h])
+AC_INIT([paraslash], [m4_esyscmd_s(./GIT-VERSION-GEN)],
+       [maan@tuebingen.mpg.de], [], [http://people.tuebingen.mpg.de/maan/paraslash/])
+AC_CONFIG_HEADERS([config.h])
 
 AC_CONFIG_FILES([Makefile])
 AC_DEFUN([add_dot_o],[$(for i in $@; do printf "$i.o "; done)])
@@ -55,54 +56,6 @@ test -z "$install" && AC_MSG_ERROR(
 AC_PROG_CC
 AC_PROG_CPP
 
-AC_HEADER_DIRENT
-AC_HEADER_STDC
-AC_HEADER_SYS_WAIT
-AC_HEADER_STDBOOL
-AC_CHECK_HEADERS([arpa/inet.h ctype.h fcntl.h limits.h netdb.h netinet/in.h \
-       stdlib.h string.h sys/socket.h sys/time.h sys/timeb.h sys/un.h \
-       sys/ipc.h unistd.h utime.h stddef.h],
-       [], [AC_MSG_ERROR([$ac_header not found])])
-
-# Checks for typedefs, structures, and compiler characteristics.
-AC_C_CONST
-AC_C_INLINE
-AC_TYPE_OFF_T
-AC_TYPE_PID_T
-AC_TYPE_SIZE_T
-AC_HEADER_TIME
-AC_STRUCT_TM
-AC_TYPE_INT8_T
-AC_TYPE_INT16_T
-AC_TYPE_INT32_T
-AC_TYPE_INT64_T
-AC_TYPE_MODE_T
-AC_TYPE_SSIZE_T
-AC_TYPE_UID_T
-AC_TYPE_UINT8_T
-AC_TYPE_UINT16_T
-AC_TYPE_UINT32_T
-AC_TYPE_UINT64_T
-
-# Checks for library functions.
-AC_FUNC_FORK
-AC_PROG_GCC_TRADITIONAL
-AC_FUNC_MEMCMP
-AC_FUNC_MKTIME
-AC_FUNC_MMAP
-AC_FUNC_SELECT_ARGTYPES
-AC_FUNC_STAT
-AC_FUNC_STRFTIME
-AC_FUNC_VPRINTF
-AC_FUNC_CLOSEDIR_VOID
-AC_FUNC_LSTAT
-
-AC_CHECK_FUNCS([atexit dup2 memchr memmove memset \
-       regcomp select strchr strdup strerror strstr strtol uname \
-       fchdir gettimeofday localtime_r munmap strcasecmp strcspn \
-       strncasecmp strrchr strspn alarm mkdir inet_ntoa socket], [],
-       [AC_MSG_ERROR([function not found, cannot live without it])])
-
 executables="recv filter audioc write afh play"
 ################################################################## clock_gettime
 clock_gettime_lib=
@@ -1541,9 +1494,8 @@ done
 # use echo to replace newlines by space
 AC_SUBST(object_executable_matrix, $(echo $object_executable_matrix))
 
-for obj in $all_errlist_objs; do
-       SS="$SS SS_$(echo $obj | tr 'a-z' 'A-Z'),"
-done
+SS=$(for obj in $all_errlist_objs; do
+       printf '%s' " SS_$obj,"; done | tr 'a-z' 'A-Z')
 AC_DEFINE_UNQUOTED(DEFINE_ERRLIST_OBJECT_ENUM,
        [enum {$SS NUM_SS}],
        [list of all objects that use the paraslash error facility]
diff --git a/depend.sh b/depend.sh
deleted file mode 100755 (executable)
index c6424da..0000000
--- a/depend.sh
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/bin/sh
-
-# Call gcc to output a rule suitable for make describing the dependencies of
-# the given input file and parse the output to add a *.d target with the same
-# dependencies.
-
-# The first three arguments to that script are special: $1 is the
-# dependency directory and $2 is the object directory. These are used
-# to prefix the .d and .o targets respectively. $3 is the directory
-# that contains the *.cmdline.h files generated by gengetopt.
-
-# As gcc outputs the dependencies on the *.cmdline.h files either as
-# foo.cmdline.h or as $cmdline_dir/foo.cmdline.h, depending on whether the
-# latter file exists, we prefix the former with $2/
-
-dep_dir="$1"
-object_dir="$2"
-cmdline_dir="$3"
-shift
-shift
-shift
-
-LC_ALL=C cc -MM -MG "$@" \
-       | sed -e "s@^\(.*\)\.o:@$dep_dir/\1.d $object_dir/\1.o:@" \
-       -e "s@[         ^]\([a-zA-Z0-9_]\{1,\}\.cmdline.h\)@ $cmdline_dir/\1@g"
index 79e101a3e4e88f3e55b096b90780615b82b2e602..af90d5bd68cc70d520dbb87fb331ac0ba3f7e317 100644 (file)
@@ -13,7 +13,7 @@ $(cmdline_dir)/%.cmdline.h $(cmdline_dir)/%.cmdline.c: $(ggo_dir)/%.ggo | $(cmdl
        @[ -z "$(Q)" ] || echo 'GGO $<'
        $(Q) $(GENGETOPT) $(ggo_opts) < $<
 ifeq ($(ggo_descriptions_declared),no)
-       echo 'extern const char *$(*F)_args_info_description;' >> $(cmdline_dir)/$(*F).cmdline.h
+       @echo 'extern const char *$(*F)_args_info_description;' >> $(cmdline_dir)/$(*F).cmdline.h
 endif
 
 $(m4depdir)/%.m4d: $(m4_ggo_dir)/%.m4 | $(m4depdir)
index d4bfd446ab845ef1b381201bccf091fadfae96c0..35f7b6280115ec53bf88d5f2e303e34f8cc45d98 100644 (file)
@@ -31,6 +31,29 @@ struct private_oss_write_data {
        int bytes_per_frame;
 };
 
+/*
+ * We keep one bit of static storage to make sure only one instance of the oss
+ * writer is running at any given time.
+ */
+static bool sound_device_busy;
+
+static bool sound_device_is_busy(void)
+{
+       return sound_device_busy;
+}
+
+static void set_sound_device_busy(void)
+{
+       assert(!sound_device_busy);
+       sound_device_busy = true;
+}
+
+static void set_sound_device_idle(void)
+{
+       assert(sound_device_busy);
+       sound_device_busy = false;
+}
+
 static int get_oss_format(enum sample_format sf)
 {
        switch (sf) {
@@ -50,7 +73,7 @@ static void oss_pre_select(struct sched *s, void *context)
        struct private_oss_write_data *powd = wn->private_data;
        int ret = btr_node_status(wn->btrn, wn->min_iqs, BTR_NT_LEAF);
 
-       if (ret == 0)
+       if (ret == 0 || (sound_device_is_busy() && !powd))
                return;
        if (ret < 0 || !powd)
                return sched_min_delay(s);
@@ -65,6 +88,7 @@ static void oss_close(struct writer_node *wn)
                return;
        close(powd->fd);
        free(powd);
+       set_sound_device_idle();
 }
 
 /*
@@ -165,6 +189,7 @@ static int oss_post_select(__a_unused struct sched *s, void *context)
        size_t frames, bytes;
        int ret;
        char *data;
+       audio_buf_info abi;
 
        ret = task_get_notification(wn->task);
        if (ret < 0)
@@ -174,12 +199,16 @@ static int oss_post_select(__a_unused struct sched *s, void *context)
                goto out;
        if (!powd) {
                int32_t rate, ch, format;
+
+               if (sound_device_is_busy())
+                       return 0;
                get_btr_sample_rate(btrn, &rate);
                get_btr_channels(btrn, &ch);
                get_btr_sample_format(btrn, &format);
                ret = oss_init(wn, rate, ch, format);
                if (ret < 0)
                        goto out;
+               set_sound_device_busy();
                return 0;
        }
        btr_merge(btrn, wn->min_iqs);
@@ -192,6 +221,15 @@ static int oss_post_select(__a_unused struct sched *s, void *context)
        ret = 0;
        if (!FD_ISSET(powd->fd, &s->wfds))
                goto out;
+       /* get maximal number of bytes that can be written */
+       ret = ioctl(powd->fd, SNDCTL_DSP_GETOSPACE, &abi);
+       if (ret >= 0) {
+               size_t max_frames = abi.bytes / powd->bytes_per_frame;
+               if (max_frames == 0)
+                       goto out;
+               /* cap number of frames to avoid sound artefacts */
+               frames = PARA_MIN(frames, max_frames);
+       }
        ret = xwrite(powd->fd, data, frames * powd->bytes_per_frame);
        if (ret < 0)
                goto out;
diff --git a/play.c b/play.c
index ed1c6fefb84a060458714b77388e79183bdca762..90207520f5dc1eb21c38c706cf0bd8384de83e69 100644 (file)
--- a/play.c
+++ b/play.c
@@ -633,7 +633,7 @@ static char **get_mapped_keyseqs(void)
        return result;
 }
 
-#include "play_completion.h"
+#include "play.completion.h"
 
 
 /* defines one command of para_play */
@@ -645,11 +645,11 @@ struct pp_command {
        const char *help;
 };
 
-#include "play_command_list.h"
+#include "play.command_list.h"
 static struct pp_command pp_cmds[] = {DEFINE_PLAY_CMD_ARRAY};
 #define FOR_EACH_COMMAND(c) for (c = 0; pp_cmds[c].name; c++)
 
-#include "play_completion.h"
+#include "play.completion.h"
 static struct i9e_completer pp_completers[];
 
 I9E_DUMMY_COMPLETER(jmp);