]> git.tuebingen.mpg.de Git - paraslash.git/commit
Complete the afs callback conversion.
authorAndre Noll <maan@systemlinux.org>
Mon, 24 Mar 2008 23:18:01 +0000 (00:18 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 24 Mar 2008 23:18:01 +0000 (00:18 +0100)
commit49bd626084bf5f48e4d80075258b6da4703752cf
treeb5030797596077fafac0aa50c806d70bd8231124
parent19c44d502e169d4801449861e7ef0252e3b1dc5b
Complete the afs callback conversion.

This makes it possible for the callbacks to pass a partial
result buffer through the command handler <-> 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.
NEWS
afs.c
afs.h
aft.c
attribute.c
blob.c
ipc.h
mood.c
playlist.c
string.c
string.h