*nix Documentation Project
·  Home
 +   man pages
·  Linux HOWTOs
·  FreeBSD Tips
·  *niX Forums

  man pages->FreeBSD man pages -> getpbuf (9)              
Title
Content
Arch
Section
 

PBUF(9)

Contents


NAME    [Toc]    [Back]

     pbuf, getpbuf, trypbuf, relpbuf -- functions for managing physical
     buffers

SYNOPSIS    [Toc]    [Back]

     #include <sys/param.h>
     #include <sys/systm.h>
     #include <sys/bio.h>
     #include <sys/buf.h>

     struct buf *
     getpbuf(int *pfreecnt);

     struct buf *
     trypbuf(int *pfreecnt);

     void
     relpbuf(struct buf *bp, int *pfreecnt);

DESCRIPTION    [Toc]    [Back]

     These functions are used to allocate and release physical buffers.

     The physical buffers are allocated at system startup and are maintained
     in a separate pool from the main system buffers.  They are intended for
     use by subsystems that cannot or should not be reliant on the main pool
     of buffers (for example the swap pager).  The system allocates between 16
     and 256 physical buffers depending on the amount of memory in the system.

     Each subsystem that allocates buffers via these calls is expected to manage
 its own percentage free counter.  If the value is initialized to -1
     the number of buffers available to the subsystem is limited only by the
     number of physical buffers available.  The number of buffers is stored in
     nswbuf which is defined in <sys/buf.h> and initialized in cpu_startup().
     A recommended initialization value is 1/2 nswbuf.

     The getpbuf() function returns the first available buffer to the user.
     If there are no buffers available, getpbuf() will sleep waiting for one
     to become available.  If pfreecnt is zero, getpbuf() will sleep until it
     increases.  pfreecnt is decremented prior to returning.

     The trypbuf() function returns the first available buffer.  If there are
     no buffers available, NULL is returned.  As well, if pfreecnt is zero,
     NULL is returned.	pfreecnt is decremented prior to returning a valid
     buffer.  If NULL is returned, pfreecnt is not modified.

     The relpbuf() function releases the buffer back to the free list.	If the
     buffers b_rcred or b_wcred structures are not NULL, they are freed.  See
     crfree(9).

     pfreecnt is incremented prior to returning.

RETURN VALUES    [Toc]    [Back]

     getpbuf() and trypbuf() return a pointer to the buffer.  In the case of
     trypbuf(), NULL can also be returned indicating that there are no buffers
     available.

AUTHORS    [Toc]    [Back]

     This manual page was written by Chad David <[email protected]>.


FreeBSD 5.2.1			 July 9, 2001			 FreeBSD 5.2.1
[ Back ]
 Similar pages
Name OS Title
physical_io_buffers HP-UX total buffers for physical I/O operations
pvmove HP-UX move allocated physical extents from one LVM physical volume to other physical volumes
uihashinit FreeBSD functions for managing UID information
uidinfo FreeBSD functions for managing UID information
uifree FreeBSD functions for managing UID information
uihold FreeBSD functions for managing UID information
uifind FreeBSD functions for managing UID information
m_free NetBSD functions and macros for managing memory used by networking code
m_freem NetBSD functions and macros for managing memory used by networking code
m_adj NetBSD functions and macros for managing memory used by networking code
Copyright © 2004-2005 DeniX Solutions SRL
newsletter delivery service