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

rmfree(D3)


rmfree -- free space into a private space management map

Synopsis

   #include <sys/types.h>
   #include <sys/map.h>
   #include <sys/ddi.h>
   

void rmfree(struct map *mp, size_t size, ulong_t index);

Description

rmfree releases space into the private space management map pointed to by mp and wakes up any processes that are waiting for space.

Arguments


mp
Pointer to the map.

size
Number of units to free into the map.

index
Index of the first unit of the space being freed.

Return values

None

Usage

rmfree should be called to return space that had been allocated by a previous call to rmalloc(D3), in which case index is the value returned from the corresponding call to rmalloc. rmfree should also be called to add space to a newly allocated map prior to the first call to rmalloc, in which case index specifies the base of the space being added.

Both size and index are in arbitrary units. The driver using the map places whatever semantics on the units are appropriate for the type of space being managed. For example, units may be byte addresses, pages of memory, or blocks on a device.

If the space being returned is adjacent to other space in the map, rmfree will coalesce the adjacent fragments.

If the rmfree call causes the number of fragments in the map to exceed the number of map entries specified by rminit(D3) (for singlethreaded drivers) or rmallocmap(D3) (for multithreaded drivers) the following warning message is displayed on the console:

   WARNING: rmfree map overflow mp lost size items at index
This implies that the driver should specify a larger number of map entries when initializing the map.

Context and synchronization

All contexts.

Examples

See rmalloc(D3) for an example of rmfree.

Hardware applicability

All

Version applicability

ddi: 1, 2, 3, 4, 5, 5mp, 6, 6mp, 7, 7mp, 7.1, 7.1mp, 8, 8mp

References

rmalloc(D3), rmalloc_wait(D3), rmallocmap(D3), rmfreemap(D3), rminit(D3), rmsetwant(D3)
19 June 2005
© 2005 The SCO Group, Inc. All rights reserved.
OpenServer 6 and UnixWare (SVR5) HDK - June 2005