Consolidate EOF error codes. Currently we have ~15 error codes which indicate an EOF condition. One should suffice, so drop all codes except the generic E_EOF and use that everywhere.
net: Pass true/false instead of 0/1 to makesock(). The function receives a boolean argument, after all.
Rename ->{pre,post}_select methods to ->{pre,post}_monitor. The word "monitor" is neutral and continues to be correct after the switch from select(2) to poll(2). Pure rename, nothing to see here.
Hide implementation of para_fd_set(). This preparatory patch for replacing select() renames para_fd_set() to sched_fd_set(), moves it to sched.c and makes it static. All users are modified to call either of the two new public functions sched_monitor_{read,write}fd() which take a pointer to struct sched rather than an fd set pointer.
fd: Drop fd_set parameter from read_nonblock() and friends. This parameter is not necessary because its only purpose is to avoid the readv(2) system call in case it would likely return EAGAIN because we just called select(2) which reported that there is no data to read. Since the parameter is an obstacle for the conversion of the code base from select(2) to poll(2), get rid of it for the time being. If needed we can add back an equivalent optimization which checks for POLLIN after the conversion.
Remove ->init() of struct receiver. The previous patch removed the ->init() method of the afh receiver. Since the afh receiver was the only receiver that defined an init method, the method can now be removed from struct receiver. As a consequence, recv_init(), which calls each receiver's init method has become a no-op and can also be removed.
Shorten copyright notice. The GPLv2 line does not add any additional information, so drop it. This leaves a single line of legalese text for most files, which is about the amount of screen real estate it deserves. This patch was created with the following script (plus some manual fixups): awk '{ if (NR <= 5) { gs = gensub(/.*Copyright.* ([0-9]+).*Andre Noll.*/, "\\1", "g") if (gs != $0) year = gs next } if (NR == 6 && year != "") printf("/* Copyright (C) %s Andre Noll <maan@tuebingen.mpg.de>, see file COPYING. */\n", year) print }'
recv: Explain user data mechanism. This is not obvious, so it deserves a comment in recv_init(). The patch also adds a reference to each of the four instances of struct receiver, reducing the number of doxygen warnings when EXTRACT_ALL is set to NO in Doxyfile.
Convert receivers to lopsub. This converts the four receivers (afh, http, dccp, udp) to use the lopsub library instead of gengetopt. The command line options of the receivers are implemented as subcommands of the new recv_cmd lopsub suite. Hence the four gengetopt command line parsers and ->ggo_help of struct receiver can be removed. This change allows to get rid of the receiver array which was defined through the DEFINE_RECEIVER_ARRAY macro. We now store each receiver structure in the user_data pointer provided by lopsub. Since this structure is initialized at compile time (and constant since ->ggo_help is gone), ->init() of struct receiver is no longer needed to initialize the various function pointers. The function is now optional and does not take an argument any more. At the moment, only the afh receiver needs ->init() to initialize all supported audio format handlers. t0005 needs slight adjustment since the section headers of the help text have changed a bit.
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.
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
sched: Directly pass context pointer to pre/post_select(). The patch is large, but it's fairly straight forward: Instead of a task pointer all ->pre_select() and ->post_select() methods now receive the context pointer that was passed to the scheduler when the task was registered. This allows to kill the public task_context(). Two pre_select/post_select functions are not directly called by the scheduler: session_post_select(), generic_recv_pre_select(). These are changed to receive a proper struct rather than a void pointer. Note that generic_filter_pre_select() is not changed in this manner because some filters do not provide a pre_select wrapper but set task->pre_select to generic_filter_pre_select().
task_register() conversion: receivers This adds a new public function, task_reap(), to sched.c. It is called by para_audiod and para_play to free the memory occupied by the receiver node after EOF. sched_shutdown() can not be used for this purpose since the scheduler stays active during the life time of these programs (i.e. schedule() never returns) while receiver nodes come and go. The new task_reap() has to face the problem that it is called from another task's ->post_select() method, so removing the task being reaped from the scheduler task list is not possible in task_reap(). Hence this patch adds the new flag "dead" to struct task. It is initially unset and is turned on in task_reap() to indicate that (a) the task has exited (i.e. ->post_select() returned negative) and (b) task_reap() has been called to fetch the exit status. Only if this flag is set, the scheduler removes the task from the task list.
Merge branch 't/misc' Various fixes, improvements, cleanups. Cooking since 2014-02-22. * t/misc: (29 commits) build: Don't link with -lreadline if readline was not found. audiod: Skip NULL pointer check in compute_time_diff(). audiod: Make compute_time_diff() return void. com_stat(): Remove pointless uptime variable. gcrypt: Fix gcc warning on Ubuntu Lucid. flac: Try to link also without -logg. version.c: Fix comment of version_single_line(). doxygen: Expand all macros, in particular config.h. recv_common.c: Improve documentation of check_receiver_arg(). audiod: get_time_string() comment fix. configure: Really print opus audio file handler if opus lib was found. Overhaul doxygen main page. afs.h: Don't try to list all supported audio formats. Change copyright year to 2014. Add link to sideband.h in doxygen main page. Doxify error2.c and add GPL header. Add -Wdeclaration-after-statement. Add some missing includes. Makefile.real: Add clean2 to the list of phony targets. mood.c: Fix a trivial whitespace issue. ...
Merge branch 't/sync' Cooking since 2014-01-14. * t/sync: The sync filter. net: Let maksock() callers perform flowopt cleanup. net: makesock_addrinfo(): Make socketfd local to the loop. net: Let makesock() continue on setsockopt() failure. net: Reduce indentation level in makesock_addrinfo(). net: Further simplify makesock_addrinfo(). net: Replace the double loop of lookup_address() by a single loop. net: makesock(): Combine code for passive sockets. net: Change makesock_addrinfo() to set given flowopts before SO_REUSEADDR. net: Clarify code flow of makesock_addrinfo(). net: Remove unnecessary condition in makesock_addrinfo(). net: Remove pointless initialization in makesock_addrinfo(). net: Kill dead code in makesock_addrinfo(). net: Remove networking headers from para.h. net: Improve error handling of makesock_addrinfo(). net: Split makesock(), part 2: Introduce makesock_addrinfo(). net: Split makesock(), part 1: Introduce lookup_address(). net: Simplify makesock(). net: Fix parse_url(). net: Correct \return text of parse_url().
Change copyright year to 2014. This year, we're really on time. The changes in this patch were created by the following silly script: files=$(git grep -l 'Copyright (C) [0-9]\{4\}\(-2013\)* Andre Noll') sed --in-place= -e 's/Copyright (C) \([0-9]\{4\}\)-2013 Andre Noll/Copyright (C) \1-2014 Andre Noll/1' $files sed --in-place= -e 's/Copyright (C) 2013 Andre Noll/Copyright (C) 2013-2014 Andre Noll/1' $files
net: Remove networking headers from para.h. Most files don't need these, so include all headers related to networking in each individual file.
udp_recv: Fix clang warning. clang does not seem to like adding to a string literal: udp_recv.c:51:45: warning: adding 'size_t' (aka 'unsigned long') to a string does not append to the string [-Wstring-plus-int] if (memcmp(iov[1].iov_base, FEC_EOF_PACKET + iov[0].iov_len, ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~ udp_recv.c:51:45: note: use array indexing to silence this warning That's kind of silly, but if this simple change makes clang happy, so be it.
Revamp ggo help. This adds usage and description fields to struct ggo_help and changes ggo_print_help() to optionally print these. The boolean detailed_help flag of ggo_print_help() is replaced by a bitmask which lets the caller specify what to print. Four pre-defined masks are used to print the normal help, the detailed help, the help for modules (receivers, filters, writers) and the detailed module help. The new macro DEFINE_GGO_HELP can be employed to create a struct ggo_help from a gengetopt structure.
Don't check return value of command line parsers unnecessarily. All gengetopt parsers except the one for para_client are generated without the --no-handle-error option, i.e. these parsers exit on errors. Hence it is pointless to check return values.