diff options
author | Hwankyu Jhun <h.jhun@samsung.com> | 2015-12-10 07:51:42 +0900 |
---|---|---|
committer | Hwankyu Jhun <h.jhun@samsung.com> | 2015-12-10 07:51:42 +0900 |
commit | a60db24d22d1ed97df016bc72bf8308228957546 (patch) | |
tree | bfda1aade0a98648fe75c12dddc3500ba4565067 | |
parent | 36643acff49c0c88d4b82163108a849760e9f83d (diff) | |
download | aul-1-a60db24d22d1ed97df016bc72bf8308228957546.tar.gz aul-1-a60db24d22d1ed97df016bc72bf8308228957546.tar.bz2 aul-1-a60db24d22d1ed97df016bc72bf8308228957546.zip |
Add aul_app_get_pid API
- This API gets specified application process id.
Change-Id: I7b9b40fedbd8cb752225d75ae20801f7cb826105
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
-rw-r--r-- | am_daemon/amd_request.c | 1 | ||||
-rw-r--r-- | include/app_sock.h | 1 | ||||
-rw-r--r-- | include/aul.h | 13 | ||||
-rw-r--r-- | src/pkginfo.c | 13 | ||||
-rw-r--r-- | test/aul_test.c | 10 |
5 files changed, 38 insertions, 0 deletions
diff --git a/am_daemon/amd_request.c b/am_daemon/amd_request.c index 89b344c3..d3dcdae1 100644 --- a/am_daemon/amd_request.c +++ b/am_daemon/amd_request.c @@ -1055,6 +1055,7 @@ static app_cmd_dispatch_func dispatch_table[APP_CMD_MAX] = { [APP_GET_STATUS] = __dispatch_app_get_status, [APP_ADD_LOADER] = __dispatch_app_add_loader, [APP_REMOVE_LOADER] = __dispatch_app_remove_loader, + [APP_GET_PID] = __dispatch_app_is_running, [AMD_RELOAD_APPINFO] = __dispatch_amd_reload_appinfo, [AGENT_DEAD_SIGNAL] = __dispatch_agent_dead_signal, }; diff --git a/include/app_sock.h b/include/app_sock.h index 65c9aace..68bbf68a 100644 --- a/include/app_sock.h +++ b/include/app_sock.h @@ -70,6 +70,7 @@ enum app_cmd { APP_GET_SOCKET_PAIR, APP_ADD_LOADER, APP_REMOVE_LOADER, + APP_GET_PID, /* for special purpose */ AMD_RELOAD_APPINFO, diff --git a/include/aul.h b/include/aul.h index ec4708f2..c1ea1802 100644 --- a/include/aul.h +++ b/include/aul.h @@ -1916,6 +1916,19 @@ int aul_add_loader(const char *loader_path); */ int aul_remove_loader(int loader_id); +/** + * @par Description + * This API gets specified application process id. + * @par Purpose: + * The purpose of this API is to get the pid of specified application. + * + * @param[in] appid application name + * @return callee's pid if success, negative value(<0) if fail + * + * @remark + * This API is only available in User Session. + */ +int aul_app_get_pid(const char *appid); #ifdef __cplusplus } diff --git a/src/pkginfo.c b/src/pkginfo.c index ce4c42e0..42bbed17 100644 --- a/src/pkginfo.c +++ b/src/pkginfo.c @@ -39,6 +39,19 @@ typedef struct _internal_param_t { static const char *__appid = NULL; static const char *__pkgid = NULL; +SLPAPI int aul_app_get_pid(const char *appid) +{ + int ret = 0; + + if (appid == NULL) + return -1; + + ret = __app_send_raw(AUL_UTIL_PID, APP_GET_PID, (unsigned char *)appid, + strlen(appid)); + + return ret; +} + SLPAPI int aul_app_is_running(const char *appid) { int ret = 0; diff --git a/test/aul_test.c b/test/aul_test.c index d798656e..a9442656 100644 --- a/test/aul_test.c +++ b/test/aul_test.c @@ -435,6 +435,14 @@ static int get_status_pid() return 0; } +static int get_pid() +{ + static int num = 0; + + printf("[aul_app_get_pid %d test] %s \n", num++, gargv[2]); + return aul_app_get_pid(gargv[2]);; +} + static int update_running_list() { aul_running_list_update(gargv[2], gargv[3], gargv[4]); @@ -596,6 +604,8 @@ static test_func_t test_func[] = { "[usage] reload"}, {"get_status_pid", get_status_pid, "aul_app_get_status_bypid test", "[usage] get_status_pid <pid>"}, + {"get_pid", get_pid, "aul_app_get_pid test", + "[usage] get_pid <appid>"}, }; int callfunc(char *testname) |