NXVmJoin

Joins a known virtual machine (VM) to get its termination status.

Library:LibC
Classification:NKS
Service:NKS Virtual Machine

Syntax

  #include <nks/vm.h>
   
  int NXVmJoin (
     NXVmId_t   wait_for,
     NXVmId_t  *departed_vm,
     int       *status);
  

Parameters

wait_for

(IN) Specifies the ID of the virtual machine to join. If you want to join the next VM spawned by the terminating VM that is calling NXVmJoin, pass NX_VM_JOIN_ANY.

departed_vm

(OUT) Points to the ID of the VM that was actually joined.

status

(OUT) Points to the location that holds the returned status of the terminated VM. The meaning of the status is application defined.

Return Values

If successful, returns zero; otherwise, returns an error:

Decimal

Hex

Constant

Description

77

0x4D

NX_ESRCH

The VM specified by wait_for doesn’t exist.

Remarks

NXVmJoin joins another VM with a similar effect as two threads joining each other (see NXThreadJoin).

NXVmJoin returns the exit code of the specified VM if it has already terminated. Otherwise, the call blocks waiting for that VM to exit.

Virtual machines are created joinable by default. Once a VM terminates, data structures identified with it persist until it is ultimately joined because it is possible to join a VM long after it terminates.There is no discovery mechanism in NKS that will yield a value for wait_for. It must be obtained from NXVmSpawn. Only VMs that have been spawned by the caller can be joined.

See Also

NXVmGetId