int aul_terminate_pid_async_for_uid(int pid, uid_t uid);
/**
+ * @par Description:
+ * This API trigger to terminate application synchronously
+ *
+ * If the application is running, this API sends a terminate event to the application. \n
+ * And then, this API waits until the application is terminated successfully. \n
+ * If the app cannot receive the event, AUL kill forcely the application. \n
+ * @par Purpose:
+ * This API's purpose is to kill application
+ * @par Typical use case:
+ * In general, Application like Task Manager use this API.
+ *
+ * This API need to require root or platform level permisssion. \n
+ *
+ * @param[in] pid application's pid to be terminated
+ * @return 0 if success, negative value(<0) if fail
+ * @retval AUL_R_OK - success
+ * @retval AUL_R_EINVAL - invaild pid
+ * @retval AUL_R_ECOM - internal AUL IPC error
+ * @retval AUL_R_ERROR - general error
+ * @warning This API need to require root or platform level permisssion. \n
+ * @remark
+ * If you have not the permission, this API return AUL_R_ERROR. \n
+ * This API is only available in User Session.
+*/
+int aul_terminate_pid_sync(int pid);
+
+/**
+ * @par Description:
+ * This API trigger to terminate application synchronously
+ *
+ * If the application is running, this API send a terminate event to the application. \n
+ * And then, this API waits until the application is terminated successfully. \n
+ * If the app cannot receive the event, AUL kill forcely the application. \n
+ * @par Purpose:
+ * This API's purpose is to kill application
+ * @par Typical use case:
+ * In general, Application like Task Manager use this API.
+ *
+ * This API need to require root or platform level permisssion. \n
+ *
+ * @param[in] pid application's pid to be terminated
+ * @param[in] uid User ID
+ * @return 0 if success, negative value(<0) if fail
+ * @retval AUL_R_OK - success
+ * @retval AUL_R_EINVAL - invaild pid
+ * @retval AUL_R_ECOM - internal AUL IPC error
+ * @retval AUL_R_ERROR - general error
+ * @warning This API need to require root or platform level permisssion. \n
+ * @remark
+ * If you have not the permission, this API return AUL_R_ERROR. \n
+ * This API is only available to System user.
+ */
+int aul_terminate_pid_sync_for_uid(int pid, uid_t uid);
+
+/**
*@brief Running application's information structure retrieved by AUL
*/
typedef struct _aul_app_info {
case APP_TERM_BY_PID: /* run in callee */
case APP_TERM_BY_PID_ASYNC:
+ case APP_TERM_BY_PID_SYNC:
app_terminate();
break;
APP_PREPARE_CANDIDATE_PROCESS, dummy, 0, AUL_SOCK_NONE);
}
+API int aul_terminate_pid_sync(int pid)
+{
+ return aul_terminate_pid_sync_for_uid(pid, getuid());
+}
+
+API int aul_terminate_pid_sync_for_uid(int pid, uid_t uid)
+{
+ char pid_str[MAX_PID_STR_BUFSZ];
+ int ret;
+
+ if (pid <= 0)
+ return AUL_R_EINVAL;
+
+ snprintf(pid_str, sizeof(pid_str), "%d", pid);
+ ret = app_request_to_launchpad_for_uid(APP_TERM_BY_PID_SYNC, pid_str,
+ NULL, uid);
+ return ret;
+}
+
return aul_pause_pid_for_uid(apn_pid, atoi(gargv[3]));
}
+static int term_pid_sync_test()
+{
+ static int num = 0;
+
+ printf("[aul_terminate_pid_sync %d test] %d \n", num++, apn_pid);
+ return aul_terminate_pid_sync(apn_pid);
+}
+
+static int term_pid_sync_test_for_uid()
+{
+ static int num = 0;
+
+ printf("[aul_terminate_pid_sync_for_uid %d test] %d \n", num++, apn_pid);
+ return aul_terminate_pid_sync_for_uid(apn_pid, atoi(gargv[3]));
+}
+
/*
static int set_pkg_func()
{
"[usage] pasue_for_uid <appid> <uid>"},
{"pause_pid_for_uid", pause_pid_test_for_uid, "aul_pause_pid_for_uid test",
"[usage] pause_pid_for_uid <pid> <uid>"},
+ {"term_pid_sync", term_pid_sync_test, "aul_terminate_pid_sync test",
+ "[usage] term_pid_sync <pid>"},
+ {"term_pid_sync_for_uid", term_pid_sync_test_for_uid, "aul_terminate_pid_sync_for_uid test",
+ "[usage] term_pid_sync_for_uid <pid> <uid>"},
};
int callfunc(char *testname)