<feed xmlns='http://www.w3.org/2005/Atom'>
<title>paraslash/daemon.h, branch next</title>
<subtitle>paraslash - network audio streaming tools</subtitle>
<id>https://git.tue.mpg.de/cgit/paraslash/atom?h=next</id>
<link rel='self' href='https://git.tue.mpg.de/cgit/paraslash/atom?h=next'/>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/'/>
<updated>2026-03-17T22:45:43Z</updated>
<entry>
<title>Switch to SPDX identifiers.</title>
<updated>2026-03-17T22:45:43Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2026-03-15T14:57:29Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=ea0cecf96e08c489fdcc94d046019f4ce46f58e2'/>
<id>urn:sha1:ea0cecf96e08c489fdcc94d046019f4ce46f58e2</id>
<content type='text'>
Generated with

	sed -i 's|Copyright.*Andre Noll.*|SPDX-License-Identifier: GPL-2.0 */|g' *.c *.h

followed by manually tweaking the result a bit. No license change intended.
</content>
</entry>
<entry>
<title>New audiod command: ll to change the log level at runtime.</title>
<updated>2022-07-02T19:29:17Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2021-10-19T20:19:25Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=27879fbdef3653aa7ba66eda97dc7cd731f2ce26'/>
<id>urn:sha1:27879fbdef3653aa7ba66eda97dc7cd731f2ce26</id>
<content type='text'>
The new public daemon_get_loglevel() is needed in the zero argument
case. Otherwise, the ll command handler parses the argument and calls
daemon_set_loglevel().

The lopsub stanza for the subcommand is stored in a separate file
which is currently only included by the lopsub suite for para_audiod,
but will be included as well by the server suite.

For similar reasons we implement the completer as a generic public
function, i9e_ll_completer(), although it only has one caller in
audioc.c. Another caller follows when the ll server command is added.
</content>
</entry>
<entry>
<title>server/audiod: Don't parse loglevel argument unnecessarily.</title>
<updated>2022-07-02T19:29:07Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2021-10-19T19:28:30Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=a0cd2ac59b891751067512dce77cf6223104932f'/>
<id>urn:sha1:a0cd2ac59b891751067512dce77cf6223104932f</id>
<content type='text'>
Currently the severity string (debug, info, etc.) given to --loglevel
is parsed twice: Once by lopsub, which returns the loglevel as the
index into the array of severity strings. We turn this index into a
string and pass the string to daemon_set_loglevel() which parses the
string again to turn it back into a log level value (which happens
to coincide with the index value).

Clean this up by letting daemon_set_loglevel() receive a log level
value rather than a severity string. This also allows us to remove
the now unused ENUM_STRING_VAL() macro from audiod.c.
</content>
</entry>
<entry>
<title>daemon: Introduce log mutex.</title>
<updated>2018-03-13T02:28:10Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2017-08-07T22:02:03Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=ced0c17d1a3ee0336dc7b35e69faff131dabecac'/>
<id>urn:sha1:ced0c17d1a3ee0336dc7b35e69faff131dabecac</id>
<content type='text'>
Currently the server processes append messages to the log file without
coordination. This usually does not cause problems, but sometimes
the log messages of the main server process and the afs process get
interleaved due to the lack of serialization.

This patch serializes access to the common log file by employing a
new lock: the log_mutex. Like the mmd_mutex, it is realized as an
one-element System V semaphore set.

Logging is performed by the daemon subsystem implemented in daemon.c.
This subsystem is also used by para_audiod which is single-threaded
and thus does not need to care about serialization of log messages.
To keep daemon.c working for both para_server and para_audiod,
struct daemon gains two optional methods, -&gt;pre_log_hook and
-&gt;post_log_hook. If the function pointers are not NULL, the methods
are called before and after a message is logged. For para_server
the methods call back to the server code to take and release the
lock. para_audiod does not need to be modified because if the new
function pointers are left at their default value NULL, so no hooks
are called.
</content>
</entry>
<entry>
<title>daemon: Fix race condition in daemonize().</title>
<updated>2016-10-04T10:19:48Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2016-06-16T18:17:21Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=7d28108f4691e0e7df199fd89f386cafeb3466c7'/>
<id>urn:sha1:7d28108f4691e0e7df199fd89f386cafeb3466c7</id>
<content type='text'>
If parent_waits is true, the parent process waits for a signal from
the child before it exits. However, this signal can arive before the
parent has set up its signal handler.

This patch closes the race window by switching from signals to
pipes. We now create a pipe before the new process is forked, and
let the parent block on read(2) until the child exits or indicates
success by writing a byte to one end of the pipe. The child process
receives the file descriptor of the writing end of the pipe as the
return value of daemonize().

The only user of the parent_waits feature is para_server, which is
changed accordingly.
</content>
</entry>
<entry>
<title>daemon: Make daemon_init_colors_or_die() independent of gengetopt.</title>
<updated>2016-08-07T12:03:44Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2016-06-21T07:19:57Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=cf47da359caca907d8f0fd8fe9f5f4ddb398b67d'/>
<id>urn:sha1:cf47da359caca907d8f0fd8fe9f5f4ddb398b67d</id>
<content type='text'>
The function receives the values given to the --log-color option as
a char * array, which is the type that gengetopt provides for the
arguments to string options which may be given multiple times.

This patch gets get rid of this implementation detail. The function no
longer takes the arguments to --log-color at all and applications now
must call daemon_set_log_color_or_die() themselves to set user-defined
per-loglevel colors.

To make this work, we let daemon_init_colors_or_die() return a
boolean which indicates whether color mode should be enabled, and
daemon_set_log_color_or_die() is made public. The two users of this
API, para_server and para_audiod, are adjusted accordingly.
</content>
</entry>
<entry>
<title>daemon: Constify argument of two functions.</title>
<updated>2016-07-03T13:57:16Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2016-06-21T21:27:54Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=92d85d340495154f3fda23f322af13fc9de42155'/>
<id>urn:sha1:92d85d340495154f3fda23f322af13fc9de42155</id>
<content type='text'>
daemon_set_logfile() and daemon_set_loglevel() do not modify the
passed string, so the type of the argument should be const char *.
</content>
</entry>
<entry>
<title>daemon: New option --priority for server and audiod.</title>
<updated>2015-10-15T21:10:57Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2015-10-08T16:25:06Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=bbd70648da0f4168df34c1f1651d67af089e7be6'/>
<id>urn:sha1:bbd70648da0f4168df34c1f1651d67af089e7be6</id>
<content type='text'>
On slow hardware it is useful to set the priority of the para_audiod
process to avoid sound artefacts due to buffer underruns.

This patch adds an option for this purpose which is available for
para_server and para_audiod.
</content>
</entry>
<entry>
<title>daemon: Introduce daemon_init_colors_or_die().</title>
<updated>2015-02-08T14:58:14Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2014-10-07T16:16:14Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=3943f98061a55f373991ecb2e4429ec02baf0555'/>
<id>urn:sha1:3943f98061a55f373991ecb2e4429ec02baf0555</id>
<content type='text'>
The log color logic is already contained in para_server and
para_audiod. Let's use a single function in daemon.c for this
purpose.

daemon_set_default_log_colors() and daemon_set_log_color_or_die()
can be made static since they are only called from daemon.c now.
</content>
</entry>
<entry>
<title>daemon.c: Remove unused daemon_clear_flag().</title>
<updated>2015-01-12T22:29:07Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2015-01-01T18:15:21Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=448cb0a00f29a7f0655e318e018b0d802fab95e9'/>
<id>urn:sha1:448cb0a00f29a7f0655e318e018b0d802fab95e9</id>
<content type='text'>
Found by cppcheck.
</content>
</entry>
</feed>
