Simple Virtual Machine
A simple but flexible virtual machine
SVM access control memory

This module contains API functions to handle SVM access control memory limit. More...

Functions

SVM_FUNCTION SVM_Boolean svm_accesscontrol_has_memory (const void *svm, const SVM_AccessControl access_control)
 This function checks whether a quota for a SVM code execution contains a limit for memory. More...
 
SVM_FUNCTION unsigned long int svm_accesscontrol_get_memory (const void *svm, const SVM_AccessControl access_control)
 This function retrieves the remaining memory counter from a quota for a SVM code execution. More...
 
SVM_FUNCTION void svm_accesscontrol_set_memory (const void *svm, SVM_AccessControl access_control, const unsigned long int memory)
 This function changes the remaining memory counter within a quota for a SVM code execution. More...
 

Detailed Description

This module contains API functions to handle SVM access control memory limit.

Function Documentation

◆ svm_accesscontrol_get_memory()

SVM_FUNCTION unsigned long int svm_accesscontrol_get_memory ( const void *  svm,
const SVM_AccessControl  access_control 
)

This function retrieves the remaining memory counter from a quota for a SVM code execution.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]access_controlThe access control to check.
Returns
The number of remaining memory to allocate.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the access control has no memory limit.
See also
svm_accesscontrol_has_memory

◆ svm_accesscontrol_has_memory()

SVM_FUNCTION SVM_Boolean svm_accesscontrol_has_memory ( const void *  svm,
const SVM_AccessControl  access_control 
)

This function checks whether a quota for a SVM code execution contains a limit for memory.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]access_controlThe access control to check.
Returns
TRUE when the access control has a memory limit, FALSE otherwise.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)

◆ svm_accesscontrol_set_memory()

SVM_FUNCTION void svm_accesscontrol_set_memory ( const void *  svm,
SVM_AccessControl  access_control,
const unsigned long int  memory 
)

This function changes the remaining memory counter within a quota for a SVM code execution.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]access_controlThe access control to update.
[in]memoryThe remaining memory to allocate.

This function changes the number of remaining memory on the access control:

  • if the access control had no limit, a limit is set to the number of remaining memory,
  • the number of remaining memory can not be increased, and the function will have no effect.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)