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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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..
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.
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.
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.
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.
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.
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.
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.
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.
Andre Noll [Tue, 15 Apr 2014 13:18:45 +0000 (13:18 +0000)]
oss: Introduce sound device lock.
Unlike ALSA with dmix, the OSS driver allows only a single opener of
the sound device at any given time. With para_audiod it may happen
that the writer of the buffer tree for the next audio file tries to
open the device while the old writer is still active. If this happens,
the second writer fails to open the device which causes the whole
buffer tree to be aborted.
This patch serializes access to the OSS sound device by adding
a locking mechanism to oss_write.c. Since audiod is single threaded
this is rather simple: The lock is taken in oss_post_select() when
the device is opened. It is released in oss_close() after the file
descriptor has been closed.
Andre Noll [Fri, 5 Sep 2014 07:09:03 +0000 (09:09 +0200)]
audiod: Invalidate current audio format on close.
Without this, audiod might start the next decoder instance too early,
using the audio format of the current file. The oss writer seems to
be particularly prone in triggering this.
Andre Noll [Sat, 26 Jul 2014 11:51:35 +0000 (13:51 +0200)]
Make senders independent of afs and osl.
Although senders don't know anything about the osl databases of
the audio file selector, all senders currently include afs.h and
osl.h. This is because:
* senders are part of para_server, so they include server.h,
* server.h has an audio_file_data structure embedded in struct
misc_meta_data, so struct audio_file_data must be declared
before server.h is included,
* struct audio_file_data is declared in afs.h,
* afs.h makes use of structures defined in <osl.h>.
This patch moves the declaration of struct audio_file_data from afs.h
to afh.h, which is also included by all senders. This allows to remove
the two include directives for afs.h and osl.h from all three senders.
Andre Noll [Tue, 12 Aug 2014 13:01:59 +0000 (15:01 +0200)]
Add htacess and icons for fancy indexing.
The apache server on people.tuebingen.mpg.de has FancyIndexing via
mod_autoindex enabled. Let's use its features to provide a nicer view
of the download directory.
This adds two .png icons for tarballs and signatures, respectively.
These icons are listed in the new .htaccess file to instruct apache
to show the icons next to the download links, along with a file
description.
On the old page files were listed alphabetically. So one had to scroll
to the bottom to get to the newest tarball link. FancyIndexing lets us
specify the sort order and we use this feature to show new files first.
Andre Noll [Sat, 9 Aug 2014 10:49:56 +0000 (12:49 +0200)]
doc: Change email address to maan@tuebingen.mpg.de
The mail server on systemlinux.org was down for more than a week
lately, so let's use an alternative official address. This commit
changes all maan@systemlinux.org addresses to maan@tuebingen.mpg.de.
Most .c and .h files contain the email address in the copyright header,
so they must all be patched. Three other files contain the address
for a different reason:
* README lists email and git, gitweb and home page URLs
* configure.ac needs it for configure -h
* version.c contains it for the -V option of all commands
Andre Noll [Sun, 17 Aug 2014 17:22:01 +0000 (19:22 +0200)]
Move git services to tuebingen.mpg.de.
Both the gitweb and the git daemon service have been relocated to
tuebingen.mpg.de. This commit changes the git-related URLs in the
repository to their counterparts at the new location.
The new location does not have a gitweb page dedicated to paraslash
alone. Instead, the gitweb service is provided by the gitolite
instance at git.tuebingen.mpg.de which hosts also a couple of other
repositories.
The "Changes" link of the the menu of the paraslash web pages points
to the dedicated gitweb page, so this link is removed from the menu.
There is still a gitweb link on the download page and a new one in
the README file.
Without a dedicated gitweb page, parts of the para.css style sheet
are no longer needed. This patch removes these parts, along with
git-logo.png, header and footer, which also have become unused.
Andre Noll [Tue, 12 Aug 2014 08:52:07 +0000 (10:52 +0200)]
web: Fix logo link.
The correct destination for this link is the current directory,
rather than /. The latter works only by coincidence since
paraslash.systemlinux.org is an apache vhost.
Andre Noll [Thu, 19 Jun 2014 09:46:31 +0000 (11:46 +0200)]
Add sender subcommand "status".
Currently, the si (server info) command prints information about each
sender, like the number of connected clients and the access control
lists. As this information is related to senders, the sender command
seems to be a better fit.
This commit introduces the new sender subcommand "status" for this
purpose and changes com_si() to not print the sender information any
more, making the output of com_si() bounded. It also renames the
->info() function of the senders to ->status() to make it clear that
this function is related to the new status subcommand.
The Networking paragraph of the manual is adjusted accordingly and
now contains an example of the status command.
Andre Noll [Sun, 13 Apr 2014 21:44:36 +0000 (21:44 +0000)]
Overhaul help texts of server and afs commands.
Each server command has a brief help text which is printed by
para_client help <command> and is also included in the para_server
manual page. These texts are defined in server.cmd and afs.cmd and
haven't seen much love for a long time. This commit improves most of
them and also fixes some formating issues.
Andre Noll [Wed, 1 Jan 2014 22:15:02 +0000 (22:15 +0000)]
audiod: Clean up by notifying tasks.
There are two ways to terminate para_audiod in a controlled way:
by executing the "term" command and by sending SIGINT or SIGTERM
to the process. Currently both code paths call clean_exit() from
some ->post_select function, which terminates para_audiod by calling
exit(3). Despite the name, this is "unclean" because tasks are not shut
down properly, so not all memory can be freed by this approach. While
this is not a big problem, it makes it more difficult to debug real
memory leaks.
This patch tries to overcome this problem by using notifications to
shut down the audiod tasks. Two new error codes E_AUDIOD_TERM and
E_AUDIOD_SIGNAL are introduced for the notification values. All tasks
are modified to check for notifications and now return the (negative)
notification value from their ->post_select() method if a notification
was received. Hence schedule() returns to main() and we may clean up
the resources allocated by the scheduler by calling sched_shutdown(),
along with the usual cleanup performed by clean_exit(). The latter
function is renamed to audiod_cleanup(), which is more to the point.
Andre Noll [Tue, 12 Aug 2014 06:47:52 +0000 (08:47 +0200)]
web: Top-align menu items.
Without this, elinks shows the menu items centered with respect to the
main web page. As most pages are short, this is not a real problem. But
for the longer NEWS page the menu was shown in the middle of the page,
making it hard to navigate.
Andre Noll [Mon, 11 Aug 2014 16:30:41 +0000 (18:30 +0200)]
manual: Add libopus-dev to package list for the impatient.
Although the opus libraries are not included in the two distributions
on which the paraslash code is build and tested regularly (Ubuntu 10.04
and 12.04), it is available on the newer 14.04 (Trusty) version. Most
people probably run 14.04 by now, so let's include it in the manual.
Andre Noll [Thu, 24 Jul 2014 20:42:28 +0000 (22:42 +0200)]
build: Do not hardcode gcc in depend.sh.
Although the clang compiler understands the -MM and -MG options,
we currently rely on gcc to generate the dependency files. Of course
this fails on systems where only clang is installed. The right fix
would be to use the make variable $(CC), but let's go for the minimal
fix that replaces gcc by cc in depend.sh for now.
Andre Noll [Sun, 20 Apr 2014 20:50:45 +0000 (20:50 +0000)]
build: Properly unset CPPFLAGS, LDFLAGS, LIBS.
Currently the directories specified via --with-ogg-headers and
--with-ogg-libs are taken into account also for vorbis/speex/opus
detection. This patch makes sure we start with a pristine values
for the three variables.
Andre Noll [Fri, 2 May 2014 20:07:24 +0000 (22:07 +0200)]
build: Fix --with-gcrypt-headers and --with-vorbis-headers.
The configure script sets the autoconf output variable gcrypt_cppflags
according to the configure option --with-gcrypt-headers, but
gcrypt_cppflags is never used for the build. Hence, if libgcrypt is
installed in a non-standard location, and that location is specified
as the argument to --with-gcrypt-headers, configure detects the gcrypt
header correctly, but the build fails nevertheless.
The same type of bug also exists for the --with-vorbis-headers option.
To fix this omission this patch sets both variables in Makefile.in
and references it in Makefile.real to compile the affected objects
with the correct flags.
Andre Noll [Thu, 3 Jul 2014 21:30:58 +0000 (23:30 +0200)]
afh_common: Improve documentation of clear_afh().
The doxygen comment for this public function was rather bad.
This commit changes the comment to clarify that the function does
not free the given afhi structure but only its contents.