Change-Id: I404561789b8bc3c0f22a1fdf5b5adef6de364fc0
Signed-off-by: Yunmi Ha <yunmi.ha@samsung.com>
return g_variant_builder_end(&builder);
}
return g_variant_builder_end(&builder);
}
+static runtime_info_error_e errno_to_runtime_info_error(int err)
+{
+ switch (err) {
+ case 0:
+ return RUNTIME_INFO_ERROR_NONE;
+ case -EINVAL:
+ return RUNTIME_INFO_ERROR_INVALID_PARAMETER;
+ case -ENOMEM:
+ return RUNTIME_INFO_ERROR_OUT_OF_MEMORY;
+ case -EIO:
+ case -ENOENT:
+ return RUNTIME_INFO_ERROR_IO_ERROR;
+ case -EPERM:
+ case -EACCES:
+ return RUNTIME_INFO_ERROR_PERMISSION_DENIED;
+ case -ENOTSUP:
+ return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
+ case -ECOMM:
+ return RUNTIME_INFO_ERROR_REMOTE_IO;
+ default:
+ // TODO: what is the runtime-info error for this default case?
+ return RUNTIME_INFO_ERROR_NO_DATA;
+ }
+}
+
/* Handler function which handles dbus related instructions
* Creates the method call to resourced and receives the reply (if successful)
* Return the received usage information (if received) else NULL to signify failed call to resourced
/* Handler function which handles dbus related instructions
* Creates the method call to resourced and receives the reply (if successful)
* Return the received usage information (if received) else NULL to signify failed call to resourced
//LCOV_EXCL_START : system error
_E("INVALID_PARAMETER(0x%08x): invalid type parameter",
RUNTIME_INFO_ERROR_INVALID_PARAMETER);
//LCOV_EXCL_START : system error
_E("INVALID_PARAMETER(0x%08x): invalid type parameter",
RUNTIME_INFO_ERROR_INVALID_PARAMETER);
- *error = RUNTIME_INFO_ERROR_INVALID_PARAMETER;
+ if (error)
+ *error = RUNTIME_INFO_ERROR_INVALID_PARAMETER;
return NULL;
//LCOV_EXCL_STOP
}
return NULL;
//LCOV_EXCL_STOP
}
if (!args_in) {
//LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: not able to append pid array to message");
if (!args_in) {
//LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: not able to append pid array to message");
- *error = RUNTIME_INFO_ERROR_IO_ERROR;
+ if (error)
+ *error = RUNTIME_INFO_ERROR_IO_ERROR;
return NULL;
//LCOV_EXCL_STOP
}
return NULL;
//LCOV_EXCL_STOP
}
if (ret_dbus < 0) {
//LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: not able to send message");
if (ret_dbus < 0) {
//LCOV_EXCL_START : system error
_E("DBUS_METHOD_CALL: not able to send message");
+ if (error)
+ *error = errno_to_runtime_info_error(ret_dbus);
return NULL;
//LCOV_EXCL_STOP
}
return NULL;
//LCOV_EXCL_STOP
}
return RUNTIME_INFO_ERROR_NONE;
}
return RUNTIME_INFO_ERROR_NONE;
}
-static runtime_info_error_e hal_error_to_runtime_info_error(int err)
-{
- switch (err) {
- case 0:
- return RUNTIME_INFO_ERROR_NONE;
- case -EINVAL:
- return RUNTIME_INFO_ERROR_INVALID_PARAMETER;
- case -ENOMEM:
- return RUNTIME_INFO_ERROR_OUT_OF_MEMORY;
- case -EIO:
- case -ENOENT:
- return RUNTIME_INFO_ERROR_IO_ERROR;
- case -EPERM:
- case -EACCES:
- return RUNTIME_INFO_ERROR_PERMISSION_DENIED;
- case -ENOTSUP:
- return RUNTIME_INFO_ERROR_NOT_SUPPORTED;
- default:
- // TODO: what is the runtime-info error for this default case?
- return RUNTIME_INFO_ERROR_NO_DATA;
- }
-}
-
static int get_process_memory_info_direct(int *pid, int size, process_memory_info_key_e key, int **info)
{
int ret_hal, i;
static int get_process_memory_info_direct(int *pid, int size, process_memory_info_key_e key, int **info)
{
int ret_hal, i;
for (i = 0; i < size; ++i) {
ret_hal = hal_device_memory_get_gpu_info(pid[i], &gpu_info);
if (ret_hal != 0) {
for (i = 0; i < size; ++i) {
ret_hal = hal_device_memory_get_gpu_info(pid[i], &gpu_info);
if (ret_hal != 0) {
- ret = hal_error_to_runtime_info_error(ret_hal);
+ ret = errno_to_runtime_info_error(ret_hal);
goto out;
}
result[i] = gpu_info.used_pages;
goto out;
}
result[i] = gpu_info.used_pages;
case RUNTIME_INFO_PROC_MEMORY_GEM_RSS:
for (i = 0; i < size; ++i) {
ret_hal = hal_device_memory_get_gem_info(pid[i], &gem_info);
case RUNTIME_INFO_PROC_MEMORY_GEM_RSS:
for (i = 0; i < size; ++i) {
ret_hal = hal_device_memory_get_gem_info(pid[i], &gem_info);
- if (ret != 0) {
- ret = hal_error_to_runtime_info_error(ret_hal);
+ if (ret_hal != 0) {
+ ret = errno_to_runtime_info_error(ret_hal);
goto out;
}
result[i] = gem_info.rss;
goto out;
}
result[i] = gem_info.rss;