From: Junghoon Park Date: Fri, 22 Jul 2016 01:49:18 +0000 (+0900) Subject: Add APIs for terminating apps X-Git-Tag: accepted/tizen/common/20160803.193208^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F26%2F80426%2F5;p=platform%2Fcore%2Fappfw%2Faul-1.git Add APIs for terminating apps - add aul_terminate_pid_sync_without_restart() - add aul_terminate_pid_sync_without_restart_for_uid() Change-Id: I81f171a13c40e58319196b8cd01eaab27a0c4556 Signed-off-by: Junghoon Park --- diff --git a/include/aul.h b/include/aul.h index 50ac929..fb60307 100644 --- a/include/aul.h +++ b/include/aul.h @@ -2017,6 +2017,16 @@ int aul_terminate_pid_without_restart(int pid); /* * This API is only for Appfw internally. */ +int aul_terminate_pid_sync_without_restart(int pid); + +/* + * This API is only for Appfw internally. + */ +int aul_terminate_pid_sync_without_restart_for_uid(int pid, uid_t uid); + +/* + * This API is only for Appfw internally. + */ const char *aul_get_app_external_root_path(void); /* diff --git a/include/aul_cmd.h b/include/aul_cmd.h index ce2ee7b..e566ddf 100644 --- a/include/aul_cmd.h +++ b/include/aul_cmd.h @@ -106,6 +106,7 @@ enum app_cmd { APP_TERM_BY_PID_SYNC, APP_GET_STATUS_BY_APPID, APP_GET_LAST_CALLER_PID, + APP_TERM_BY_PID_SYNC_WITHOUT_RESTART, APP_CMD_MAX }; diff --git a/src/launch.c b/src/launch.c index 72d8a9d..83bb5f2 100644 --- a/src/launch.c +++ b/src/launch.c @@ -729,6 +729,25 @@ API int aul_terminate_pid_without_restart(int pid) return ret; } +API int aul_terminate_pid_sync_without_restart(int pid) +{ + return aul_terminate_pid_sync_without_restart_for_uid(pid, getuid()); +} + +API int aul_terminate_pid_sync_without_restart_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_WITHOUT_RESTART, + pid_str, NULL, uid); + return ret; +} + API int aul_terminate_pid_async(int pid) { return aul_terminate_pid_async_for_uid(pid, getuid());