NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUE | ERRORS | RESTRICTIONS | ATTRIBUTES | SEE ALSO
#include <mem/chMem.h>int rgnFree(KnCap *actorcap, KnRgnDes *rgndesc);
MEM_FLAT, MEM_PROTECTED, MEM_VIRTUAL
rgnFree deallocates all regions from a given address range of the actor address space specified by actorcap - a pointer to the actor capability. If actorcap is K_MYACTOR, the address space of the current actor is used. If actorcap is K_SVACTOR, the supervisor address space is used.
rgndesc points to a KnRgnDesc structure described in rgnAllocate (2K). If options is equal to K_FREEALL, all the actor's allocated regions are deallocated. Otherwise, option must be set to 0, and in that case the startAddr field specifies the starting address, and size specifies the size of the address range to be deallocated. The endAddr field is ignored.
If actorcap is equal to K_SVACTOR, the K_FREEALL flag cannot be used.
rgndesc->startAddr must be aligned with a page boundary (see vmPageSize(2K)). If rgndesc->size is not page-aligned, the kernel rounds it up to the next page boundary.
Since rgndesc->startAddr and rgndesc->startAddr + rgndesc->size do not necessarily match the boundaries of a region, a rgnFree can shrink the address ranges of some regions and even, in the case of a rgnFree in the middle of a region, create a new one. It explains why the K_ENOMEM error can be returned by a rgnFree.
Besides, the deallocated address range can contain holes, i.e. sub-ranges without regions mapped to.
If successful, K_OK is returned. Otherwise a negative error code is returned.
Some of the provided arguments are outside the caller's address space.
An inconsistent actor capability was given. The value of option is not K_FREEALL or 0.
actorcap does not specify a reachable actor.
rgndesc->startAddr is not page-aligned.
The system is out of resources.
The segment mapper does not respect the kernel/mapper protocol
The target actor and the current actor must be located on the same site.
See attributes(5) for descriptions of the following attributes:
ATTRIBUTE TYPE | ATTRIBUTE VALUE |
---|---|
Interface Stability | Evolving |
NAME | SYNOPSIS | FEATURES | DESCRIPTION | RETURN VALUE | ERRORS | RESTRICTIONS | ATTRIBUTES | SEE ALSO