net: Rename para_connect_simple() -> para_connect(). We used to have para_connect() at some point (hence the need for the _simple suffix), but it was removed long ago.
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().
send: Avoid select-specific arguments in {pre,post}_select(). Just pass a pointer to struct sched instead of the fd sets. Since two of the prototypes declared in send.h now refer to this structure, sched.h must be included before send.h. The udp sender implements neither ->pre_select() nor ->post_select(), so we only need to fix the order in which send.h and sched.h are included.
string: Rename para_calloc() -> zalloc(). Reword the documentation a bit since the function has never been a wrapper for calloc(3). No code changes.
server: Loglevel adjustments for shutdown path. The log output of the server is rather verbose with respect to shutdown messages. These not only occur when the server exits but also in command handler context each time a command is executed. This patch quietens these messages in two ways. For some messages we simply reduce the log level. For others we print the message only in server context, i.e. when process_is_command_handler() returns false.
Merge branch 'refs/heads/t/list-cleanups' A bunch of simple patches which streamline the macros and inline functions of list.h which were taken from linux long ago without adjusting the coding style. Cooking for three months. * refs/heads/t/list-cleanups: list.h: Convert INIT_LIST_HEAD macro to inline function. list.h: Fix parameter doc of iterators. list.h: Move list_is_singular() up. list.h: Rename argument of list_move(). list.h: Don't use "new" as an variable name. list.h: Open-code LIST_POISON1 and LIST_POISON2. list.h: Get rid of internal helpers. list.h: Trivial cleanups. list.h: Remove unused list_for_each_entry_safe_reverse.
upd sender: Don't send FEC EOF from command handler context. Without this, the EOF packet might be sent twice: once by the command handler which stopped the stream and once by the server process. This does not hurt, but results in additional unnecessary network traffic, so return early from udp_close_target() when we're running in command handler context.
list.h: Convert INIT_LIST_HEAD macro to inline function. Inline functions are easier to read and write, and we get type safety.
Merge branch 'refs/heads/t/clean_server_exit' This series removes many memory leaks of para_server by refactoring the shutdown and signal handling code. Most of the leaks happen only at shutdown and are hence harmless. But it is still good to plug the leaks because this puts more focus on real memory leaks in the valgrind output. The merge conflicted rather badly due to the changes introduced with the crypt branch that was merged last week. The resolution has been thoroughly tested, though. * refs/heads/t/clean_server_exit: (32 commits) command.c: Document return value of handle_connect(). user_list: Make list head static. afs: Allow database switching on sighup. afs: Free current mood or playlist on exit. afs: Free status items on exit. afs: Shutdown signals on exit. server: Free parse result also in afs. afs: Deplete user list at startup. server: Free audio file header on exit. sender: Deplete ACLs on exit. Remove some unused includes from {dccp,http}_send.c. server: Make argument of user_list_init() constant. server: Deplete user list on exit. server: Combine user_list_init() and populate(). server: Move para_fgets() to user_list.c. server: Initialize user list at compile time. server: Rename functions related to user lists. server: Constify return value of lookup_user(). server: Let stat command handler perform cleanup on signals. server: Have afs process close the current mood on exit(). ...
Move MAX_HOSTLEN from server.h to net.h. This generic networking-related constant does not belong to server.h. However, since server.h uses the constant, we have to make sure that net.h is included before server.h.
server: Cleanly shut down senders on exit. This introduces ->shutdown for struct sender. Each of the three senders implements the new method to close file descriptors and to deallocate the resources occupied by the sender. The method is only called on exit via the new vss_shutdown() from both server and command handler context after schedule() returns. We need to introduce another helper, process_is_command_handler(), to distinguish between the two callers.
server: Make array of senders constant. Currently we define an array of static non-constant sender structures in vss.c with only ->init being initialized at compile time. At startup the ->init method of each sender must fill out the other function pointers of the structure. This approach is kind of pointless, as these pointers are known at compile time and never change. This patch changes the three senders to define a non-static constant sender structure instead. The vss maintains an array of pointers to these structures. Since the new sender structures are non-static, they need to be doxified. We use the opportunity to provide an overview of each sender. The patch also introduces FOR_EACH_SENDER(), a macro which is used several times to replace the open-coded loops we had before.
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 }'
Merge branch 'maint' A fix for the udp sender which silences an annoying log message. * maint: udp sender: Send EOF package only once.
udp sender: Send EOF package only once. We already have the per target ->sent_fec_eof flag, but we only set it after the EOF packet was sent *successfully*. It's pointless to send the packet more than once, so this patch modifies udp_close_target() to set the flag regardless of whether the write(2) call succeeded.
Convert para_server to lopsub. This is the last executable to be converted to lopsub. acl_init() is removed from acl.c, and the initialization of the access control list is moved to init_sender_status() of send_common.c. It now takes an lls_opt_result argument and calls acl_add_entry() for each argument given. The latter function needs to be made public. In dccp_send.c we check the FEC parameters and change the gengetopt config structure to contain the default values if invalid FEC parameters were given. With lopsub this is no longer possible as the lls_parse_result structure is opaque. We copy the FEC parameters to a dccp_fec_client structure anyway, so is it easiest to move the check there. The patch removes the unused gengetopt option files but leaves the gengetopt infrastructure of the build system in place. The build system will be cleaned up in subsequent patches.
udp_send.c: Send EOF packet only once. Currently this can be sent many times, which is pointless and might confuse clients. This patch adds a bool member to struct udp_target to keep track whether the EOF packet has been sent.
Merge branch 'refs/heads/t/com_sender' A single commit which was cooking in next for several months. * refs/heads/t/com_sender: Avoid duplication of sender subcommands.
udp_send.c: Remove pointless function. udp_init_session() has only one caller in the same file.
Avoid duplication of sender subcommands. The list of sender subcommands (add, delete, allow, deny, on, off) is defined as an enumeration in send.h. This list is duplicated in check_sender_args() of command.c which contains the six subcommands as C-strings to be matched against the first word of the sender command line. For the code to work properly it is essential that the two subcommand lists are identical, which is a bad design that is quite error prone. Fortunately it is easy to avoid the duplication with a little preprocessor fu. Since the subcommands are spelled in lower case and there is no toupper function in CPP, we need to change the subcommand part of the enumeration constants to lower case. The bulk of the patch consists in trivial changes of all the users of these constants.