process_control Class Reference

Provides a bridge to the operating system for information on processes. More...

#include <process_control.h>

Inheritance diagram for process_control:

Inheritance graph
[legend]
Collaboration diagram for process_control:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 process_control ()
 ~process_control ()
 IMPLEMENT_CLASS_NAME ("process_control")
bool healthy () const
 returns true if this object should be functional.
process_entry query_process (u_int to_query)
 returns the information for just one process.
bool query_processes (process_entry_array &to_fill)
 finds the processes that are running and drops them into "to_fill".
bool zap_process (u_int to_zap)
 preemptively zaps the process "to_zap".
void sort_by_name (process_entry_array &to_sort)
void sort_by_pid (process_entry_array &to_sort)

Static Public Member Functions

static bool find_process_in_list (const process_entry_array &processes, const istring &app_name, int_set &pids)
 uses a pre-existing list of "processes" to search for the "app_name".

Detailed Description

Provides a bridge to the operating system for information on processes.

This object can query the operating system for the current set of processes or zap a particular process of interest.

Definition at line 33 of file process_control.h.


Constructor & Destructor Documentation

process_control::process_control (  ) 

Definition at line 112 of file process_control.cpp.

References portable::get_OS_version(), version::v_major(), and version::v_revision().

process_control::~process_control (  ) 

Definition at line 143 of file process_control.cpp.

References WHACK().


Member Function Documentation

process_control::IMPLEMENT_CLASS_NAME ( "process_control"   ) 

bool process_control::healthy (  )  const [inline]

returns true if this object should be functional.

if it failed to construct properly, this returns false. usually a failure indicates that a required dynamic library is missing, such as "psapi.dll" on win32.

Definition at line 41 of file process_control.h.

process_entry process_control::query_process ( u_int  to_query  ) 

returns the information for just one process.

Definition at line 271 of file process_control.cpp.

References FUNCDEF, and query_processes().

bool process_control::query_processes ( process_entry_array to_fill  ) 

finds the processes that are running and drops them into "to_fill".

Definition at line 173 of file process_control.cpp.

Referenced by shutdown_alerter::close_application(), main(), and query_process().

bool process_control::zap_process ( u_int  to_zap  ) 

preemptively zaps the process "to_zap".

this does not invoke any friendly graceful shut down process, but merely terminates it if possible.

Definition at line 245 of file process_control.cpp.

References FUNCDEF, LOG, portable::system_error(), and portable::system_error_text().

Referenced by main(), process_manager::push_timed_activities(), and process_manager::zap_process().

bool process_control::find_process_in_list ( const process_entry_array processes,
const istring app_name,
int_set pids 
) [static]

uses a pre-existing list of "processes" to search for the "app_name".

if the process is found, true is returned and the "pids" are set to all entries matching the process name. note that this is an approximate match for some OSes that have a brain damaged process lister (such as ms-windows); they have programs listed under incomplete names in some cases.

Definition at line 296 of file process_control.cpp.

References basis::set< contents >::add(), basis::set< contents >::clear(), istring::compare(), FUNCDEF, portable::get_OS_version(), LOG, istring::lower(), version::v_major(), and version::v_minor().

Referenced by shutdown_alerter::close_application(), and process_manager::push_timed_activities().

void process_control::sort_by_name ( process_entry_array to_sort  ) 

Definition at line 151 of file process_control.cpp.

Referenced by main().

void process_control::sort_by_pid ( process_entry_array to_sort  ) 

Definition at line 163 of file process_control.cpp.


The documentation for this class was generated from the following files:
Generated on Fri Oct 10 04:30:26 2008 for HOOPLE Libraries by  doxygen 1.5.1