Simple Virtual Machine A simple but flexible virtual machine

Loading...
Searching...
No Matches
Functions
SVM process notifications
SVM processes

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.
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_wait (const void *svm)
| This function waits until the current process receives an interruption notification.
SVM_FUNCTION void | svm_process_interruptionnotification_send (const void *svm, const SVM_Process process)
| This function sends an interruption notification to a process.

## 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | process | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the process is not ours or is not a process locked by ours.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | process | The 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];
svm_process_interruptionnotification_enable(svm,svm_process_get_current(svm));
ssize_t s = read(fd,buffer,1024);
svm_process_interruptionnotification_disable(svm,svm_process_get_current(svm));
if(s<0)
{
if(errno==EINTR)
{
// an interruption event has been received by the SVM.
return svm_value_string_new_null(svm);
}
// other error handling here
}
return svm_value_string_new__buffer(svm,buffer,s);
svm_process_get_current
SVM_FUNCTION SVM_Process svm_process_get_current(const void *svm)
This function retrieves the current process.
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.
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.
svm_value_string_new__buffer
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_value_string_new_null
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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when the process is not ours or is not a process locked by ours.
  FAILURE | interruption 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] | svm | The SVM pointer passed as first argument of the callback function.
  [in] | process | The 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

  FAILURE | interruption 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] | svm | The 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

  FAILURE | interruption when a parameter is incorrect. (Please refer to the main description page of this API.)
  FAILURE | interruption when called outside a process.
  FAILURE | interruption when this API function is called outside a waiting instruction.

See also
  svm_processor_is_hardwareinterrupted