Compile with -Wsuggest-attribute=malloc. We already employ this attribute extensively to help the compiler improve optimization. However, a few malloc-like functions were not yet marked with __malloc. Fix that and enable the warning to make sure that new malloc-like functions get marked. Since not all supported compilers know about this warning option, we need to check at compile time whether the option is supported. Thanks to the existing cc-option make(1) function, this is a simple one-liner for Makefile.real.
audiod: Rename handle_connect(). Now that it has the same signature as para_server's handle_connect(), doxygen gets confused and complains as follows: audiod_command.c:359: warning: argument 'accept_fd' of command @param is not found in the argument list of handle_connect(int fd) This is a false positive, but since "handle_connect" is not a very descriptive name for a public function in the first place, let's rename it.
net: Drop fd_set parameter from para_accept(). As for read_nonblock(), the parameter is dispensable because it is only used for an optimization to avoid a system call. Get rid of it because it hinders the conversion from select(2) to poll(2).
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 }'
Convert para_audiod to lopsub. This commit replaces the gengetopt file for para_audiod by a lopsub suite, introducing several new files in m/lls/include which correspond to options also needed by para_server (which has not been converted to lopsub yet). The audiod_status_info enumeration is now provided by lopsub and can be removed from audiod.h. The patch also adds a new description section to the manual page para_audiod(1).
audiod: Move UID check from audiod_command.c to audiod.c. check_perms() is the only reason for the gengetopt config pointer being public and for passing the whitelist pointer to handle_connect() in audiod_command.c. The code get less convoluted by moving the permission check to audiod.c where both the conf pointer and the uid_whitelist are defined. This introduces the new public function uid_is_whitelisted() in audiod.c which replaces check_perms(). This allows to * pass only the UID to the check function, * drop the whitelist pointer argument from handle_connect(), * make the conf pointer in audiod.c static. The patch also reorders the function declarations in audiod.h a bit to separate the functions defined in audiod.c from those defined in audiod_command.c.
audiod: Reduce scope of struct audiod_command. This structure is only used in audiod_command.c, so move the declaration from audiod.h to audiod_command.c.
Merge branch 'refs/heads/t/audiod_acl' Cooking for about one month. * audiod: Allow to specify usernames in --user-allow.
audiod: Make struct slot_info local to audiod.c. Thanks to the previous commit there is only one user of struct slot_info left in audiod_command.c: decoder_flags(). Moving this function to audiod.c allows to make the structure private to audiod.c, along with the slot array and the MAX_STREAM_SLOTS and FOR_EACH_SLOT macros. Since audiod_command still needs the decoder flags for the stat command, the function is made public and renamed to audiod_get_decoder_flags().
audiod: Move get_play_time_slot_num() to audiod.c. audiod_status_dump() sends the play time string that corresponds to the current slot to all connected stat clients. It first calls the get_play_time_slot_num() helper to obtain the slot number, then calls get_time_string(slot_num). Currently the helper function is part of audiod_command.c, hence we expose the slot_info structure to audiod_command.c. Moving the helper from audiod_command.c to audiod.c is a first step to make this structure local to audiod.c. It also allows to remove the slot_num parameter from get_time_string().
audiod: Allow to specify usernames in --user-allow. It's more convenient to specify usernames rather than the UIDs of the users who may execute an audiod command. This patch allows to do so. For backwards compatibility we still need to accept numerical UIDs though. On startup we first try to convert each given --user-allow argument to a number and regard this number as a UID. Only if the conversion fails, we translate the argument to a username with getpwnam(). In order to not perform this conversion on each command, we allocate a UID whitelist at startup and populate it with the UIDs derived from both types of --user allow arguments. A pointer to the whitelist is passed as an additional argument to handle_connect(). The documentation is updated to reflect this change.
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.
audiod.h: Remove stale declaration of clean_exit(). The function was removed last year in commit 751fface.
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
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
audiod: Force status dump every 5 seconds. Without this, para_audiod might not notice for a long time when a stat client went away. Also avoid to dump the status twice.
audiod: Fix memory leak on exit: stat client. Currently we don't close stat clients on exit which results in (benign) memory leaks. Introduce the new public close_stat_clients() and call it from clean_exit() to avoid the leak. This patch also removes the pointles local variable "fd".
Change copyright year to 2013. Better late than never.
Change year in copyright message to 2012.
audiod: Remove unused num_filters(). This function has no callers. Also, get_audio_format_num() is only called from functions in audiod.c, so make this function static.