paraslash.git
9 years agointeractive.c does not depend on curses.h.
Andre Noll [Sat, 7 Feb 2015 14:14:43 +0000 (15:14 +0100)]
interactive.c does not depend on curses.h.

On systems where libreadline is installed but curses headers are not,
the build fails because interactive.c, which includes curses.h, is
attempted to be compiled. Fortunately, it is unnecessary to include
this header, so this commit removes the include directive. However,
we must include para.h before the readline headers because the latter
depend on stdio.h.

9 years agoImprove signal init and shutdown.
Andre Noll [Tue, 7 Oct 2014 19:56:01 +0000 (19:56 +0000)]
Improve signal init and shutdown.

Currently all users of the signal subsystem define their own
signal_task structure and initialize the ->fd field from the return
value of para_signal_init(). It is more natural to let the signal
subsystem perform the allocation and the initialization.

This commit renames para_signal_init() to signal_init_or_die() and
changes the function to allocate, initialize and return a signal
task structure (rather than only the file descriptor of the signal
pipe as para_signal_init() did). Similarly, para_signal_shutdown()
is renamed to signal_shutdown() and now takes a pointer to the
signal_task structure which was obtained in an earlier call to
signal_init_or_die(), and frees it. Conversion of all users is
straight forward.

The patch also adds a missing call to signal_shutdown() to audiod.c,
closing an fd leak.

9 years agosignal: Provide generic signal_pre_select().
Andre Noll [Tue, 7 Oct 2014 19:16:16 +0000 (19:16 +0000)]
signal: Provide generic signal_pre_select().

Identical copies of this function exist in afs.c, gui.c, audiod.c and
server.c. This commit defines a generic version as an inline function
in signal.h and gets rid of the copies.

9 years agodaemon: Introduce daemon_init_colors_or_die().
Andre Noll [Tue, 7 Oct 2014 16:16:14 +0000 (16:16 +0000)]
daemon: Introduce daemon_init_colors_or_die().

The log color logic is already contained in para_server and
para_audiod. Let's use a single function in daemon.c for this
purpose.

daemon_set_default_log_colors() and daemon_set_log_color_or_die()
can be made static since they are only called from daemon.c now.

9 years agogui: Shutdown scheduler after schedule() returns.
Andre Noll [Tue, 7 Oct 2014 19:50:25 +0000 (19:50 +0000)]
gui: Shutdown scheduler after schedule() returns.

This makes sure all resources allocated by the scheduler are released.
Since we exit anyway when schedule() returns, this is not a serious
memory leak. The fix helps to identify real leaks though.

9 years agolist.h: Remove unused list_for_each_safe().
Andre Noll [Sat, 21 Jun 2014 17:20:23 +0000 (19:20 +0200)]
list.h: Remove unused list_for_each_safe().

9 years agoalsa_write: Use NULL instead of 0.
Andre Noll [Thu, 9 Oct 2014 03:06:15 +0000 (03:06 +0000)]
alsa_write: Use NULL instead of 0.

This silences the following sparse warning:

sparse: alsa_write.c:128:31: warning: Using plain integer as NULL pointer

9 years agoparaslash 0.5.4 v0.5.4
Andre Noll [Fri, 23 Jan 2015 12:37:38 +0000 (13:37 +0100)]
paraslash 0.5.4

9 years agoMerge branch 'refs/heads/t/afh_improvements'
Andre Noll [Fri, 23 Jan 2015 12:17:38 +0000 (13:17 +0100)]
Merge branch 'refs/heads/t/afh_improvements'

Was cooking for about a week.

mp3_afh: Detect both v1 and v2 tags.
ogg: Improve documentation of struct ogg_afh_callback_info.
ogg_afh: Add a comment about the three vorbis header packets.
afh_common.c: Avoid ifdefs.
afh loglevel adjustments.
wma: Rename comment_header.
afh: Fix fd leak.
afh: Unmap the audio file on errors.

9 years agoMerge branch 'refs/heads/t/tarball-build-fix'
Andre Noll [Fri, 23 Jan 2015 12:17:10 +0000 (13:17 +0100)]
Merge branch 'refs/heads/t/tarball-build-fix'

9 years agoMerge branch 'maint'
Andre Noll [Thu, 22 Jan 2015 17:45:38 +0000 (18:45 +0100)]
Merge branch 'maint'

Was cooking for a week and seems to be regression-free.

aft: Generate a remove event when adding duplicate files.
command.c: Add missing items to EMPTY_STATUS_ITEMS.
aft.c: Don't call osl_close_disk_object() on failure.
Add missing osl() wrapper calls.
fd.c: Add missing va_end().

The conflict in aft.c was trivial to fix up.

9 years agostring.c: Fix typo in comment.
Andre Noll [Sat, 21 Jun 2014 17:20:43 +0000 (19:20 +0200)]
string.c: Fix typo in comment.

9 years agobuild: Use curses_cppflags also for compiling gui.c.
Andre Noll [Mon, 19 Jan 2015 21:49:01 +0000 (22:49 +0100)]
build: Use curses_cppflags also for compiling gui.c.

The make pattern rule gui%.o does not match gui.o because there
must be at least one character to match the ‘%’. Consequently,
the curses cppflags are ignored for compiling gui.c.

Fix this by explicitly adding gui.o to the list of object files for
which $(curses_cppflags) must be added to CPPFLAGS.

9 years agogui.c Fix error handling of for_each_stat_item().
Andre Noll [Mon, 19 Jan 2015 20:17:20 +0000 (21:17 +0100)]
gui.c Fix error handling of for_each_stat_item().

In status_post_select(), if read_nonblock() succeeds (ret >= 0)
but for_each_stat_item() fails (ret2 < 0), para_gui aborts with

para_gui: error.h:639: para_strerror: Assertion `num > 0' failed.

This happens for example if the user is not allowed to connect to
para_audiod.

The problem is that the (non-positive) value -ret is passed to
para_strerror() as the error code rather than -ret2. This commit
fixes the bug. It was introduced one year ago in commit f840be8d
(gui: Introduce status_post_select()).

9 years agomood.c: Fix typo in comment of struct afs_statistics.
Andre Noll [Tue, 30 Sep 2014 22:37:19 +0000 (22:37 +0000)]
mood.c: Fix typo in comment of struct afs_statistics.

9 years agoscore.c: Add OSL_UNIQUE to storage flags of score column.
Andre Noll [Sun, 4 Jan 2015 02:50:02 +0000 (02:50 +0000)]
score.c: Add OSL_UNIQUE to storage flags of score column.

The comparator for this column never returns 0 unless the objects
being compared coincide.

9 years agostring.c: Simplify and improve for_each_line().
Andre Noll [Thu, 2 Oct 2014 21:12:34 +0000 (21:12 +0000)]
string.c: Simplify and improve for_each_line().

Much faster for large buffers. Idea: Search for zero byte
only until next cr.

9 years agoclient: Fix return value check for sb_received().
Andre Noll [Thu, 9 Oct 2014 00:33:06 +0000 (00:33 +0000)]
client: Fix return value check for sb_received().

This bug can cause the client to segfault if it is fed invalid data.

9 years agomp3_afh: Detect both v1 and v2 tags.
Andre Noll [Fri, 27 Dec 2013 03:14:57 +0000 (03:14 +0000)]
mp3_afh: Detect both v1 and v2 tags.

Currently the mp3 audio format handler first looks at id3v2 tags and
ignores any id3v1 tags if a version 2 tag is present. This patch makes
it look at both types of tags, and combine the result if necessary.

We use the opportunity to also get rid of the file descriptor mess
in mp3_get_id3(). It is completely unnecessary as lib3d3tag can make
a id3_t structure from a memory buffer. We simply pass (a part of)
the memory map of the audio file and are done.

The techinfo field of struct audio_format_handler_info is changed
to show which tag versions the various tags were extracted. Possible
values are none, v1, v2 and v1+v2.

9 years agoogg: Improve documentation of struct ogg_afh_callback_info.
Andre Noll [Wed, 25 Jun 2014 22:11:31 +0000 (00:11 +0200)]
ogg: Improve documentation of struct ogg_afh_callback_info.

Explain how the possible return values from the callback handler relate
to the header chunk. Also avoid to speak about vorbis and speex,
as the callbacks are also used by the opus audio format handler and
could in theory be used by any codec.

9 years agoogg_afh: Add a comment about the three vorbis header packets.
Andre Noll [Sun, 15 Dec 2013 22:37:45 +0000 (23:37 +0100)]
ogg_afh: Add a comment about the three vorbis header packets.

With this information at hand, it's easier to understand how the
vorbis packet callback works.

9 years agoafh_common.c: Avoid ifdefs.
Andre Noll [Sun, 29 Jun 2014 09:39:28 +0000 (11:39 +0200)]
afh_common.c: Avoid ifdefs.

For each optional audio format we currently have two #ifdefs in
afh_common.c: the first one controls whether cpp emits the declaration
of the corresponding init function of the audio format handler while
the second #ifdef prevents the ->init pointer from being initialized
for unsupported audio formats.

Declaring also those init functions which end up as undefined symbols
causes no problems because we never refer to them due to the second set
of #ifdefs.

Hence let's just get rid of the first set of #ifdefs and declare all
xxx_init() functions unconditionally.

9 years agoafh loglevel adjustments.
Andre Noll [Fri, 27 Dec 2013 22:39:11 +0000 (22:39 +0000)]
afh loglevel adjustments.

The list of supported audio formats is kind of important, so increase
the loglevel of the corresponding message. On the other hand, all the
"initializing xxx handler" messages do not really deserve the NOTICE
loglevel, so downgrade those to INFO.

9 years agowma: Rename comment_header.
Andre Noll [Fri, 1 Nov 2013 13:03:59 +0000 (14:03 +0100)]
wma: Rename comment_header.

The correct term for this header is "content description header".

9 years agoGIT-VERSION-GEN: Recognize git version in gitweb snapshots.
Andre Noll [Sun, 4 Jan 2015 23:12:07 +0000 (23:12 +0000)]
GIT-VERSION-GEN: Recognize git version in gitweb snapshots.

gitweb prepends the repo name and the git version number to all paths
of the snapshot tarballs (example: paraslash-32a81d7/). This commit
teaches GIT-VERSION-GEN to make use of this information. The patched
script reports the git version thusly encoded in the current directory,
rather than resort to "unnamed_version" as before.

9 years agobuild: Avoid git warning when building from tarball.
Andre Noll [Sat, 20 Dec 2014 11:36:11 +0000 (12:36 +0100)]
build: Avoid git warning when building from tarball.

The "git describe" command which is removed by this commit caused the
following warning when running "make" on a tree without .git directory
(extracted tarball or gitweb snapshot):

fatal: Not a git repository (or any of the parent directories): .git

This commit avoids the warning. Of course "make tarball" still fails
in this case, but this is expected.

9 years agoafh: Fix fd leak.
Andre Noll [Sun, 15 Dec 2013 21:39:21 +0000 (22:39 +0100)]
afh: Fix fd leak.

The main() function of para_afh obtains the open file descriptor from
mmap_full_file() which is then passed to compute_afhi(). If this file
descriptor is never closed, we have an fd leak.

Unfortunately it depends on the audio format handler whether fd
gets closed or not: the mp3 audio format handler closes it through
libid3tag's id3_file_close() while all other audio format handlers
leave it open.

Fix this by changing mp3_get_id3() to operate on a copy of the fd
instead so that the original fd remains open. The newly added close()
in afh.c thus fixes the fd leak and never closes an invalid fd.

9 years agoafh: Unmap the audio file on errors.
Andre Noll [Sun, 27 Oct 2013 10:24:43 +0000 (11:24 +0100)]
afh: Unmap the audio file on errors.

If compute_afhi() returns negative we miss to call para_munmap()
to unmap the audio file. This is not a serious bug since we exit
anyway in this case.

9 years agoUpdate year in copyright headers.
Andre Noll [Fri, 2 Jan 2015 02:14:03 +0000 (02:14 +0000)]
Update year in copyright headers.

Done with

files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2014\)* Andre Noll')
sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2014 Andre Noll/Copyright (C) \1 Andre Noll/1' $files

In previous years we ran a similar script to set the second year in
the range to the current year. This is kind of silly, so let's get
rid of this useless information.

This commit replaces "Copyright (C) A-B" by "Copyright (C) A" in
all file headers, i.e. only the first year (A) is left in. Accurate
information including time stamps for each change can be obtained
from the git history.

9 years agomanual: Shorten Installation section.
Andre Noll [Sat, 3 Jan 2015 04:27:21 +0000 (04:27 +0000)]
manual: Shorten Installation section.

This section contains some information which is already mentioned in
the previous section on required and optional packages. This patch
gets rid of the redundant parts.

9 years agomanual: Simplify keygen command.
Andre Noll [Mon, 5 Jan 2015 03:07:49 +0000 (03:07 +0000)]
manual: Simplify keygen command.

Specifying an empty passphrase with -N '' is simpler than asking
the user to press enter twice. This commit also improves the note on
short keys slightly.

9 years agomanual: Shorten section on generating RSA keys.
Andre Noll [Sat, 3 Jan 2015 04:31:47 +0000 (04:31 +0000)]
manual: Shorten section on generating RSA keys.

Remove the text about keys generated with "openssl genrsa". Such keys
are deprecated and support for them will eventually be removed.

This also removes the sentence about 0.3.x keys.

9 years agosync_filter: Document sync_parse_config().
Andre Noll [Sat, 3 Jan 2015 05:46:42 +0000 (05:46 +0000)]
sync_filter: Document sync_parse_config().

This should help to understand the lifetime of the various structures
of the sync filter.

9 years agofilter.c: Add documentation of stat_item_values[].
Andre Noll [Fri, 2 Jan 2015 01:38:06 +0000 (01:38 +0000)]
filter.c: Add documentation of stat_item_values[].

9 years agoafs.c: Improve documentation of send_option_arg_callback_request().
Andre Noll [Sun, 11 Jan 2015 13:24:14 +0000 (14:24 +0100)]
afs.c: Improve documentation of send_option_arg_callback_request().

The new text tries to emphasize that arbitrary structures may be
passed from the command handler to the callback (*not* the parent
process).

9 years agomood.c: Improve documentation of struct admissible_file_info.
Andre Noll [Fri, 2 Jan 2015 01:27:15 +0000 (01:27 +0000)]
mood.c: Improve documentation of struct admissible_file_info.

9 years agoaft.c: Improve documentation of struct ls_widths.
Andre Noll [Sun, 21 Dec 2014 17:42:00 +0000 (17:42 +0000)]
aft.c: Improve documentation of struct ls_widths.

9 years agotime.c: Remove unused d2tv().
Andre Noll [Thu, 1 Jan 2015 18:12:25 +0000 (18:12 +0000)]
time.c: Remove unused d2tv().

Found by cppcheck.

9 years agoversion.c: Remove unused version_git().
Andre Noll [Thu, 1 Jan 2015 18:21:55 +0000 (18:21 +0000)]
version.c: Remove unused version_git().

Found by cppcheck.

9 years agosched.c: Remove unused timeout_is_zero().
Andre Noll [Thu, 1 Jan 2015 18:20:39 +0000 (18:20 +0000)]
sched.c: Remove unused timeout_is_zero().

Found by cppcheck.

9 years agonet.c: Remove unused local_name().
Andre Noll [Thu, 1 Jan 2015 18:19:13 +0000 (18:19 +0000)]
net.c: Remove unused local_name().

Found by cppcheck.

9 years agodaemon.c: Remove unused daemon_clear_flag().
Andre Noll [Thu, 1 Jan 2015 18:15:21 +0000 (18:15 +0000)]
daemon.c: Remove unused daemon_clear_flag().

Found by cppcheck.

9 years agoscore.c: Remove unused admissible_file_loop_reverse().
Andre Noll [Thu, 1 Jan 2015 18:09:46 +0000 (18:09 +0000)]
score.c: Remove unused admissible_file_loop_reverse().

Found by cppcheck.

9 years agodaemon.c: Avoid setlinebuf().
Andre Noll [Fri, 2 Jan 2015 19:52:52 +0000 (19:52 +0000)]
daemon.c: Avoid setlinebuf().

Using setvbuf() is equivalent, and more portable. See setbuf(3)
for details.

9 years agofade.c: Don't use asctime().
Andre Noll [Thu, 1 Jan 2015 17:49:06 +0000 (17:49 +0000)]
fade.c: Don't use asctime().

POSIX.1-2008 marks asctime() as obsolete.

Found by cppcheck.

9 years agomm.c: Kill pointless initialization.
Andre Noll [Thu, 1 Jan 2015 18:00:07 +0000 (18:00 +0000)]
mm.c: Kill pointless initialization.

"ret" is set in the first statement after the declarations.

Found by cppcheck.

9 years agoRemove some unused error codes.
Andre Noll [Thu, 1 Jan 2015 22:30:30 +0000 (22:30 +0000)]
Remove some unused error codes.

Although E_AMP_SYNTAX and E_PREBUFFER_SYNTAX are assigned to a
variable, in both cases the variable is set to a different value
later without being used in between (detected by cppcheck).

9 years agoRemove unnecessary system header includes.
Andre Noll [Fri, 2 Jan 2015 02:05:40 +0000 (02:05 +0000)]
Remove unnecessary system header includes.

All these headers get included from para.h.

9 years agoRemove some duplicate #include statements.
Andre Noll [Thu, 1 Jan 2015 23:07:45 +0000 (23:07 +0000)]
Remove some duplicate #include statements.

9 years agoaudiod.h: Remove stale declaration of clean_exit().
Andre Noll [Thu, 1 Jan 2015 23:21:24 +0000 (23:21 +0000)]
audiod.h: Remove stale declaration of clean_exit().

The function was removed last year in commit 751fface.

9 years agoAssorted typo fixes in comments.
Andre Noll [Sun, 21 Dec 2014 13:16:14 +0000 (13:16 +0000)]
Assorted typo fixes in comments.

Quite a few..

9 years agoaft.c: Trivial whitespace fixes.
Andre Noll [Sun, 21 Dec 2014 13:24:41 +0000 (13:24 +0000)]
aft.c: Trivial whitespace fixes.

9 years agoafh.h: Trivial whitespace fix.
Andre Noll [Sun, 21 Dec 2014 13:12:08 +0000 (13:12 +0000)]
afh.h: Trivial whitespace fix.

9 years agoerror.h: Trivial typo and whitespace cleanups.
Andre Noll [Mon, 22 Dec 2014 00:56:46 +0000 (00:56 +0000)]
error.h: Trivial typo and whitespace cleanups.

9 years agoFix typo in manual.m4.
Andre Noll [Fri, 2 Jan 2015 15:24:37 +0000 (15:24 +0000)]
Fix typo in manual.m4.

9 years agoFix typo in --sample-format and --sample-rate documentation.
Andre Noll [Fri, 2 Jan 2015 00:18:47 +0000 (00:18 +0000)]
Fix typo in --sample-format and --sample-rate documentation.

9 years agoNEWS: Add link name in target.
Andre Noll [Sun, 4 Jan 2015 02:47:01 +0000 (02:47 +0000)]
NEWS: Add link name in target.

Without this, the link is shown as

 releases/paraslash-git.tar.bz2

9 years agonet.c: Fix format string in stringify_port().
Andre Noll [Thu, 1 Jan 2015 18:02:04 +0000 (18:02 +0000)]
net.c: Fix format string in stringify_port().

"port" is int, rather than unsigned. No biggy since at this point we
already know that port > 0.

Found by cppcheck.

9 years agogcrypt: Fix format string in debug output.
Andre Noll [Thu, 1 Jan 2015 17:57:50 +0000 (17:57 +0000)]
gcrypt: Fix format string in debug output.

"len" is of type int, not unsigned.

Found by cppcheck.

9 years agosync filter: Fix memory leak.
Andre Noll [Sun, 4 Jan 2015 02:45:38 +0000 (02:45 +0000)]
sync filter: Fix memory leak.

We leaked a struct sync_buddy for every audio file. Freeing the
structure in sync_close_buddy() should close this leak.

9 years agoaft: Generate a remove event when adding duplicate files.
Andre Noll [Wed, 24 Dec 2014 15:10:43 +0000 (15:10 +0000)]
aft: Generate a remove event when adding duplicate files.

Consider the following scenario:

add /foo.mp3
add /bar.mp3 # assume foo and bar differ
cp /foo.mp3 /bar.mp3
add /bar.mp3

In the last add command, the path being added (/bar.mp3) already exists
in the audio file table, and its hash also exists for a different path
(/foo.mp3).

The code in aft.c is smart enough to detect this. It first removes
the existing entry for /bar.mp3 and then considers the addition of
/bar.mp3 as a file rename /foo.mp3 -> /bar.mp3.

Unfortunately, we miss to generate the remove event in this case. This
patch should fix it. It also improves the message a bit.

9 years agocommand.c: Add missing items to EMPTY_STATUS_ITEMS.
Andre Noll [Tue, 23 Dec 2014 01:13:25 +0000 (01:13 +0000)]
command.c: Add missing items to EMPTY_STATUS_ITEMS.

Without this, para_gui shows stale information when no audio file
is open.

Add a doxygen comment to the macro while at it.

9 years agoaft.c: Don't call osl_close_disk_object() on failure.
Andre Noll [Sun, 21 Dec 2014 14:35:19 +0000 (14:35 +0000)]
aft.c: Don't call osl_close_disk_object() on failure.

If osl_open_disk_object() fails, we branch to the "err" label where
osl_close_disk_object() is called although no disk object exists. Fix
this by simply returning the osl error code in this case.

9 years agoAdd missing osl() wrapper calls.
Andre Noll [Sun, 21 Dec 2014 14:28:34 +0000 (14:28 +0000)]
Add missing osl() wrapper calls.

Some calls to osl library functions were missing the osl() wrapper
which transforms the osl error code into a paraslash error code.
This results in an incorrect error message on failure or worse.

print_chunk_table() and open_and_update_audio_file() of aft.c are
affected as well as the xxx_create() functions of blob.c.

9 years agofd.c: Add missing va_end().
Andre Noll [Thu, 1 Jan 2015 17:32:36 +0000 (17:32 +0000)]
fd.c: Add missing va_end().

This bug was introduced three years ago in commit 3e6bba77.

Found by cppcheck.

9 years agoMerge branch 'refs/heads/t/com_tasks'
Andre Noll [Sun, 14 Dec 2014 20:48:06 +0000 (21:48 +0100)]
Merge branch 'refs/heads/t/com_tasks'

cooking for almost a month.

9 years agoMerge branch 'refs/heads/t/kill_usleep'
Andre Noll [Sun, 14 Dec 2014 20:47:37 +0000 (21:47 +0100)]
Merge branch 'refs/heads/t/kill_usleep'

9 years agobuild: Add missing cpp flags.
Andre Noll [Sun, 7 Dec 2014 19:33:57 +0000 (20:33 +0100)]
build: Add missing cpp flags.

The directories passed as arguments to --with-flac-headers,
--with-samplerate-headers and --with-readline-headers are searched
for header files at configure time, but we ignore these directories
when compiling the source tree. This commit should fix this.

9 years agoMerge branch 'refs/heads/t/build_system'
Andre Noll [Sun, 7 Dec 2014 14:29:17 +0000 (15:29 +0100)]
Merge branch 'refs/heads/t/build_system'

Cooking for more than a month.

* t/build_system:
  Add message to target maintainer-clean.
  Use git version for tarball and AC_INIT().
  Run autom4te instead of autoconf.
  Remove depend.sh.
  Simplify make clean.
  Do not create .d files for gengetopt source files.
  Introduce cmdlist_dir.
  Remove pointless autoconf checks.
  Avoid excessive dep generation on Makefile changes.
  Add -Wformat to STRICT_CFLAGS.
  Compile with -Wall -Wunused only on linux.
  Separate CPPFLAGS and CFLAGS.
  Rename DEBUG_CPPFLAGS to STRICT_CFLAGS.
  Only compile with osl_cppflags where necessary.
  Remove pointless -r option to cp for target tarball.
  Make tarball commands quiet.
  Do not opencode $(tarball).
  Run tr only once in configure.ac.
  Silence ggo_descriptions_declared command.
  Call AC_CONFIG_HEADERS rather than AM_CONFIG_HEADER.
  Remove duplicate -Wno-unused-function.
  Honor --with-xxx-headers also for dependencies.

9 years agoMerge branch 't/sound_device_lock'
Andre Noll [Sun, 23 Nov 2014 16:06:04 +0000 (17:06 +0100)]
Merge branch 't/sound_device_lock'

Cooking since 2014-09-22.

* t/sound_device_lock:
  oss: Avoid sound artefacts on some setups.
  oss: Introduce sound device lock.
  audiod: Invalidate current audio format on close.

9 years agoserver: Add com_tasks().
Andre Noll [Sun, 28 Sep 2014 17:02:46 +0000 (17:02 +0000)]
server: Add com_tasks().

It is sometimes useful to see the task list of para_server. The
infrastructure for obtaining this information is already in sched.c,
so this is a rather simple matter.

9 years agocommand.c: Trivial whitespace fixes.
Andre Noll [Sun, 28 Sep 2014 16:55:58 +0000 (16:55 +0000)]
command.c: Trivial whitespace fixes.

No actual changes.

9 years agoMerge branch 'maint'
Andre Noll [Sun, 16 Nov 2014 09:36:05 +0000 (10:36 +0100)]
Merge branch 'maint'

9 years agocommand.c: Replace usleep() by nanosleep().
Andre Noll [Sun, 26 Oct 2014 10:36:35 +0000 (11:36 +0100)]
command.c: Replace usleep() by nanosleep().

POSIX.1-2001 declares usleep() obsolete and POSIX.1-2008 removes the
specification. Fortunately, there is only a single user of usleep()
in the tree: com_sender() which needs to retry the command if another
sender command is currently running. This commit changes com_sender()
to call nanosleep() instead of usleep() and adds a comment which
explains why we are going to sleep at this point.

9 years agobuild: Add message to target maintainer-clean.
Andre Noll [Sat, 30 Aug 2014 18:21:09 +0000 (20:21 +0200)]
build: Add message to target maintainer-clean.

Just to be consistent with clean and distclean. This also makes the
rm commands quiet.

9 years agobuild: Use git version for tarball and AC_INIT().
Andre Noll [Sun, 3 Aug 2014 09:44:48 +0000 (11:44 +0200)]
build: Use git version for tarball and AC_INIT().

It's kind of silly to use "git" as the version string at all times
except for releases. This commit changes the name of the generated
tarball to use the output of git describe. Hence the "tarball"
target creates a tarball named according to the current git HEAD. For
compatibility we provide a symlink with the old name.

9 years agobuild: Run autom4te instead of autoconf.
Andre Noll [Sun, 20 Apr 2014 02:03:39 +0000 (02:03 +0000)]
build: Run autom4te instead of autoconf.

This is equivalent, except we have the option to disable the autom4te
cache. This cache does not give significant speedups but creates the
annoying directory.

9 years agobuild: Remove depend.sh.
Andre Noll [Sat, 12 Jul 2014 11:40:44 +0000 (13:40 +0200)]
build: Remove depend.sh.

This script was rather clumsy, and it referred to gcc rather than
$(CC) as it should be. This commit adds a command to Makefile.real
that generates the .d files directly, which is not more complicated.

Use the opportunity to add -MP to the $(CC) command which generates
the dependency files. This option works around make errors in case
a header file is removed from the tree.

This change gives another speedup of ~15% for make dep.

9 years agobuild: Simplify make clean.
Andre Noll [Sun, 7 Sep 2014 18:26:22 +0000 (20:26 +0200)]
build: Simplify make clean.

This way, the clean target no longer contains on any variable
from autoconf.

9 years agobuild: Do not create .d files for gengetopt source files.
Andre Noll [Sat, 12 Jul 2014 09:50:02 +0000 (11:50 +0200)]
build: Do not create .d files for gengetopt source files.

The generated *.cmdline* files do not depend on headers of the source
tree, so it is pointless to let the compiler create dependencies
for them.

This speeds up make dep by 25%.

9 years agobuild: Introduce cmdlist_dir.
Andre Noll [Sun, 20 Apr 2014 02:03:09 +0000 (02:03 +0000)]
build: Introduce cmdlist_dir.

This puts all files generated by command_util.bash into a new
subdirectory inside the build directory. This way we don't need
to special-case these files any more in .gitignore, Doxyfile, make
clean. The compiler and depend.sh need to know this directory, so
we add -I$(cmdlist_dir) to CPPFLAGS and introduce a new parameter
for depend.sh.

To prevent cpp from including stale versions of the *command_list.h
files in the top level directory (left over from a previous build)
this commit renames the generated files slightly. For example,
audiod_completion.h becomes audiod.completion.h.

9 years agobuild: Remove pointless autoconf checks.
Andre Noll [Sun, 20 Apr 2014 00:20:12 +0000 (00:20 +0000)]
build: Remove pointless autoconf checks.

These checks never fail on any reasonably current system and
probably have never failed on any system this software was ever
compiled. Removing the checks reduces the configure time to 60%, so..

9 years agobuild: Avoid excessive dep generation on Makefile changes.
Andre Noll [Sun, 20 Apr 2014 00:55:12 +0000 (00:55 +0000)]
build: Avoid excessive dep generation on Makefile changes.

Letting error2 depend on config.h instead of Makefile should be no
worse, and it does not cause all dependencies to be recreated in the
common case where config.h remains unchanged after reconfiguration.

9 years agobuild: Add -Wformat to STRICT_CFLAGS.
Andre Noll [Sun, 4 May 2014 19:30:04 +0000 (21:30 +0200)]
build: Add -Wformat to STRICT_CFLAGS.

Avoids

cc1: warning: -Wformat-security ignored without -Wformat

on NetBSD

9 years agobuild: Compile with -Wall -Wunused only on linux.
Andre Noll [Sun, 4 May 2014 19:27:21 +0000 (21:27 +0200)]
build: Compile with -Wall -Wunused only on linux.

On *BSD the old set of CFLAGS causes warnings of the form

/usr/pkg/include/vorbis/vorbisfile.h:75:21: warning: 'OV_CALLBACKS_DEFAULT' defined but not used
/usr/pkg/include/vorbis/vorbisfile.h:82:21: warning: 'OV_CALLBACKS_NOCLOSE' defined but not used
/usr/pkg/include/vorbis/vorbisfile.h:89:21: warning: 'OV_CALLBACKS_STREAMONLY' defined but not used
/usr/pkg/include/vorbis/vorbisfile.h:96:21: warning: 'OV_CALLBACKS_STREAMONLY_NOCLOSE' defined but not used

This commit avoids these warnings by enabling -Wall and -Wunused only
on Linux systems. Let's also collect these flags in STRICT_CFLAGS
rather than CFLAGS to avoid warnings when compiling the *.cmdline.c
files.

9 years agobuild: Separate CPPFLAGS and CFLAGS.
Andre Noll [Sat, 19 Apr 2014 23:38:04 +0000 (23:38 +0000)]
build: Separate CPPFLAGS and CFLAGS.

The CPPFLAGS variable should consist of preprocessor options only and
should not contain any compiler options. Clearly this is not the case
at the moment.

This commit cleans up the mess and separates the per target CFLAGS
settings from the CPPFLAGS settings.

9 years agobuild: Rename DEBUG_CPPFLAGS to STRICT_CFLAGS.
Andre Noll [Sat, 19 Apr 2014 23:22:53 +0000 (23:22 +0000)]
build: Rename DEBUG_CPPFLAGS to STRICT_CFLAGS.

This variable is a misnomer for two reasons: First, its purpose is
unrelated to debugging. We just prefer to compile our own source
files with more strict flags than the flags used for the generated
*.cmdline.c files. Compiling those with the strict flags would
result in warnings we can not fix anyway. Second, these flags are
no preprocessor flags but compiler flags. So STRICT_CFLAGS is more
appropriate than DEBUG_CPPFLAGS.

9 years agobuild: Only compile with osl_cppflags where necessary.
Andre Noll [Sat, 19 Apr 2014 23:22:18 +0000 (23:22 +0000)]
build: Only compile with osl_cppflags where necessary.

Currently we include $(osl_cppflags) in the CC command used to compile
all objects, regardless of whether the command needs these flags. This
commit changes Makefile.real to add the flags only for those objects
which actually include osl.h.

9 years agobuild: Remove pointless -r option to cp for target tarball.
Andre Noll [Sun, 21 Sep 2014 18:54:55 +0000 (20:54 +0200)]
build: Remove pointless -r option to cp for target tarball.

We copy two regular files here, so there is no need to copy recursively.

9 years agobuild: Make tarball commands quiet.
Andre Noll [Sun, 24 Aug 2014 19:23:11 +0000 (21:23 +0200)]
build: Make tarball commands quiet.

There is no need to print all commands, unless V=1 is given
to make.

9 years agobuild: Do not opencode $(tarball).
Andre Noll [Sat, 19 Apr 2014 23:00:24 +0000 (23:00 +0000)]
build: Do not opencode $(tarball).

In Makefile.real the $tarball variable is defined as
$(tarball_pfx).tar.bz2. Use this definition instead of repeating it.

9 years agobuild: Run tr only once in configure.ac.
Andre Noll [Sat, 19 Apr 2014 22:53:00 +0000 (22:53 +0000)]
build: Run tr only once in configure.ac.

The configure script creates the subsystem error enums for config.h
from the list of object file names by turning the base name into
upper case and prepending "SS_". For the conversion to upper case we
currently execute the tr command once for each object.

This patch changes the corresponding shell code of configure.ac to
first build the full enum and then turn all words into upper case
in one go. This way tr is only executed once which should save us a
few cycles.

9 years agobuild: Silence ggo_descriptions_declared command.
Andre Noll [Sun, 4 May 2014 19:28:16 +0000 (21:28 +0200)]
build: Silence ggo_descriptions_declared command.

This command makes the build output a bit noisy.

9 years agobuild: Call AC_CONFIG_HEADERS rather than AM_CONFIG_HEADER.
Andre Noll [Wed, 27 Aug 2014 19:58:31 +0000 (21:58 +0200)]
build: Call AC_CONFIG_HEADERS rather than AM_CONFIG_HEADER.

The AM_CONFIG_HEADER autoconf macro is obsolete.

9 years agobuild: Remove duplicate -Wno-unused-function.
Andre Noll [Thu, 24 Jul 2014 20:05:56 +0000 (22:05 +0200)]
build: Remove duplicate -Wno-unused-function.

We compile the .c files generated by gengetopt with this option to
silence a compiler warning. The option is first added to CPPFLAGS
and then specified again in the rule for the *.cmdline.o target. This
gets rid of the second instance.

9 years agobuild: Honor --with-xxx-headers also for dependencies.
Andre Noll [Thu, 24 Jul 2014 20:47:23 +0000 (22:47 +0200)]
build: Honor --with-xxx-headers also for dependencies.

This is necessary for depend.sh to do the right thing. Without it the
generated dependency files may contain a reference to a system header.

9 years agoMerge branch 't/audiod_exit_cleanup'
Andre Noll [Sun, 26 Oct 2014 12:11:41 +0000 (13:11 +0100)]
Merge branch 't/audiod_exit_cleanup'

Cooked for two months.

* t/audiod_exit_cleanup:
  audiod: Clean up by notifying tasks.

9 years agoMerge branch 'refs/heads/t/server_cmds'
Andre Noll [Thu, 9 Oct 2014 21:37:09 +0000 (21:37 +0000)]
Merge branch 'refs/heads/t/server_cmds'

Was cooking for three weeks.

* Add sender subcommand "status".
* com_si(): Don't print git version string.
* Doxify the sender_subcommand enum.
* Overhaul help texts of server and afs commands.
* com_sender: Replace memcpy by struct copy.

Conflicts:
command.c

9 years agoMerge branch 't/kill_sender_osl_dep'
Andre Noll [Mon, 29 Sep 2014 20:00:01 +0000 (20:00 +0000)]
Merge branch 't/kill_sender_osl_dep'

Was cooking for three weeks.

* t/kill_sender_osl_dep:
  Make senders independent of afs and osl.

9 years agooss: Avoid sound artefacts on some setups.
Andre Noll [Mon, 8 Sep 2014 20:38:35 +0000 (22:38 +0200)]
oss: Avoid sound artefacts on some setups.

Large buffers which result in short writes cause sound artefacts on
certain setups. For example, 22KHz audio on Linux/ALSA in OSS mode
is affected.

This patch caps the number of bytes to write to the maximum possible
value. This value is obtained through the SNDCTL_DSP_GETOSPACE ioctl.