RDK Documentation (Open Sourced RDK Components)
Device_DeviceInfo_ProcessStatus_Process.h
Go to the documentation of this file.
1 /*
2  * If not stated otherwise in this file or this component's Licenses.txt file the
3  * following copyright and licenses apply:
4  *
5  * Copyright 2016 RDK Management
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18 */
19 
20 /**
21  * @file Device_DeviceInfo_ProcessStatus_Process.h
22  * @brief The header file provides TR069 device processor status process information APIs.
23  */
24 
25 /**
26  * @defgroup TR69_HOSTIF_DEVICE_STATUS_PROCESS TR-069 Object (Device.DeviceInfo.ProcessStatus.Process)
27  * List of all processes running on the device.
28  * @ingroup TR69_HOSTIF_DEVICEINFO
29  *
30  * @defgroup TR69_HOSTIF_DEVICE_STATUS_PROCESS_API TR-069 Object (Device.DeviceInfo.ProcessStatus.Process.Interface.{i}) Public APIs
31  * Describe the details about TR-069 DeviceInfo processor status process APIs specifications.
32  * @ingroup TR69_HOSTIF_DEVICE_STATUS_PROCESS
33  *
34  * @defgroup TR69_HOSTIF_DEVICE_STATUS_PROCESS_CLASSES TR-069 Object (Device.DeviceInfo.ProcessStatus.Process.Interface.{i}) Public Classes
35  * Describe the details about classes used in TR-069 DeviceInfo processor status process.
36  * @ingroup TR69_HOSTIF_DEVICE_STATUS_PROCESS
37  *
38  * @defgroup TR69_HOSTIF_DEVICE_STATUS_PROCESS_DSSTRUCT TR-069 Object (Device.DeviceInfo.ProcessStatus.Process.Interface.{i}) Public DataStructure
39  * Describe the details about structure used in TR-069 DeviceInfo processor status process.
40  * @ingroup TR69_HOSTIF_DEVICE_STATUS_PROCESS
41  */
42 
43 /**
44 * @defgroup tr69hostif
45 * @{
46 * @defgroup hostif
47 * @{
48 **/
49 
50 
51 #ifndef DEVICE_DEVICEINFO_PROCESSSTATUS_PROCESS_H_
52 #define DEVICE_DEVICEINFO_PROCESSSTATUS_PROCESS_H_
53 
54 #include "hostIf_main.h"
55 #include "hostIf_tr69ReqHandler.h"
56 #include "hostIf_utils.h"
57 
58 #define _COMMAND_LENGTH 256
59 #define _STATE_LENGTH 16
60 #define PROCESS_STATE_RUNNING "Running"
61 #define PROCESS_STATE_SLEEPING "Sleeping"
62 #define PROCESS_STATE_STOPPED "Stopped"
63 #define PROCESS_STATE_ZOMBIE "Zombie"
64 
65 /**
66  * @addtogroup TR69_HOSTIF_DEVICE_STATUS_PROCESS_DSSTRUCT
67  * @{
68  */
69 
70 /**
71  * @brief These values are the members variables of the DeviceProcessStatusProcess structure.
72  */
74  {
75  unsigned int uiPid; /*Process Identifier.*/
76  char cCommand[_COMMAND_LENGTH]; /*The name of the command that has caused the process to exist.*/
77  unsigned int uiSize; /* The size in kilobytes of the memory occupied by the process.*/
78  unsigned int uiPriority; /*The priority of the process. */
79  unsigned int uiCpuTime; /*The amount of time in milliseconds that the process has spent taking up CPU time since the process was started. */
80  char cState[_STATE_LENGTH]; /* The current state that the process is in.*/
82 
83 /**
84  * @brief These values are the members of the process.
85  */
86  typedef enum EProcessMembers
87  {
88  eProcessPid = 0,
89  eProcessCommand,
90  eProcessSize,
91  eProcessPriority,
92  eProcessCpuTime,
93  eProcessState
95 
96 /** @} */ //End of the Doxygen tag TR69_HOSTIF_DEVICE_STATUS_PROCESS_DSSTRUCT
97 /**
98  * Description. This returns the total number of processes running.
99  *
100  * @param[in] void Takes no parameter.
101  * @param[out] value Total number of processes running.
102  **/
103 
104 /**
105  * @brief This class provides the interface for getting device processor information.
106  * @ingroup TR69_HOSTIF_DEVICE_STATUS_PROCESS_CLASSES
107  */
109 {
110 
111  static GHashTable *ifHash;
112 
113  static GMutex *m_mutex;
114 
115  static GMutex *m_libproc_lock;
116  int dev_id;
117 
118  hostIf_DeviceProcess(int _dev_id);
119 
121 
122  bool bCalledProcessPid;
123  bool bCalledProcessCommand;
124  bool bCalledProcessSize;
125  bool bCalledProcessPriority;
126  bool bCalledProcessCpuTime;
127  bool bCalledProcessState;
128 
129 
130  unsigned int backupProcessPid;
131  char backupProcessCommand[_COMMAND_LENGTH];
132  unsigned int backupProcessSize;
133  unsigned int backupProcessPriority;
134  unsigned int backupProcessCpuTime;
135  char backupProcessState[_STATE_LENGTH];
136 
137 public:
138 
139  static hostIf_DeviceProcess *getInstance(int dev_id);
140 
141  static void closeInstance(hostIf_DeviceProcess *);
142 
143  static GList* getAllInstances();
144 
145  static void closeAllInstances();
146 
147  static void getLock();
148 
149  static void releaseLock();
150 
151  static GMutex* initProcpsLock();
152 
154 
155  /**
156  * Description. This is the getter api for Device_DeviceInfo_ProcessStatus_Process. for
157  * Device_DeviceInfo_ProcessStatus_Process. object Profile.
158  *
159  * @param[in] name Complete path name of the parameter.
160  * @param[in] type It is a user data type of ParameterType.
161  * @param[out] value It is the value of the parameter.
162  *
163  * @retval OK if successful.
164  * @retval XXX_ERR_BADPARAM if a bad parameter was supplied.
165  *
166  * @execution Synchronous.
167  * @sideeffect None.
168  *
169  * @note This function must not suspend and must not invoke any blocking system
170  * calls. It should probably just send a message to a driver event handler task.
171  *
172  * @see XXX_SomeOtherFunction.
173  */
174 
175 
177 
179 
181 
183 
185 
187 
188 };
189 /* End of doxygen group */
190 /**
191  * @}
192  */
193 
194 #endif /* DEVICE_DEVICEINFO_PROCESSSTATUS_H_ */
195 
196 
197 /** @} */
198 /** @} */
hostIf_DeviceProcess::get_Device_DeviceInfo_ProcessStatus_Process_CPUTime
int get_Device_DeviceInfo_ProcessStatus_Process_CPUTime(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides The amount of time spent by the process taking the cpu.
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:522
hostIf_DeviceProcess::get_Device_DeviceInfo_ProcessStatus_Process_PID
int get_Device_DeviceInfo_ProcessStatus_Process_PID(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides the Process Identifier.
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:375
hostIf_DeviceProcess
This class provides the interface for getting device processor information.
Definition: Device_DeviceInfo_ProcessStatus_Process.h:108
hostIf_DeviceProcess::~hostIf_DeviceProcess
~hostIf_DeviceProcess()
Class destructor.
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:100
_HostIf_MsgData_t
Definition: hostIf_tr69ReqHandler.h:170
hostIf_DeviceProcess::hostIf_DeviceProcess
hostIf_DeviceProcess(int _dev_id)
Class Constructor of the class hostIf_DeviceProcess.
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:62
hostIf_DeviceProcess::get_Device_DeviceInfo_ProcessStatus_Process_Priority
int get_Device_DeviceInfo_ProcessStatus_Process_Priority(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides The priority of the process.
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:489
hostIf_main.h
hostIf_main API.
hostIf_DeviceProcess::getNumOfProcessEntries
static int getNumOfProcessEntries(HOSTIF_MsgData_t *)
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:185
EProcessMembers
EProcessMembers
These values are the members of the process.
Definition: Device_DeviceInfo_ProcessStatus_Process.h:86
hostIf_DeviceProcess::get_Device_DeviceInfo_ProcessStatus_Process_Size
int get_Device_DeviceInfo_ProcessStatus_Process_Size(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides The Size in Kilo bytes of the memory occupied by process.
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:456
Device_DeviceInfo_ProcessStatus_Process
These values are the members variables of the DeviceProcessStatusProcess structure.
Definition: Device_DeviceInfo_ProcessStatus_Process.h:73
hostIf_DeviceProcess::get_Device_DeviceInfo_ProcessStatus_Process_State
int get_Device_DeviceInfo_ProcessStatus_Process_State(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides The current state of the process.
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:555
DeviceProcessStatusProcess
struct Device_DeviceInfo_ProcessStatus_Process DeviceProcessStatusProcess
These values are the members variables of the DeviceProcessStatusProcess structure.
hostIf_DeviceProcess::get_Device_DeviceInfo_ProcessStatus_Process_Command
int get_Device_DeviceInfo_ProcessStatus_Process_Command(HOSTIF_MsgData_t *, bool *pChanged=NULL)
This function provides The name of the command that has caused the process to exist.
Definition: Device_DeviceInfo_ProcessStatus_Process.cpp:408