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.