summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHwankyu Jhun <h.jhun@samsung.com>2015-12-10 17:12:26 -0800
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>2015-12-10 17:12:26 -0800
commit84e940e56d169cbba8c4b281656541ff752a6a84 (patch)
tree527a8596ce4e29466eb5f0028059fb78b03d2a24
parent8020ab341767103939c8b8cc38d487b605cd8429 (diff)
parenta60db24d22d1ed97df016bc72bf8308228957546 (diff)
downloadaul-1-84e940e56d169cbba8c4b281656541ff752a6a84.tar.gz
aul-1-84e940e56d169cbba8c4b281656541ff752a6a84.tar.bz2
aul-1-84e940e56d169cbba8c4b281656541ff752a6a84.zip
Merge "Add aul_app_get_pid API" into tizen
-rw-r--r--am_daemon/amd_request.c1
-rw-r--r--include/app_sock.h1
-rw-r--r--include/aul.h13
-rw-r--r--src/pkginfo.c13
-rw-r--r--test/aul_test.c10
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)