#ifndef __TIZEN_SYSTEM_CPU_BOOSTING_TYPE_H__
#define __TIZEN_SYSTEM_CPU_BOOSTING_TYPE_H__
+#include <sys/types.h>
+
#ifdef __cplusplus
extern "C" {
#endif
} cpu_boosting_level_e;
typedef struct resource_pid_info {
- int pid;
- int *tid;
+ pid_t pid;
+ pid_t *tid;
int tid_count;
} resource_pid_t;
*
* @return 0 on success, otherwise a negative error value.
*/
-int resource_set_cpu_inheritance (int source_tid, const char *dest_process, int timeout_msec);
+int resource_set_cpu_inheritance (pid_t source_tid, const char *dest_process, int timeout_msec);
/**
* @brief Clear cpu resource inheritance from the source tid to the destination process (pid/tids).
*
* @return 0 on success, otherwise a negative error value.
*/
-int resource_clear_cpu_inheritance (int source_tid, const char *dest_process);
+int resource_clear_cpu_inheritance (pid_t source_tid, const char *dest_process);
/**
* @brief Register a destination process (pid/tids) for cpu resource inheritance.
return ret;
}
-API int resource_set_cpu_inheritance (int source_tid, const char *dest_process, int timeout_msec)
+API int resource_set_cpu_inheritance (pid_t source_tid, const char *dest_process, int timeout_msec)
{
int ret;
- int (*func)(int source_tid, const char *dest_process, int timeout_msec) = NULL;
+ int (*func)(pid_t source_tid, const char *dest_process, int timeout_msec) = NULL;
ret = open_cpu_boosting_plugin();
if (ret != RESOURCE_ERROR_NONE)
return ret;
}
-API int resource_clear_cpu_inheritance (int source_tid, const char *dest_process)
+API int resource_clear_cpu_inheritance (pid_t source_tid, const char *dest_process)
{
int ret;
- int (*func)(int source_tid, const char *dest_process) = NULL;
+ int (*func)(pid_t source_tid, const char *dest_process) = NULL;
ret = open_cpu_boosting_plugin();
if (ret != RESOURCE_ERROR_NONE)
API int resource_set_cpu_boosting (resource_pid_t pid,
cpu_boosting_level_e level, int timeout_msec)
{
- int tid;
+ pid_t tid;
int byte;
int ret = 0;
int sock;
input.pid.tid_count = 1;
}
- input.body_size = input.pid.tid_count * sizeof(int);
+ input.body_size = input.pid.tid_count * sizeof(pid_t);
}
byte = send(sock, (const void *)&input, sizeof(input), 0);
return 0;
}
-API int resource_set_cpu_inheritance (int source_tid, const char *dest_process, int timeout_msec)
+API int resource_set_cpu_inheritance (pid_t source_tid, const char *dest_process, int timeout_msec)
{
_D("[CPU-BOOSTING-PLUGIN] %s called", __func__);
return 0;
}
-API int resource_clear_cpu_inheritance (int source_tid, const char *dest_process)
+API int resource_clear_cpu_inheritance (pid_t source_tid, const char *dest_process)
{
_D("[CPU-BOOSTING-PLUGIN] %s called", __func__);
static void *thread_worker(void *arg)
{
- int *tid = (int *)arg;
+ pid_t *tid = (pid_t *)arg;
if (tid)
*tid = gettid();
if (tid_count < 1)
return;
- pid.tid = (int *)calloc(tid_count, sizeof(int));
+ pid.tid = (pid_t *)calloc(tid_count, sizeof(pid_t));
if (pid.tid == NULL) {
_E("[CPU-BOOSTING-TEST] Failed to allocate memory for tids");
return;