Name
VixVM_ListProcessesInGuest
Description
VixHandle
VixVM_ListProcessesInGuest(VixHandle vmHandle,
int options,
VixEventProc *callbackProc,
void *clientData);
This function lists the running processes in the guest operating system.
Parameters
- vmHandle
-
Identifies a virtual machine. Call VixVM_Open() to create a virtual machine handle.
- options
-
Must be 0.
- callbackProc
-
A callback function that will be invoked when the
operation is complete.
- clientData
-
A parameter that will be passed to the callbackProc function.
Return Value
VixHandle. A job handle that describes the state of this asynchronous operation.
Remarks
- You must call VixVM_LoginInGuest() before calling this function.
- VixJob_GetNumProperties() should be used to determine the number of results.
- VixJob_GetNthProperties() can be used to get each result.
- When the job is signaled, the following list of properties will be available
on the returned job handle:
- VIX_PROPERTY_JOB_RESULT_ITEM_NAME: the process name
- VIX_PROPERTY_JOB_RESULT_PROCESS_ID: the process id
- VIX_PROPERTY_JOB_RESULT_PROCESS_OWNER: the process owner
- VIX_PROPERTY_JOB_RESULT_PROCESS_COMMAND: the process command line
- VIX_PROPERTY_JOB_RESULT_PROCESS_BEING_DEBUGGED: is the process being debugged?
(always FALSE on Linux)
- VIX_PROPERTY_JOB_RESULT_PROCESS_START_TIME: the process start time specifying seconds since the epoch
Side Effects
None.
Requirements
vix.h, since Workstation 6.0
Minimum Supported Guest OS: Microsoft Windows NT Series, Linux
Example
job = VixVM_ListProcessesInGuest(vm, 0, NULL, NULL);
err = VixJob_Wait(job, VIX_PROPERTY_NONE);
if (VIX_OK != err) {
fprintf(stderr, "failed to list processes in vm '%s'(%"FMT64"d %s)\n",
vmpath, err, Vix_GetErrorText(err, NULL));
goto abort;
}
num = VixJob_GetNumProperties(job, VIX_PROPERTY_JOB_RESULT_ITEM_NAME);
for (i = 0; i < num; i++) {
char *processName;
uint64 pid;
char *owner;
char *cmdline;
Bool isDebugged;
int startTime;
err = VixJob_GetNthProperties(job, i,
VIX_PROPERTY_JOB_RESULT_ITEM_NAME, &processName,
VIX_PROPERTY_JOB_RESULT_PROCESS_ID, &pid,
VIX_PROPERTY_JOB_RESULT_PROCESS_OWNER, &owner,
VIX_PROPERTY_JOB_RESULT_PROCESS_COMMAND, &cmdline,
VIX_PROPERTY_JOB_RESULT_PROCESS_BEING_DEBUGGED, &isDebugged,
VIX_PROPERTY_JOB_RESULT_PROCESS_START_TIME, &startTime,
VIX_PROPERTY_NONE);
printf("process #%d '%s' %"FMT64"d %s %s %s at %d\n",
i, processName, pid, owner, cmdline, (isDebugged) ? "debugged" : "", startTime);
Vix_FreeBuffer(processName);
Vix_FreeBuffer(owner);
Vix_FreeBuffer(cmdline);
}
Vix_ReleaseHandle(job);