<feed xmlns='http://www.w3.org/2005/Atom'>
<title>paraslash/ipc.h, branch pu</title>
<subtitle>paraslash - network audio streaming tools</subtitle>
<id>https://git.tue.mpg.de/cgit/paraslash/atom?h=pu</id>
<link rel='self' href='https://git.tue.mpg.de/cgit/paraslash/atom?h=pu'/>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/'/>
<updated>2026-03-26T15:50:54Z</updated>
<entry>
<title>Merge topic branch t/spdx into master</title>
<updated>2026-03-26T15:50:54Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2026-03-26T15:50:08Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=c7d8695602cdde107a85cb63db846d92e48d9437'/>
<id>urn:sha1:c7d8695602cdde107a85cb63db846d92e48d9437</id>
<content type='text'>
Switch to SPDX licence identifiers

A single patch which replaces the first comment line of most .c and .h files
containing the copyright notice by standardized SPDX (Software/System Package
Data Exchange) nomenclature.

* t/spdx:
  Switch to SPDX identifiers.
</content>
</entry>
<entry>
<title>ipc.c: Drop return value of mutex_destroy().</title>
<updated>2026-03-18T21:37:46Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2026-03-15T17:35:06Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=c016c702c30c5132122e6ca16bb893c0fc03384d'/>
<id>urn:sha1:c016c702c30c5132122e6ca16bb893c0fc03384d</id>
<content type='text'>
No caller checks the return value. Log a message on errors rather than
fail silently.
</content>
</entry>
<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>load_chunk_table(): Don't trust afhi-&gt;chunks_total.</title>
<updated>2017-03-25T10:54:36Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@tuebingen.mpg.de</email>
</author>
<published>2016-12-26T22:50:34Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=5afe721aeb241bd21b832994ec2f2b7d8ff84766'/>
<id>urn:sha1:5afe721aeb241bd21b832994ec2f2b7d8ff84766</id>
<content type='text'>
Both callers pass a buffer to load_chunk_table() to initialize
afhi-&gt;chunk_table. The function does not check the size of the passed
buffer but relies on afhi-&gt;chunks_total to tell how many values to
copy from the buffer.

In other words, the buffer size gives an upper bound for the number of
chunks in the chunk table, but this bould is not checked. This patch
makes the code more robust by adding a suitable check. To this aim,
load_chunk_table() is changed to receive a pointer to an osl object
(which contains the buffer size) rather than only the buffer.

One caller, load_afd(), initializes the chunk table from a shared
memory area buffer. It does not know or care about the buffer size
so far. We introduce the the new IPC helper shm_size() to let it tell
the size of the area and pass it to load_chunk_table().
</content>
</entry>
<entry>
<title>ipc: Determine maximal size of a shared memory area at runtime.</title>
<updated>2011-09-16T19:41:47Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@systemlinux.org</email>
</author>
<published>2011-08-10T17:50:38Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=1fcea504b3a8541d039c3e63491e158433b06875'/>
<id>urn:sha1:1fcea504b3a8541d039c3e63491e158433b06875</id>
<content type='text'>
During command dispatch, the afs process allocates shm areas for the
query result and passes the identifiers via the local socket to the
child process of para_server which is executing the command. If the
write to the (non-blocking) local socket fails, for example because
the call would block, afs closes the connection to the child process
immediately to avoid deadlocks.

Therefore the maximal output size of an (afs) command depends
linearly on the size of the shared memory areas, so it is desirable
to allocate areas as large as possible. Currently, we use the SHMMAX
if it is defined and fall back to the safe default value of 64K
otherwise. However, this default is much smaller than the typical limit
of 32M on Linux. Moreover, the maximal size of a shared memory area
(shmmax) can be set at any time on most if not all operating systems,
so runtime detection of shmmax is to be preferred.

Unfortunately the way to obtain shmmax varies between operating
systems. On Linux, the value is available as the contents of a file
in /proc while on {Free,Net}BSD and Darwin sysctlbyname() must be
called. Moreover, BSD and Darwin use different identifiers for the
sysctlbyname() call.

So any code that determines shmmax at runtime and works on all
of the above systems must necessarily be ugly. This patch tries to
concentrate all ugliness in the new shm_get_shmmax() function, so that
the changes outside of ipc.c consist only of replacements SHMMAX -&gt;
shm_get_shmmax() and of the removal of the default SHMMAX setting.

The new function only determines shmmax once when it is called for
the first time.
</content>
</entry>
<entry>
<title>Complete the afs callback conversion.</title>
<updated>2008-03-24T23:18:01Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@systemlinux.org</email>
</author>
<published>2008-03-24T23:18:01Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=49bd626084bf5f48e4d80075258b6da4703752cf'/>
<id>urn:sha1:49bd626084bf5f48e4d80075258b6da4703752cf</id>
<content type='text'>
This makes it possible for the callbacks to pass a partial
result buffer through the command handler &lt;-&gt; callback socket.
This removes a serious limitation of previous paraslash-0.3.x
versions: As callbacks could not send data directly to the
command handler they had to store the full command output in
a buffer. This buffer was sent to the command handler after the
callback returns.

The problem with this approach is that it caused the callbacks
to  allocate large amounts of memory. If that amount exceeded what
can be stored in a shared memory area (32MB on Linux), the command
even failed.

The fix consists of adding a max_size field and a max_size_handler
function pointer to the para_buffer structure. Whenever para_printf()
would need to allocate more memory than specified by max_size, it
calls the max_size_handler which is supposed to send out the data.
para_printf then prints the requested data into the old but now
empty buffer.

Almost all users set the max_size_handler to pass_buffer_as_shm(),
a helper function implemented in afs.c that copies the buffer to
a shared memory area and sends its identifier through the socket.
</content>
</entry>
<entry>
<title>add more missing documentation</title>
<updated>2007-02-10T18:54:26Z</updated>
<author>
<name>Andre Noll</name>
<email>maan@systemlinux.org</email>
</author>
<published>2007-02-10T18:54:26Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=c79899fe6a1e8eb3086749f46c599d9790d99921'/>
<id>urn:sha1:c79899fe6a1e8eb3086749f46c599d9790d99921</id>
<content type='text'>
</content>
</entry>
<entry>
<title>fix the plm database tool</title>
<updated>2006-02-21T14:52:45Z</updated>
<author>
<name>Andre</name>
<email>maan@p133.(none)</email>
</author>
<published>2006-02-21T14:52:45Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=c5517c98d28a74a89086b0641e3633d16eaf9df7'/>
<id>urn:sha1:c5517c98d28a74a89086b0641e3633d16eaf9df7</id>
<content type='text'>
(Re)loading the playlist uses the new mutex and
shm helpers and is hopefully a race-free implementation.

It works as follows:

	The plm init function (parent, server context) reserves
	a shared memory area (client data) as well as two unlocked
	mutexes. The first mutex serializes access for racing clients
	that want to replace the playlist. The second mutex serializes
	the access between parent and child (com_lpl()).

	com_lpl() loads the playlist from the client into a tmp buffer.
	It then creates a shm area (client_shm) and copies that buffer
	to the area.  Further, another mutex (shm) is created. This
	mutex is initially locked.

	Next, it grabs the client lock and the server lock, and updates
	client_data with the id of client_shm. Then the parent is
	woken up (SIGUSR1) and the server lock is released. com_lpl()
	finally goes to sleep by acquiring the shm lock.

	In this situation, only the parent may run. It grabs the
	server lock, reads client_data to attach client_shm and
	reloads the playlist with data from client_shm. When ready,
	the parent detaches client_shm, and drops the shm lock and
	the server lock.

	This wakes up com_lpl() which destroys client_shm, the
	shm mutex and the tmp buffer.
</content>
</entry>
<entry>
<title>The new ipc subsystem</title>
<updated>2006-02-21T07:12:46Z</updated>
<author>
<name>Andre</name>
<email>maan@p133.(none)</email>
</author>
<published>2006-02-21T07:12:46Z</published>
<link rel='alternate' type='text/html' href='https://git.tue.mpg.de/cgit/paraslash/commit/?id=bad57eee70cdca87e8ba1af08d4e2ef6d2878620'/>
<id>urn:sha1:bad57eee70cdca87e8ba1af08d4e2ef6d2878620</id>
<content type='text'>
Contains functions for dealing with mutexes and shared memory.
</content>
</entry>
</feed>
