Merge topic branch t/overflow into master This series implements a new memory allocation API which checks for overflows. The first part of the series just renames the main allocation functions. Later patches in the series implement allocators which take two size_t arguments (like calloc(3)) and check whether the multiplication overflows by employing the __builtin_mul_overflow() primitive supported by gcc and clang. This requires us to bump the lowest supported gcc and clang version. * refs/heads/t/overflow: build: Compile with -ftrapv. string: Introduce arr_zalloc(). string: Introduce arr_alloc(). string: Introduce arr_realloc() and check for integer overflow. string: Rename para_calloc() -> zalloc(). string: Rename para_malloc() -> alloc(). string: Overhaul para_strdup().
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.
string: Rename para_calloc() -> zalloc(). Reword the documentation a bit since the function has never been a wrapper for calloc(3). No code changes.
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 }'
Remove some unnecessary includes. These headers are already included with para.h.
Convert audiod commands to lopsub. The four command lists (server, afs, audiod, play) and all executables will be converted to the long option parser library (lopsub). This first patch converts the audiod commands (on, off, cycle...) and adds the necessary infrastructure to the build system. The option parser for para_audiod is still generated by gengetopt and will be converted in a subsequent patch. The build system is updated to include an autoconf test which checks for the lopsub library and the lopsubgen executable. If the check fails, it prints instructions on how to download the lopsub package. Moreover, a section on lopsub is added to the INSTALL file and the library is listed as a required tool in the manual. The options and help texts of all audiod commands are moved from audiod.cmd to the new file audiod_cmd.suite.m4. Until all command lists are converted, man_util.bash needs an ugly hack to deal with the two kinds of files. The help texts have been reworked slightly, but no syntactical changes were performed. However, one side effect of the change is that options to audiod commands now accept short and long options, and that short options may be combined in the usual way. The error subsystem of paraslash is extended to treat lopsub errors analogous to errors from the osl libary: we reserve a new bit for error codes returned from lopsub library functions and a lls() wrapper function that must be used for all lopsub functions which return a lopsub error code on failure. The E_INVALID_AUDIOD_CMD error code can be removed since invalid commands are now detected by the lopsub library, which returns its own error code in this case. As a result of the conversion, struct audiod_command can be removed. Command handlers now take a pointer to a lopsub parse result instead of the (argc, argv) pair. The patch also changes the completers for audiod commands in audioc.c. to use the information in the generated audioc_cmd.lsg.h header file instead of duplicating this information. With the patch applied, para_audiod and para_audioc need to be linked with -llopsub. We still need to include ggo.h from audiod_command.c until receivers, filters and writers have been converted as well.
grab_client.c: Do not include filter.h. The code in this source file is independent of filters.
audiod: Clean up fd closing logic in command handlers. audiod_command.c contains this comment: /* * command handlers don't close their fd on errors (ret < 0) so that * its caller can send an error message. Otherwise (ret >= 0) it's up * to each individual command to close the fd if necessary. */ This is a somewhat weird rule and this commit gets rid of it. Instead, from now on the command handlers must not close their file descriptor and handle_connect() closes it unconditionally. The grab and stat commands need special treatment, which was the reason for imposing the above rule. They need to keep the file descriptor open to send the status items or the grabbed stream to the client. This patch makes these two handlers create a copy of the descriptor with dup(2). The new approach is simpler and less error-prone.
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: grab client task
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
sched: Rename new_post_select back to post_select.
sched: Kill old ->post_select variant. It has no more users.
grab client: Switch to the alternative post select method.
Change copyright year to 2013. Better late than never.
btr: Remove btr_free_node(). This has turned out to be source for bugs. Deallocate everything in btr_remove_node() hence making removing the node and freeing its resources an atomic operation. To avoid dangling pointers to freed btrn nodes, the argument of btr_remove_node() is changed to to struct btr_node **btrnp.
Merge branch 't/write_consolidation' This topic branch has been cooking in next for two weeks with no problems.