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

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);

Copyright (C) 2007-2010 VMware, Inc. All rights reserved.