sipxportlib  Version 3.3
OsProcessIteratorLinux.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2006 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 #ifndef _OsProcessIteratorLinux_h_
12 #define _OsProcessIteratorLinux_h_
13 
14 // SYSTEM INCLUDES
15 
16 // APPLICATION INCLUDES
17 #include "os/OsDefs.h"
18 #include "os/OsStatus.h"
19 #include "os/OsProcess.h"
20 #include "os/OsProcessIterator.h"
21 #include "os/OsFS.h"
22 
23 // DEFINES
24 // MACROS
25 // EXTERNAL FUNCTIONS
26 // EXTERNAL VARIABLES
27 // CONSTANTS
28 // STRUCTS
29 // TYPEDEFS
30 // FORWARD DECLARATIONS
31 class OsProcessBase;
33 
34 //: Used to enumerate running processes
35 
37 {
38 
39 /* //////////////////////////// PUBLIC //////////////////////////////////// */
40 public:
41 
42  friend class OsProcessLinux;
43 
44 /* ============================ CREATORS ================================== */
46  //:Default constructor
47 
48  OsProcessIteratorLinux(const char* filterExp);
49 
50  //:Return processes filtered by name
51 
52  virtual ~OsProcessIteratorLinux();
53  //:Destructor
54 
55 /* ============================ MANIPULATORS ============================== */
56 
57 /* ============================ ACCESSORS ================================= */
58 
59  OsStatus findFirst(OsProcess &rProcess);
60  //: Start enumeration of running processes
61  //: Returns OS_SUCCESS if found
62  //: Returns OS_FAILED if none found.
63 
64  OsStatus findNext(OsProcess &rProcess);
65  //: Continues enumeration of running processes
66  //: Returns OS_SUCCESS if found
67  //: Returns OS_FAILED if none found.
68 
69 
70 /* ============================ INQUIRY =================================== */
71 
72 
73 /* //////////////////////////// PROTECTED ///////////////////////////////// */
74 protected:
75 
76 
77 /* //////////////////////////// PRIVATE /////////////////////////////////// */
78 private:
79  OsStatus readProcFile(OsPath &procDirname, OsProcess & rProcess);
80 
81 
82  OsProcessLinux mProcess;
83  int hProcessSnapshot;
84  OsFileIterator *mpFileIterator;
85 
86  //:Last process found by this class
87 
88 };
89 
90 /* ============================ INLINE METHODS ============================ */
91 
92 
93 
94 #endif // _OsProcessIteratorLinux_h_
95 
96 
Definition: OsProcessIteratorLinux.h:36
OsStatus
Definition: OsStatus.h:27
Definition: OsProcess.h:59
OsStatus findNext(OsProcess &rProcess)
Definition: OsProcessIteratorLinux.cpp:76
OsProcessIteratorLinux()
Definition: OsProcessIteratorLinux.cpp:30
OsStatus findFirst(OsProcess &rProcess)
Definition: OsProcessIteratorLinux.cpp:51
Definition: OsProcessIterator.h:32
virtual ~OsProcessIteratorLinux()
Definition: OsProcessIteratorLinux.cpp:40
Definition: OsProcessLinux.h:34