NAME | SYNOPSIS | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUES | ERRORS | RESTRICTIONS | ATTRIBUTES | SEE ALSO
#include <mem/chMem.h>int rgnFree(KnCap *actorcap, KnRgnDes *rgndesc);
The function or functions documented here may not be used safely in all application contexts with all APIs provided in the ChorusOS 5.0 product.
See API(5FEA) for details.
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. In this 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 microkernel 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() call can shrink the address ranges of some regions and even, in the case of a rgnFree() call in the middle of a region, create a new one. This explains why the K_ENOMEM error can be returned by a rgnFree() call.
Apart from this, the deallocated address range can contain holes, such as sub-ranges without mapped regions.
If successful, K_OK is returned. Otherwise a negative error code is returned.
Some of the arguments provided 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 microkernel/mapper protocol
A user actor cannot delete a supervisor actor or a system actor.
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 | API RESTRICTIONS | FEATURES | DESCRIPTION | RETURN VALUES | ERRORS | RESTRICTIONS | ATTRIBUTES | SEE ALSO