Simple Virtual Machine
A simple but flexible virtual machine
SVM process notifications

This module contains API functions to handle SVM process interruption notifications. More...

Functions

SVM_FUNCTION void svm_process_interruptionnotification_enable (const void *svm, const SVM_Process process)
 This function changes the process behavior on interruption event. More...
 
SVM_FUNCTION void svm_process_interruptionnotification_disable (const void *svm, const SVM_Process process)
 This function changes the process behavior on interruption event. More...
 
SVM_FUNCTION void svm_process_interruptionnotification_wait (const void *svm)
 This function waits until the current process receives an interruption notification. More...
 
SVM_FUNCTION void svm_process_interruptionnotification_send (const void *svm, const SVM_Process process)
 This function sends an interruption notification to a process. More...
 

Detailed Description

This module contains API functions to handle SVM process interruption notifications.

Function Documentation

◆ svm_process_interruptionnotification_disable()

SVM_FUNCTION void svm_process_interruptionnotification_disable ( const void *  svm,
const SVM_Process  process 
)

This function changes the process behavior on interruption event.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]processThe process allowing to be notified about interruption events.

The process will ignore interruption event notifications. On interruption event reception, any blocking syscall will continue its execution.

Warning
This feature needs to be activated at SVM compilation time (Please refer to the configure –enable-linux-extensions option) and may not work.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the process is not ours or is not a process locked by ours.
FAILUREinterruption when this API function is called outside a waiting instruction.
See also
svm_process_ownership_lock
svm_process_get_current

◆ svm_process_interruptionnotification_enable()

SVM_FUNCTION void svm_process_interruptionnotification_enable ( const void *  svm,
const SVM_Process  process 
)

This function changes the process behavior on interruption event.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]processThe process allowing to be notified about interruption events.

The process will accept notification on hardware interruptions and scheduling events like suspension, termination and lock. On interruption event, the process will receive a technical signal associated to an empty handler to unlock execution from blocking syscalls. This signal is not related to the eventual hardware interruption signal triggering this notification.

Note
The interruption notifications are received even if no hardware interruption handlers are defined for the received hardware interruptions.
Warning
This feature needs to be activated at SVM compilation time (Please refer to the configure –enable-linux-extensions option) and may not work.

Usage example:

char buffer[1024];
ssize_t s = read(fd,buffer,1024);
if(s<0)
{
if(errno==EINTR)
{
// an interruption event has been received by the SVM.
}
// other error handling here
}
return svm_value_string_new__buffer(svm,buffer,s);
SVM_FUNCTION SVM_Process svm_process_get_current(const void *svm)
This function retrieves the current process.
SVM_FUNCTION void svm_process_interruptionnotification_disable(const void *svm, const SVM_Process process)
This function changes the process behavior on interruption event.
SVM_FUNCTION void svm_process_interruptionnotification_enable(const void *svm, const SVM_Process process)
This function changes the process behavior on interruption event.
SVM_FUNCTION SVM_Value_String svm_value_string_new__buffer(const void *svm, const char *string, const SVM_Size size)
This function creates a string value the SVM can store in its memories from a memory buffer.
SVM_FUNCTION SVM_Value_String svm_value_string_new_null(const void *svm)
This function creates a string value the SVM can store in its memories without a value.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when the process is not ours or is not a process locked by ours.
FAILUREinterruption when this API function is called outside a waiting instruction.
See also
svm_process_ownership_lock
svm_process_get_current

◆ svm_process_interruptionnotification_send()

SVM_FUNCTION void svm_process_interruptionnotification_send ( const void *  svm,
const SVM_Process  process 
)

This function sends an interruption notification to a process.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.
[in]processThe process to notify.

The process will be notified only if it accepts interruption notifications.

Warning
This feature needs to be activated at SVM compilation time (Please refer to the configure –enable-linux-extensions option) and may not work.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
See also
svm_process_interruptionnotification_enable
svm_process_interruptionnotification_wait

◆ svm_process_interruptionnotification_wait()

SVM_FUNCTION void svm_process_interruptionnotification_wait ( const void *  svm)

This function waits until the current process receives an interruption notification.

Parameters
[in]svmThe SVM pointer passed as first argument of the callback function.

To distinguish between an interruption from the scheduler or an hardware interruption, use the svm_processor_is_hardwareinterrupted API function.

Note
The API function temporarly enables the interruption notifications.
Warning
This feature needs to be activated at SVM compilation time (Please refer to the configure –enable-linux-extensions option) and may not work.
Exceptions
FAILUREinterruption when a parameter is incorrect. (Please refer to the main description page of this API.)
FAILUREinterruption when called outside a process.
FAILUREinterruption when this API function is called outside a waiting instruction.
See also
svm_processor_is_hardwareinterrupted