DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
SVR5

allocb_physreq(D3str)


allocb_physreq -- allocate a STREAMS message block with physical requirements

Synopsis (Not in ODDI)

   #include <sys/types.h>
   #include <sys/stream.h>
   #include <sys/kmem.h>
   #include <sys/ddi.h>
   

mblk_t *allocb_physreq(int size, uint_t pri, physreq_t *preqp);

Description

allocb_physreq( ) tries to allocate a STREAMS message block with specific physical characteristics. The memory for the data buffer pointed to by the db_base member of the datab(D4str) structure satisfies the constraints specified by the physreq(D4) structure pointed to by preqp.

Arguments


size
The number of bytes in the message block.

pri
Hint to the allocator indicating priority of the request. Valid values are:

BPRI_LO
Used for normal data allocations. At this priority, allocb( ) may fail even though the requested buffer size is available. This priority is used the the Stream head write( ) routine to hold data associated with user calls.

BPRI_MED
Used for other non-critical allocations such as normal data and control block allocation. As with BPRI_LO, allocb( ) may fail at this priority even though a buffer of the requested size is available. However, BPRI_MED calls will fail less frequently than BPRI_LO calls.

BPRI_HI
Use for allocations that must succeed such as critical control message allocations, although success is not guaranteed.

Some implementations may choose to ignore this parameter.


preqp
Pointer to the physreq(D4) structure that specifies the physical requirements for the data buffer. The physreq structure must be allocated with the physreq_alloc(D3) function, populated, and prepped with the physreq_prep(D3) function before the call to allocb_physreq( ).

Return values

If successful, allocb_physreq( ) returns a pointer to the allocated message block of type M_DATA(D7str). If a block cannot be allocated, a NULL pointer is returned.

Usage

allocb_physreq( ) should be used instead of allocb(D3str) whenever the data is to be made accessible to a hardware device via DMA or when other physical requirements suh as starting address alignment or physical address range must be met. All allocb_physreq( ) allocations are made below the 4GB boundary.

Buffer allocation fails only when the system is out of memory which can satisfy the constraints. If no buffer is available, the bufcall(D3str) function can help a module recover from an allocation failure.

Context

Base or Interrupt.

Synchronization constraints

Does not block.

Driver-defined basic locks, read/write locks, and sleep locks may be held across calls to this function.

Hardware applicability

All

Version applicability

ddi: 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

SCO OpenServer 5 ODDI compatibility

This function is not supported for DDI drivers, which allocate all message blocks with the allocb(D3str) function, even for DMA.

References

allocb(D3str), bufcall(D3str), datab(D4str), freeb(D3str), kmem_alloc_physreq(D3), msgb(D4str), physreq(D4)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005