[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]

Technical Reference: Communications, Volume 2


bufcall Utility

Purpose

Recovers from a failure of the allocb utility.

Syntax

#include <sys/stream.h>


int
bufcall(size, pri, func, arg)
uint size;
int pri;
void (* func)();
long arg;

Description

The bufcall utility assists in the event of a block-allocation failure. If the allocb utility returns a null, indicating a message block is not currently available, the bufcall utility may be invoked.

The bufcall utility arranges for (*func)(arg) call to be made when a buffer of the number of bytes specified by the size parameter is available. The pri parameter is as described in the allocb utility. When the function specified by the func parameter is called, it has no user context. It cannot reference the u_area and must return without sleeping. The bufcall utility does not guarantee that the desired buffer will be available when the function specified by the func parameter is called since interrupt processing may acquire it.

On an unsuccessful return, the function specified by the func parameter will never be called. A failure indicates a temporary inability to allocate required internal data structures.

On multiprocessor systems, the function specified by the func parameter should be interrupt-safe. Otherwise, the STR_QSAFETY flag must be set when installing the module or driver with the str_install utility.

Note: The stream.h header file must be the last included header file of each source file using the stream library.

Parameters


size Specifies the number of bytes needed.
pri Specifies the relative importance of the allocated blocks to the module. The possible values are:
  • BPRI_LO
  • BPRI_MED
  • BPRI_HI


func Specifies the function to be called.
arg Specifies an argument passed to the function.

Return Values

The bufcall utility returns a value of 1 when the request is successfully recorded. Otherwise, it returns a value of 0.

Implementation Specifics

This utility is part of STREAMS Kernel Extensions.

Related Information

The allocb utility, unbufcall utility, mi_bufcall utility.

List of Streams Programming References and Understanding STREAMS Messages in AIX 5L Version 5.1 Communications Programming Concepts.

Understanding STREAMS Synchronization in AIX 5L Version 5.1 Communications Programming Concepts.


[ Previous | Next | Table of Contents | Index | Library Home | Legal | Search ]