STREAMS-UX Programmer's Guide (February 2007)

STREAMS Utilities Supported by HP-UX
Appendix B
157
NAME
bufcall (), streams_bufcall () Recover from allocb() failures.
SYNOPSIS
include <sys/stream.h>
toid_t bufcall, (uint size, int prilev, (*func)(void *arg), void *art):
toid_t streams_bufcall(uint size, int prilev, bufcall_fcn_t func, bufcall_arg_t arg);
PARAMETERS
size
Requested buffer size
prilev
It is no longer used. This parameter is provided only for portability purposes.
func
Address of function to be called when requested memory is available.
arg
Pointer to argument list to be passed to the function pointed to by
func
.
DESCRIPTION
This function is used when an allocb() request fails, and the caller wants to be notified as and when the
memory becomes available. The streams_bufcall()/bufcall() will schedule the function pointed to by
func
, to be invoked with an argument
arg
, whenever memory of at least size bytes is available and return a
non-zero identifier on successful scheduling. In effect, streams_bufcall()/bufcall() serves as a timeout
call of indeterminate length.
The non-zero identifier returned by streams_bufcall()/bufcall() may be passed to unbufcall() to cancel
the request.
RETURN VALUES
On success, streams_bufcall()/bufcall() returns a non-zero value that identifies the scheduling request.
On failure, streams_bufcall()/bufcall() returns 0 and the function pointed to by
func
will not be
executed.
CONSTRAINTS
streams_bufcall()/bufcall() can be called from thread or interrupt context. Only spinlocks of
STREAMS/UX user lock orders can be held across streams_bufcall()/bufcall(). STREAMS raises the
SPL before invoking the callback
func
and hence the callback
func
should not block.