sndret = sendmsg(sock, &msg, 0);
_D("sendmsg ret : %d", sndret);
- if(sndret < 0) return -errno;
- else return sndret;
+ if (sndret < 0)
+ return -errno;
+ else
+ return sndret;
}
static int __send_result_data(int fd, int cmd, unsigned char *kb_data, int datalen)
static void __real_send(int clifd, int ret)
{
if (send(clifd, &ret, sizeof(int), MSG_NOSIGNAL) < 0) {
- if (errno == EPIPE) {
+ if (errno == EPIPE)
_E("send failed due to EPIPE.\n");
- }
+
_E("send fail to client");
}
int pid;
pid_str = bundle_get_val(kb, AUL_K_ORG_CALLER_PID);
- if(pid_str)
+ if (pid_str)
goto end;
pid_str = bundle_get_val(kb, AUL_K_CALLER_PID);
return AUL_R_ERROR;
pgid = getpgid(cr_pid);
- if(pgid > 0) {
+ if (pgid > 0) {
snprintf(tmp_pid, MAX_PID_STR_BUFSZ, "%d", pgid);
- bundle_del(kb,AUL_K_CALLEE_PID);
+ bundle_del(kb, AUL_K_CALLEE_PID);
bundle_add(kb, AUL_K_CALLEE_PID, tmp_pid);
}
ret = _term_req_app(pid, clifd);
break;
case APP_TERM_BY_PID_ASYNC:
- if ((ret = __app_send_raw_with_noreply(pid, cmd, (unsigned char *)&dummy, sizeof(int))) < 0) {
+ if ((ret = __app_send_raw_with_noreply(pid, cmd, (unsigned char *)&dummy, sizeof(int))) < 0)
_D("terminate req packet send error");
- }
+
__real_send(clifd, ret);
break;
case APP_PAUSE_BY_PID:
static int __dispatch_get_socket_pair(int clifd, const app_pkt_t *pkt, struct ucred *cr)
{
-
char *caller;
char *callee;
char *socket_pair_key;
int socket_pair_key_len;
- int *handles;
+ int *handles = NULL;
struct iovec vec[3];
- int msglen;
+ int msglen = 0;
char buffer[1024];
struct sockaddr_un saddr;
char *datacontrol_type;
socket_pair_key_len = strlen(caller) + strlen(callee) + 2;
socket_pair_key = (char *)calloc(socket_pair_key_len, sizeof(char));
-
if (socket_pair_key == NULL) {
_E("calloc fail");
goto err_out;
_E("socket pair key : %s", socket_pair_key);
handles = g_hash_table_lookup(__socket_pair_hash, socket_pair_key);
-
if (handles == NULL) {
-
handles = (int *)calloc(2, sizeof(int));
if (socketpair(AF_UNIX, SOCK_STREAM, 0, handles) != 0) {
_E("error create socket pair");
goto err_out;
}
- if(handles[0] == -1) {
+ if (handles[0] == -1) {
_E("error socket open");
__send_result_to_client(clifd, -1);
goto err_out;
if (datacontrol_type != NULL) {
_E("datacontrol_type : %s", datacontrol_type);
if (strcmp(datacontrol_type, "consumer") == 0) {
-
msglen = __send_message(clifd, vec, 1, &handles[0], 1);
- if(msglen < 0) {
+ if (msglen < 0) {
_E("Error[%d]: while sending message\n", -msglen);
__send_result_to_client(clifd, -1);
goto err_out;
g_hash_table_remove(__socket_pair_hash, socket_pair_key);
}
- }
- else {
+ } else {
msglen = __send_message(clifd, vec, 1, &handles[1], 1);
- if(msglen < 0) {
+ if (msglen < 0) {
_E("Error[%d]: while sending message\n", -msglen);
__send_result_to_client(clifd, -1);
goto err_out;
}
strncpy(appid, (const char*)pkt->data, MAX_PACKAGE_STR_SIZE-1);
ret = _status_app_is_running(appid, cr->uid);
- SECURE_LOGD("APP_IS_RUNNING : %s : %d",appid, ret);
+ SECURE_LOGD("APP_IS_RUNNING : %s : %d", appid, ret);
__send_result_to_client(clifd, ret);
free(appid);
print_usage(argv[0]);
return -1;
} else {
- strcpy(args.appid, optarg);
+ strncpy(args.appid, optarg, sizeof(args.appid) - 1);
}
op = next_opt;
break;
int (*dl_do_pre_exe) (char *, char *);
} preexec_list_t;
-static void __preexec_list_free()
+static void __preexec_list_free(void)
{
GSList *iter = NULL;
preexec_list_t *type_t;
}
#else
-
-static void __preexec_list_free()
-{
-}
-
static inline void __preexec_init(int argc, char **argv)
{
}
*/
-#ifdef PRELOAD_ACTIVATE
+#ifdef PRELOAD_ACTIVATE
#include <dlfcn.h>
#define PRELOAD_FILE SHARE_PREFIX"/preload_list.txt"
g_argc = argc;
g_argv = argv;
- for (i = 0; i < argc; i++) {
+ for (i = 0; i < argc; i++)
max_cmdline_size += (strlen(argv[i]) + 1);
- }
+
_D("max_cmdline_size = %d", max_cmdline_size);
preload_list = fopen(PRELOAD_FILE, "rt");
return;
handle = dlopen(argv[0], RTLD_LAZY | RTLD_GLOBAL);
- if (handle == NULL) {
+ if (handle == NULL)
return;
- }
dl_main = dlsym(handle, "main");
if (dl_main != NULL) {
#else
-static inline void __preload_init();
-static inline void __preload_exec(int argc, char **argv);
+static inline void __preload_init()
+{
+}
+
+static inline void __preload_exec(int argc, char **argv)
+{
+}
#endif
#include <tizen-extension-client-protocol.h>
static struct tizen_policy *tz_policy = NULL;
-static void
-_reg_handle_global(void *data, struct wl_registry *reg, uint32_t id, const char *interface, uint32_t ver)
+static void _reg_handle_global(void *data, struct wl_registry *reg, uint32_t id,
+ const char *interface, uint32_t ver)
{
- if (!strcmp(interface, "tizen_policy"))
- {
- tz_policy = wl_registry_bind(reg,
- id,
- &tizen_policy_interface,
- 1);
- }
+ if (!strcmp(interface, "tizen_policy")) {
+ tz_policy = wl_registry_bind(reg, id,
+ &tizen_policy_interface, 1);
+ }
}
-static void
-_reg_handle_global_remove(void *data, struct wl_registry *reg, uint32_t id)
+static void _reg_handle_global_remove(void *data, struct wl_registry *reg,
+ uint32_t id)
{
- // do nothing
- ;
+ /* do nothing */
}
-static const struct wl_registry_listener reg_listener =
-{
- _reg_handle_global,
- _reg_handle_global_remove
+static const struct wl_registry_listener reg_listener = {
+ _reg_handle_global,
+ _reg_handle_global_remove
};
#endif
wl_registry_add_listener(reg, ®_listener, NULL);
wl_display_roundtrip(dpy);
- if (!tz_policy)
- {
+ if (!tz_policy) {
_E("ERR: no tizen_policy global interface");
wl_registry_destroy(reg);
wl_display_disconnect(dpy);
wl_registry_destroy(reg);
wl_display_disconnect(dpy);
#else
- //ecore_x_icccm_transient_for_set(child_wid, parent_wid);
+ /* ecore_x_icccm_transient_for_set(child_wid, parent_wid); */
#endif
}
wl_registry_add_listener(reg, ®_listener, NULL);
wl_display_roundtrip(dpy);
- if (!tz_policy)
- {
+ if (!tz_policy) {
_E("ERR: no tz_policy global interface");
wl_registry_destroy(reg);
wl_display_disconnect(dpy);
wl_registry_destroy(reg);
wl_display_disconnect(dpy);
#else
- //ecore_x_icccm_transient_for_unset(child_wid);
+ /* ecore_x_icccm_transient_for_unset(child_wid); */
#endif
}
if (ret != NULL) {
*cnt = ret->len / sizeof(int);
- if (ret->len > 0 && ret->len <= INT_MAX) {
+ if (ret->len > 0 && ret->len <= AUL_SOCK_MAXBUFF - 8) {
*pids = malloc(ret->len);
if (*pids == NULL) {
_E("out of memory");
void *user_data)
{
const char *interface;
- const char *cooldown_status;
int pid = -1;
DBusError error;
if (!system_bus && session_bus_initialized)
return 0;
- if (system_bus && system_bus_initialized) {
+ if (system_bus && system_bus_initialized)
return __app_dbus_signal_add_rule(system_conn, path, interface);
- }
dbus_error_init(&error);
bus = dbus_bus_get_private(system_bus ? DBUS_BUS_SYSTEM : DBUS_BUS_SESSION, &error);
end:
dbus_error_free(&err);
- if (msg) {
+ if (msg)
dbus_message_unref(msg);
- }
- if (send_conn) {
+ if (send_conn)
dbus_connection_unref(send_conn);
- }
return ret;
dbus_connection_flush(send_conn);
end:
- if (msg) {
+ if (msg)
dbus_message_unref(msg);
- }
+
return ret;
}
dbus_connection_flush(send_conn);
end:
- if (msg) {
+ if (msg)
dbus_message_unref(msg);
- }
return ret;
}
dbus_connection_flush(send_conn);
end:
- if (msg) {
+ if (msg)
dbus_message_unref(msg);
- }
return ret;
-
}
SLPAPI int aul_send_app_status_change_signal(int pid, const char *appid, const char *pkgid, const char *status, const char *type)
dbus_connection_flush(send_conn);
end:
- if (msg) {
+ if (msg)
dbus_message_unref(msg);
- }
return ret;
}
dbus_connection_flush(send_conn);
end:
- if (msg) {
+ if (msg)
dbus_message_unref(msg);
- }
+
return ret;
}
dbus_connection_flush(send_conn);
end:
- if (msg) {
+ if (msg)
dbus_message_unref(msg);
- }
return ret;
}
static inline void __set_sock_option(int fd, int cli)
{
int size;
- struct timeval tv = { 5, 200 * 1000 }; /* 5.2 sec */
+ struct timeval tv = { 5, 200 * 1000 }; /* 5.2 sec */
size = AUL_SOCK_MAXBUFF;
setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size));
struct sockaddr_un saddr;
struct sockaddr_un p_saddr;
int fd;
- mode_t orig_mask;
fd = socket(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
/* support above version 2.6.27*/
unlink(saddr.sun_path);
/* labeling to socket for SMACK */
- if (getuid() == 0) { // this is meaningful iff current user is ROOT
+ if (getuid() == 0) { /* this is meaningful iff current user is ROOT */
if (fsetxattr(fd, "security.SMACK64IPOUT", "@", 1, 0) < 0) {
/* in case of unsupported filesystem on 'socket' */
/* or permission error by using 'emulator', bypass*/
/* get the ANCILLARY data */
cmsg = CMSG_FIRSTHDR(&msg);
if (cmsg == NULL) {
- if(nr_fds != NULL)
+ if (nr_fds != NULL)
*nr_fds = 0;
} else {
int iter = 0;
int fdnum = 0;
- for (; cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg), iter ++) {
- switch(cmsg->cmsg_type) {
- case SCM_RIGHTS:
- if (fds != NULL)
- fdnum = __get_descriptors(cmsg, &msg, fds, MAX_NR_OF_DESCRIPTORS);
- if (nr_fds != NULL)
- *nr_fds = fdnum;
- break;
+ for (; cmsg != NULL; cmsg = CMSG_NXTHDR(&msg, cmsg), iter++) {
+ switch (cmsg->cmsg_type) {
+ case SCM_RIGHTS:
+ if (fds != NULL)
+ fdnum = __get_descriptors(cmsg, &msg, fds, MAX_NR_OF_DESCRIPTORS);
+ if (nr_fds != NULL)
+ *nr_fds = fdnum;
+ break;
}
}
}
if ((len = send(fd, pkt, datalen + 8, 0)) != datalen + 8) {
_E("sendto() failed - %d %d (errno %d)", len, datalen + 8, errno);
- if(len > 0) {
+ if (len > 0) {
while (len != datalen + 8) {
ret = send(fd, &pkt->data[len - 8], datalen + 8 - len, 0);
if (ret < 0) {
_E("second send() failed - %d %d (errno: %d)", ret, datalen + 8, errno);
- if (errno == EPIPE) {
+ if (errno == EPIPE)
_E("pid:%d, fd:%d\n", pid, fd);
- }
+
close(fd);
if (pkt) {
free(pkt);
_D("send() len - %d %d", len, datalen + 8);
}
} else {
- if (errno == EPIPE) {
+ if (errno == EPIPE)
_E("pid:%d, fd:%d\n", pid, fd);
- }
+
close(fd);
if (pkt) {
free(pkt);
retry_recv:
- if(cmd == APP_GET_SOCKET_PAIR) {
-
+ if (cmd == APP_GET_SOCKET_PAIR) {
char recv_buff[1024];
struct iovec vec[3];
int ret = 0;
} else
recv_buff[ret] = '\0';
- if(fds_len > 0){
+ if (fds_len > 0) {
_E("fds : %d", fds[0]);
ret_fd[0] = fds[0];
}
-
} else {
len = recv(fd, &res, sizeof(int), 0);
if (len == -1) {
pkt->len = datalen;
len = 0;
- while( len != pkt->len ) {
+ while (len != pkt->len) {
ret = recv(*clifd, pkt->data + len, pkt->len - len, 0);
if (ret < 0) {
_E("recv error %d %d", len, pkt->len);
pkt->len = len;
len = 0;
- while( len != pkt->len ) {
+ while (len != pkt->len) {
ret = recv(fd, pkt->data + len, pkt->len - len, 0);
if (ret < 0) {
if (errno == EINTR) {
if (info->regex != NULL)
free(info->regex);
+
if (info->desc != NULL)
free(info->desc);
return NULL;
}
- info = (miregex_file_info *) malloc(sizeof(miregex_file_info));
- if(info == NULL) {
+ info = (miregex_file_info *)malloc(sizeof(miregex_file_info));
+ if (info == NULL) {
fclose(f);
return NULL;
}
-
+
info->regex = NULL;
info->desc = NULL;
info->desc = strdup(oneline);
}
- /*_D("conf file process done : info->regex = %s,
- info->desc = %s",info->regex, info->desc);*/
fclose(f);
return info;
if (regex == NULL)
return -1;
- tbl = (regex_tbl *) malloc(sizeof(regex_tbl));
+ tbl = (regex_tbl *)malloc(sizeof(regex_tbl));
if (NULL == tbl) {
_E("Malloc failed!");
return -1;
free(tbl);
tbl = NULL;
}
+
return -1;
}
regerror(error, &(tbl->regex_preg), msg, ret);
free(msg);
msg = NULL;
}
+
if (tbl) {
free(tbl);
tbl = NULL;
}
+
return -1;
}
tbl->next = miregex_tbl;
miregex_tbl = tbl;
- /*_D("added regex - %d %s %s##",getpid(),tbl->mimetype,tbl->regex);*/
-
return 0;
}
regex_tbl *miregex_get_regex_table()
{
DIR *dp;
- struct dirent *dentry;
+ struct dirent dentry;
+ struct dirent *result = NULL;
char buf[MAX_LOCAL_BUFSZ];
miregex_file_info *info;
if (dp == NULL)
return NULL;
- while ((dentry = readdir(dp)) != NULL) {
- if (dentry->d_name[0] == '.')
+ while (readdir_r(dp, &dentry, &result) == 0 && result != NULL) {
+ if (dentry.d_name[0] == '.')
continue;
snprintf(buf, sizeof(buf), "%s/%s", MIREGEX_DIR,
- dentry->d_name);
+ dentry.d_name);
info = __get_miregex_file_info(buf);
if (info == NULL)
continue;
- if (__add_miregex(dentry->d_name,
+ if (__add_miregex(dentry.d_name,
info->regex, info->desc) < 0) {
/* TODO : invalid regular expression - will be removed*/
}
return miregex_tbl;
}
-
GSList *tmp_list;
static aul_svc_cb_info_t *__create_rescb(int request_code,
- aul_svc_res_fn cbfunc,
- void *data);
+ aul_svc_res_fn cbfunc, void *data);
static void __remove_rescb(aul_svc_cb_info_t *info);
static int __set_bundle(bundle *b, const char *key, const char *value);
static void __aul_cb(bundle *b, int is_cancel, void *data);
static int __run_svc_with_pkgname(char *pkgname, bundle *b, int request_code,
- aul_svc_res_fn cbfunc, void *data, uid_t uid);
+ aul_svc_res_fn cbfunc, void *data, uid_t uid);
static int __get_resolve_info(bundle *b, aul_svc_resolve_info_t *info);
static int __free_resolve_info_data(aul_svc_resolve_info_t *info);
}
static aul_svc_cb_info_t *__create_rescb(int request_code,
- aul_svc_res_fn cbfunc,
- void *data)
+ aul_svc_res_fn cbfunc, void *data)
{
aul_svc_cb_info_t* info;
val = bundle_get_val(b, key);
if (val) {
- if ( bundle_del(b, key) != 0 ) {
+ if (bundle_del(b, key) != 0)
return AUL_SVC_RET_ERROR;
- }
}
if (!value)
return AUL_SVC_RET_EINVAL;
- if ( bundle_add(b, key, value) != 0 ) {
+ if (bundle_add(b, key, value) != 0)
return AUL_SVC_RET_ERROR;
- }
_D("__set_bundle");
return AUL_SVC_RET_OK;
}
-static int __set_bundle_array(bundle *b, const char *key, const char **value,
- int len)
+static int __set_bundle_array(bundle *b, const char *key,
+ const char **value, int len)
{
int type;
type = aul_svc_data_is_array(b, key);
if (type == 1) {
- if ( bundle_del(b, key) != 0 ) {
+ if (bundle_del(b, key) != 0)
return AUL_SVC_RET_ERROR;
- }
}
if (!value)
return AUL_SVC_RET_EINVAL;
- if ( bundle_add_str_array(b, key, value, len) != 0 ) {
+ if (bundle_add_str_array(b, key, value, len) != 0)
return AUL_SVC_RET_ERROR;
- }
_D("__set_bundle_array");
/* find corresponding callback */
cb_info = (aul_svc_cb_info_t*)data;
- cb_info->cb_func(b, cb_info->request_code, (aul_svc_result_val)res,
- cb_info->data);
+ cb_info->cb_func(b, cb_info->request_code,
+ (aul_svc_result_val)res, cb_info->data);
__remove_rescb(cb_info);
-
return;
}
static int __run_svc_with_pkgname(char *pkgname, bundle *b, int request_code,
- aul_svc_res_fn cbfunc, void *data, uid_t uid)
+ aul_svc_res_fn cbfunc, void *data, uid_t uid)
{
aul_svc_cb_info_t *cb_info = NULL;
int ret = -1;
- if ( bundle_get_type(b, AUL_SVC_K_SELECTOR_EXTRA_LIST) != BUNDLE_TYPE_NONE ) {
- if ( !aul_svc_get_pkgname(b) ) {
+ if (bundle_get_type(b, AUL_SVC_K_SELECTOR_EXTRA_LIST) != BUNDLE_TYPE_NONE) {
+ if (!aul_svc_get_pkgname(b))
pkgname = APP_SELECTOR;
- }
}
- if ( bundle_get_val(b, AUL_K_FORCE_LAUNCH_APP_SELECTOR) ) {
+ if (bundle_get_val(b, AUL_K_FORCE_LAUNCH_APP_SELECTOR))
pkgname = APP_SELECTOR;
- }
- if ( __is_special_app(pkgname)) {
+ if (__is_special_app(pkgname)) {
bundle_del(b, AUL_SVC_K_CAN_BE_LEADER);
bundle_add_str(b, AUL_SVC_K_CAN_BE_LEADER, "true");
bundle_del(b, AUL_SVC_K_REROUTE);
bundle_add_str(b, AUL_SVC_K_REROUTE, "true");
bundle_del(b, AUL_SVC_K_RECYCLE);
bundle_add_str(b, AUL_SVC_K_RECYCLE, "true");
-
}
if (cbfunc) {
#ifdef _APPFW_FEATURE_MULTI_INSTANCE
const char* data = bundle_get_val(b, AUL_SVC_K_MULTI_INSTANCE);
- if (data) {
+ if (data)
SECURE_LOGD("multi_instance value = %s", data);
- }
- if (data && strncmp(data, "TRUE", strlen("TRUE")) == 0) {
+ if (data && strncmp(data, "TRUE", strlen("TRUE")) == 0)
ret = aul_launch_app_for_multi_instance(pkgname, b);
- } else {
+ else
ret = aul_launch_app(pkgname, b);
- }
#else
ret = aul_launch_app_for_uid(pkgname, b, uid);
#endif
static int __get_resolve_info(bundle *b, aul_svc_resolve_info_t *info)
{
char *tmp = NULL;
+ char *saveptr = NULL;
char *strtok_buf = NULL;
int ret = -1;
GMatchInfo *match_info;
GError *error = NULL;
- regex = g_regex_new ("^(([^:/?#]+):)?(//([^/?#]*))?", 0, 0, &error);
- if (g_regex_match (regex, info->uri, 0, &match_info) == FALSE) {
- g_regex_unref (regex);
+ regex = g_regex_new("^(([^:/?#]+):)?(//([^/?#]*))?", 0, 0, &error);
+ if (g_regex_match(regex, info->uri, 0, &match_info) == FALSE) {
+ g_regex_unref(regex);
return AUL_SVC_RET_EINVAL;
}
- info->scheme = g_match_info_fetch (match_info, 2);
- info->host = g_match_info_fetch (match_info, 4);
+ info->scheme = g_match_info_fetch(match_info, 2);
+ info->host = g_match_info_fetch(match_info, 4);
if (info->scheme && info->host) {
info->uri_r_info = malloc(MAX_SCHEME_STR_SIZE + MAX_HOST_STR_SIZE + 2);
}
snprintf(info->uri_r_info, MAX_SCHEME_STR_SIZE + MAX_HOST_STR_SIZE + 1,
- "%s://%s", info->scheme, info->host);
+ "%s://%s", info->scheme, info->host);
}
- g_match_info_free (match_info);
- g_regex_unref (regex);
+ g_match_info_free(match_info);
+ g_regex_unref(regex);
} else {
info->scheme = strdup("NULL");
}
tmp = strdup(info->mime);
- strtok_buf = strtok(tmp, "/");
+ strtok_buf = strtok_r(tmp, "/", &saveptr);
if (strtok_buf)
strncpy(info->m_type, strtok_buf, MAX_LOCAL_BUFSZ - 1);
- strtok_buf = strtok(NULL, "/");
+ strtok_buf = strtok_r(NULL, "/", &saveptr);
if (strtok_buf)
strncpy(info->s_type, strtok_buf, MAX_LOCAL_BUFSZ - 1);
free(tmp);
- if (strncmp(info->m_type, "*", 1) == 0) {
+ if (strncmp(info->m_type, "*", 1) == 0)
strncpy(info->m_type, "%", MAX_LOCAL_BUFSZ - 1);
- }
- if (strncmp(info->s_type, "*", 1) == 0) {
+ if (strncmp(info->s_type, "*", 1) == 0)
strncpy(info->s_type, "%", MAX_LOCAL_BUFSZ - 1);
- }
info->mime = malloc(MAX_MIME_STR_SIZE);
if (info->mime == NULL) {
return AUL_SVC_RET_ERROR;
}
- snprintf(info->mime, MAX_MIME_STR_SIZE - 1, "%s/%s", info->m_type,
- info->s_type);
+ snprintf(info->mime, MAX_MIME_STR_SIZE - 1,
+ "%s/%s", info->m_type, info->s_type);
}
return 0;
}
static int __get_list_with_condition_mime_extened(char *op, char *uri,
- char *mime, char *m_type, char *s_type, GSList **pkg_list, uid_t uid)
+ char *mime, char *m_type, char *s_type,
+ GSList **pkg_list, uid_t uid)
{
char *tmp;
}
static int __get_list_with_condition_mime_extened_with_collation(char *op,
- char *uri, char *mime, char *m_type, char *s_type, GSList **pkg_list, uid_t uid)
+ char *uri, char *mime, char *m_type,
+ char *s_type, GSList **pkg_list, uid_t uid)
{
char *tmp;
ret = pkgmgrinfo_appinfo_filter_create(&handle);
ret = pkgmgrinfo_appinfo_filter_add_string(handle,
- PMINFO_APPINFO_PROP_APP_CATEGORY, category);
+ PMINFO_APPINFO_PROP_APP_CATEGORY, category);
tmp_list = *pkg_list;
- ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, __app_list_cb,
- &app_list, uid);
+ ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle,
+ __app_list_cb, &app_list, uid);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(handle);
return -1;
return 0;
}
-static int __appid_compare(gconstpointer data1, gconstpointer data2)
-{
- char *a = (char *)data1;
- char *b = (char *)data2;
- return strcmp(a, b);
-}
-
static int __check_mainapp_mode(char *operation)
{
return 0;
}
static int __get_list_with_submode(char *operation, char *win_id,
- GSList **pkg_list, uid_t uid)
+ GSList **pkg_list, uid_t uid)
{
int ret = 0;
int mainapp_mode = 0;
SLPAPI int aul_svc_add_data(bundle *b, const char *key, const char *val)
{
- if (b == NULL || key == NULL) {
+ if (b == NULL || key == NULL)
return AUL_SVC_RET_EINVAL;
- }
/* check key for data */
/******************/
}
SLPAPI int aul_svc_add_data_array(bundle *b, const char *key,
- const char **val_array, int len)
+ const char **val_array, int len)
{
- if (b == NULL || key == NULL) {
+ if (b == NULL || key == NULL)
return AUL_SVC_RET_EINVAL;
- }
/* check key for data */
/******************/
return __set_bundle_array(b, key, val_array, len);
}
-
SLPAPI int aul_svc_set_pkgname(bundle *b, const char *pkg_name)
{
if (b == NULL) {
return __set_bundle(b, AUL_SVC_K_PKG_NAME, pkg_name);
}
-
SLPAPI int aul_svc_set_appid(bundle *b, const char *appid)
{
char *alias_id = NULL;
}
SLPAPI int aul_svc_run_service(bundle *b, int request_code,
- aul_svc_res_fn cbfunc,
- void *data)
+ aul_svc_res_fn cbfunc, void *data)
{
return aul_svc_run_service_for_uid(b, request_code, cbfunc, data, getuid());
}
SLPAPI int aul_svc_run_service_for_uid(bundle *b, int request_code,
- aul_svc_res_fn cbfunc,
- void *data, uid_t uid)
+ aul_svc_res_fn cbfunc, void *data, uid_t uid)
{
aul_svc_resolve_info_t info;
char *pkgname;
return ret;
}
- SECURE_LOGD("op - %s / mime - %s / scheme - %s\n", info.op, info.origin_mime,
- info.scheme);
+ SECURE_LOGD("op - %s / mime - %s / scheme - %s\n",
+ info.op, info.origin_mime, info.scheme);
ret = _svc_db_check_perm(uid, true);
if (ret < 0) {
pkgname = _svc_db_get_app(info.op, info.origin_mime, info.uri, uid);
if (pkgname == NULL) {
__get_list_with_condition_mime_extened_with_collation(info.op, info.uri,
- info.mime, info.m_type, info.s_type, &pkg_list, uid);
+ info.mime, info.m_type, info.s_type, &pkg_list, uid);
pkg_count = g_slist_length(pkg_list);
if (pkg_count > 0) {
info.mime, info.m_type, info.s_type, &pkg_list, uid);
}
- if (info.category) {
+ if (info.category)
__get_list_with_category(info.category, &pkg_list, uid);
- }
__get_list_with_submode(info.op, info.win_id, &pkg_list, uid);
if (pkgname == NULL) {
__get_list_with_condition_mime_extened(info.op, info.uri_r_info,
- info.mime, info.m_type, info.s_type, &pkg_list, uid);
+ info.mime, info.m_type, info.s_type, &pkg_list, uid);
pkg_count = g_slist_length(pkg_list);
if (pkg_count > 0) {
__get_list_with_condition_mime_extened(info.op, info.scheme,
info.mime, info.m_type, info.s_type, &pkg_list, uid);
}
- if (info.category) {
+ if (info.category)
__get_list_with_category(info.category, &pkg_list, uid);
- }
__get_list_with_submode(info.op, info.win_id, &pkg_list, uid);
info.mime, info.m_type, info.s_type, &pkg_list, uid);
}
- if (info.category) {
+ if (info.category)
__get_list_with_category(info.category, &pkg_list, uid);
- }
__get_list_with_submode(info.op, info.win_id, &pkg_list, uid);
info.mime);
__get_list_with_condition_mime_extened_with_collation(info.op, info.uri,
- info.mime, info.m_type, info.s_type, &pkg_list, uid);
+ info.mime, info.m_type, info.s_type, &pkg_list, uid);
if (info.uri_r_info) {
__get_list_with_condition_mime_extened(info.op, info.uri_r_info,
info.mime, info.m_type, info.s_type, &pkg_list, uid);
}
- if (info.category) {
+ if (info.category)
__get_list_with_category(info.category, &pkg_list, uid);
- }
__get_list_with_submode(info.op, info.win_id, &pkg_list, uid);
for (iter = pkg_list; iter != NULL; iter = g_slist_next(iter)) {
pkgname = iter->data;
SECURE_LOGD("PKGNAME : %s\n", pkgname);
- if ( iter_fn(pkgname, data) != 0)
+ if (iter_fn(pkgname, data) != 0)
break;
g_free(pkgname);
}
for (iter = pkg_list; iter != NULL; iter = g_slist_next(iter)) {
pkgname = iter->data;
- if ( iter_fn(pkgname, data) != 0)
+ if (iter_fn(pkgname, data) != 0)
break;
g_free(pkgname);
}
}
SLPAPI int aul_svc_set_defapp(const char *op, const char *mime_type,
- const char *uri,
- const char *defapp)
+ const char *uri, const char *defapp)
{
return aul_svc_set_defapp_for_uid(op, mime_type, uri, defapp, getuid());
}
SLPAPI int aul_svc_set_defapp_for_uid(const char *op, const char *mime_type,
- const char *uri,
- const char *defapp,
- uid_t uid)
+ const char *uri, const char *defapp, uid_t uid)
{
int ret;
}
ret = _svc_db_add_app(op, mime_type, uri, defapp, uid);
-
if (ret < 0)
return AUL_SVC_RET_ERROR;
}
SLPAPI int aul_svc_request_transient_app(bundle *b, int callee_wid,
- aul_svc_host_res_fn cbfunc, void *data)
+ aul_svc_host_res_fn cbfunc, void *data)
{
return 0;
}
#define QUERY_ATTACH "attach database '%s' as Global"
#define QUERY_CREATE_VIEW_1 "CREATE temp VIEW package_app_app_control as select * "\
- "from (select *,0 as for_all_users from main.package_app_app_control union select *,1 as for_all_users from Global.package_app_app_control)"
+ "from (select *,0 as for_all_users from main.package_app_app_control union select *,1 as for_all_users from Global.package_app_app_control)"
#define QUERY_CREATE_VIEW_2 "CREATE temp VIEW package_app_info as select * "\
- "from (select *,0 as for_all_users from main.package_app_info union select *,1 as for_all_users from Global.package_app_info)"
+ "from (select *,0 as for_all_users from main.package_app_info union select *,1 as for_all_users from Global.package_app_info)"
#define QUERY_CREATE_TABLE_APPSVC "create table if not exists appsvc " \
"(operation text, " \
"mime_type text, " \
snprintf(tmp, sizeof(tmp), "%s", dir);
len = strlen(tmp);
- if(tmp[len - 1] == '/')
+ if (tmp[len - 1] == '/')
tmp[len - 1] = 0;
- for(p = tmp + 1; *p; p++) {
- if(*p == '/') {
+ for (p = tmp + 1; *p; p++) {
+ if (*p == '/') {
*p = 0;
ret = mkdir(tmp, mode);
if (ret && errno != EEXIST)
*p = '/';
}
}
+
return mkdir(tmp, mode);
}
-static void __mkdir_for_user(const char* dir, uid_t uid, gid_t gid) {
+static void __mkdir_for_user(const char* dir, uid_t uid, gid_t gid)
+{
int ret = 0;
ret = __mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IXOTH);
_E("Fail to create directory %s %d", dir, errno);
} else if (getuid() == ROOT_UID) {
ret = chown(dir, uid, gid);
- if (ret == -1)
- _E("Fail to chown %s %d.%d, because %s", dir, uid, gid, strerror(errno));
+ if (ret == -1) {
+ _E("Fail to chown %s %d.%d, because %d",
+ dir, uid, gid, errno);
+ }
}
}
}
if (uid_caller == ROOT_UID || uid_caller == uid)
- __mkdir_for_user (db_path, uid, gid);
+ __mkdir_for_user(db_path, uid, gid);
return appsvc_db;
}
}
if (uid_caller == ROOT_UID || uid_caller == uid)
- __mkdir_for_user (db_path, uid, gid);
+ __mkdir_for_user(db_path, uid, gid);
return app_info_db;
}
/**
* db initialize
*/
-
static int __init(uid_t uid, bool readonly)
{
int rc;
}
rc = sqlite3_exec(svc_db, "PRAGMA journal_mode = PERSIST", NULL, NULL, NULL);
- if (SQLITE_OK != rc) {
+ if (rc != SQLITE_OK) {
_E("Fail to change journal mode\n");
goto err;
}
rc = sqlite3_exec(svc_db, QUERY_CREATE_TABLE_APPSVC, NULL, NULL, NULL);
- if(SQLITE_OK!=rc){
+ if (rc != SQLITE_OK) {
_E("Fail to create tables\n");
goto err;
}
}
static int __collate_appsvc(void *ucol, int str1_len, const void *str1,
- int str2_len, const void *str2)
+ int str2_len, const void *str2)
{
char *saveptr1 = NULL;
char *saveptr2 = NULL;
continue;
}
- if ( (strcmp(op, in_op) == 0) && (strcmp(mime, in_mime) == 0) ) {
+ if ((strcmp(op, in_op) == 0) && (strcmp(mime, in_mime) == 0)) {
SECURE_LOGD("%s %s %s %s %s %s", op, in_op, mime, in_mime, uri, in_uri);
if (g_pattern_match_simple(uri, in_uri)) {
SECURE_LOGD("in_uri : %s | uri : %s", in_uri, uri);
return 0;
}
}
- } while ( (token = strtok_r(NULL, ";", &saveptr1)) );
+ } while ((token = strtok_r(NULL, ";", &saveptr1)));
free(dup_str1);
free(dup_str2);
goto err;
}
- rc = sqlite3_exec(app_info_db, "PRAGMA journal_mode = PERSIST", NULL, NULL,
- NULL);
+ rc = sqlite3_exec(app_info_db, "PRAGMA journal_mode = PERSIST",
+ NULL, NULL, NULL);
if (SQLITE_OK != rc) {
_D("Fail to change journal mode\n");
goto err;
}
- sqlite3_create_collation(app_info_db, SVC_COLLATION, SQLITE_UTF8, NULL,
- __collate_appsvc);
+ sqlite3_create_collation(app_info_db, SVC_COLLATION, SQLITE_UTF8,
+ NULL, __collate_appsvc);
return 0;
err:
sqlite3_close(app_info_db);
app_info_db = NULL;
+
return -1;
}
int _svc_db_check_perm(uid_t uid, bool readonly)
{
int ret = 0;
+ const char *db;
+
if (__init(uid, readonly) < 0)
return -1;
- ret = access(__get_svc_db(uid), readonly ? R_OK : (R_OK | W_OK));
+ db = __get_svc_db(uid);
+ if (db == NULL)
+ return -1;
+
+ ret = access(db, readonly ? R_OK : (R_OK | W_OK));
return ret;
}
int _svc_db_add_app(const char *op, const char *mime_type, const char *uri,
- const char *pkg_name, uid_t uid)
+ const char *pkg_name, uid_t uid)
{
char m[BUF_MAX_LEN];
char u[URI_MAX_LEN];
if (__init(uid, false) < 0)
return -1;
- if (op == NULL )
+ if (op == NULL)
return -1;
if (mime_type == NULL)
result = sqlite3_prepare_v2(svc_db, insert_query, strlen(insert_query),
- &p_statement, NULL);
+ &p_statement, NULL);
if (result != SQLITE_OK) {
_E("Sqlite3 error [%d] : <%s> preparing <%s> querry\n", result,
sqlite3_errmsg(svc_db), insert_query);
sqlite3_bind_text(p_statement, 3, u, -1, SQLITE_TRANSIENT);
sqlite3_bind_text(p_statement, 4, pkg_name, -1, SQLITE_TRANSIENT);
-
result = sqlite3_step(p_statement);
if (result != SQLITE_DONE) {
_E("Sqlite3 error [%d] : <%s> executing statement\n", result,
return -1;
result = sqlite3_prepare_v2(svc_db, delete_query, strlen(delete_query),
- &p_statement, NULL);
+ &p_statement, NULL);
if (result != SQLITE_OK) {
_E("Sqlite3 error [%d] : <%s> preparing <%s> querry\n", result,
sqlite3_errmsg(svc_db), delete_query);
return 0;
snprintf(query, QUERY_MAX_LEN,
- "select count(*) from appsvc where pkg_name = '%s';", pkg_name);
+ "select count(*) from appsvc where pkg_name = '%s';", pkg_name);
ret = sqlite3_prepare(svc_db, query, sizeof(query), &stmt, NULL);
if (ret != SQLITE_OK) {
}
ret = sqlite3_step(stmt);
- if (ret == SQLITE_ROW) {
+ if (ret == SQLITE_ROW)
cnt = sqlite3_column_int(stmt, 0);
- }
+
sqlite3_finalize(stmt);
__fini();
char* pkgname;
char* ret_val = NULL;
- if (op == NULL )
+ if (op == NULL)
return NULL;
if (mime_type == NULL)
snprintf(query, QUERY_MAX_LEN,
- "select pkg_name from appsvc where operation='%s' and mime_type='%s' and uri='%s'",
- \
- op, m, u);
+ "select pkg_name from appsvc where operation='%s' and mime_type='%s' and uri='%s'",
+ op, m, u);
SECURE_LOGD("query : %s\n", query);
ret = sqlite3_prepare(svc_db, query, strlen(query), &stmt, NULL);
- if ( ret != SQLITE_OK) {
- _E("prepare error, ret = %d, extended = %d\n", ret,
- sqlite3_extended_errcode(svc_db));
+ if (ret != SQLITE_OK) {
+ _E("prepare error, ret = %d, extended = %d\n",
+ ret, sqlite3_extended_errcode(svc_db));
goto db_fini;
}
SECURE_LOGD("pkgname : %s\n", pkgname);
-stmt_finialize :
+stmt_finialize:
ret = sqlite3_finalize(stmt);
- if ( ret != SQLITE_OK) {
+ if (ret != SQLITE_OK)
_D("finalize error(%d)", ret);
- }
-db_fini :
+db_fini:
__fini();
return ret_val;
if (subapp == NULL)
continue;
- // find if the main app is in the pkg_list
+ /* find if the main app is in the pkg_list */
mainapp = g_slist_find_custom(*pkg_list, submode_mainid, __appid_compare);
if (mainapp == NULL)
continue;
if (win_id && !mainapp_mode)
- //subapp mode - remove mainapp from list
+ /* subapp mode - remove mainapp from list */
excluded_appid = (char *)mainapp->data;
else
- //mainapp mode - remove subapp from list
+ /* mainapp mode - remove subapp from list */
excluded_appid = (char *)subapp->data;
if (excluded_appid) {
}
int _svc_db_get_list_with_condition(char *op, char *uri, char *mime,
- GSList **pkg_list, uid_t uid)
+ GSList **pkg_list, uid_t uid)
{
char query[QUERY_MAX_LEN];
sqlite3_stmt* stmt;
return 0;
snprintf(query, QUERY_MAX_LEN,
- "select ac.app_id from package_app_app_control as ac, package_app_info ai where ac.app_id = ai.app_id and ac.app_control like '%%%s|%s|%s%%' and ai.component_type='uiapp'",
- op, uri, mime);
+ "select ac.app_id from package_app_app_control as ac, package_app_info ai where ac.app_id = ai.app_id and ac.app_control like '%%%s|%s|%s%%' and ai.component_type='uiapp'",
+ op, uri, mime);
SECURE_LOGD("query : %s\n", query);
ret = sqlite3_prepare(app_info_db, query, strlen(query), &stmt, NULL);
- if ( ret != SQLITE_OK) {
- _E("prepare error, ret = %d, extended = %d\n", ret,
- sqlite3_extended_errcode(app_info_db));
+ if (ret != SQLITE_OK) {
+ _E("prepare error, ret = %d, extended = %d\n",
+ ret, sqlite3_extended_errcode(app_info_db));
return -1;
}
}
int _svc_db_get_list_with_collation(char *op, char *uri, char *mime,
- GSList **pkg_list, uid_t uid)
+ GSList **pkg_list, uid_t uid)
{
char query[QUERY_MAX_LEN];
sqlite3_stmt* stmt;
char *pkgname = NULL;
int found;
- if (__init_app_info_db(uid) < 0) {
+ if (__init_app_info_db(uid) < 0)
return 0;
- }
snprintf(query, QUERY_MAX_LEN,
- "select ac.app_id from package_app_app_control as ac, package_app_info ai where ac.app_id = ai.app_id and ac.app_control='%s|%s|%s' collate appsvc_collation and ai.component_type='uiapp'",
- op, uri, mime);
+ "select ac.app_id from package_app_app_control as ac, package_app_info ai where ac.app_id = ai.app_id and ac.app_control='%s|%s|%s' collate appsvc_collation and ai.component_type='uiapp'",
+ op, uri, mime);
SECURE_LOGD("query : %s\n", query);
ret = sqlite3_prepare(app_info_db, query, strlen(query), &stmt, NULL);
- if ( ret != SQLITE_OK) {
- _E("prepare error, ret = %d, extended = %d\n", ret,
- sqlite3_extended_errcode(app_info_db));
+ if (ret != SQLITE_OK) {
+ _E("prepare error, ret = %d, extended = %d\n",
+ ret, sqlite3_extended_errcode(app_info_db));
return -1;
}
snprintf(query, QUERY_MAX_LEN, "select pkg_name from appsvc");
ret = sqlite3_prepare(svc_db, query, sizeof(query), &stmt, NULL);
- if ( ret != SQLITE_OK) {
- _E("prepare error, ret = %d, extended = %d\n", ret,
- sqlite3_extended_errcode(svc_db));
+ if (ret != SQLITE_OK) {
+ _E("prepare error, ret = %d, extended = %d\n",
+ ret, sqlite3_extended_errcode(svc_db));
return -1;
}
if (ret <= 0)
return NULL;
- /* support app launched by shell script*/
+ /* support app launched by shell script */
if (strncmp(buf, BINSH_NAME, BINSH_SIZE) == 0) {
return strdup(&buf[BINSH_SIZE + 1]);
- }
- else if (strncmp(buf, VALGRIND_NAME, VALGRIND_SIZE) == 0) {
+ } else if (strncmp(buf, VALGRIND_NAME, VALGRIND_SIZE) == 0) {
char* ptr = buf;
- // buf comes with double null-terminated string
+ /* buf comes with double null-terminated string */
while (1) {
- while (*ptr) {
+ while (*ptr)
ptr++;
- }
+
ptr++;
if (!(*ptr))
break;
- // ignore trailing "--"
+ /* ignore trailing "--" */
if (strncmp(ptr, "-", 1) != 0)
break;
};
return strdup(ptr);
- }
- else if (strncmp(buf, BASH_NAME, BASH_SIZE) == 0) {
+ } else if (strncmp(buf, BASH_NAME, BASH_SIZE) == 0) {
if (strncmp(&buf[BASH_SIZE + 1], OPROFILE_NAME, OPROFILE_SIZE) == 0) {
- if (strncmp(&buf[BASH_SIZE + OPROFILE_SIZE + 2], OPTION_VALGRIND_NAME, OPTION_VALGRIND_SIZE) == 0) {
+ if (strncmp(&buf[BASH_SIZE + OPROFILE_SIZE + 2], OPTION_VALGRIND_NAME, OPTION_VALGRIND_SIZE) == 0)
return strdup(&buf[BASH_SIZE + OPROFILE_SIZE + OPTION_VALGRIND_SIZE + 3]);
- }
}
}
ssize_t len;
snprintf(buf, sizeof(buf), "/proc/%d/exe", pid);
- len=readlink(buf, buf2, MAX_CMD_BUFSZ - 1);
+ len = readlink(buf, buf2, MAX_CMD_BUFSZ - 1);
if (len <= 0)
return NULL;
buf2[len] = 0;
return pid;
}
-int __proc_iter_pgid(int pgid, int (*iterfunc) (int pid, void *priv,uid_t uid),
- void *priv)
+int __proc_iter_pgid(int pgid, int (*iterfunc)(int pid, void *priv, uid_t uid),
+ void *priv)
{
DIR *dp;
struct dirent *dentry;
int _pgid;
int ret = -1;
uid_t uid;
+
dp = opendir("/proc");
- if (dp == NULL) {
+ if (dp == NULL)
return -1;
- }
while ((dentry = readdir(dp)) != NULL) {
if (!isdigit(dentry->d_name[0]))
_pgid = __get_pgid_from_stat(atoi(dentry->d_name));
if (pgid == _pgid) {
uid = __proc_get_usr_bypid(atoi(dentry->d_name));
- ret = iterfunc(atoi(dentry->d_name), priv,uid);
+ ret = iterfunc(atoi(dentry->d_name), priv, uid);
if (ret >= 0)
break;
}
bundle *kb = NULL;
kb = create_internal_bundle(3);
- if (NULL == kb) {
+ if (kb == NULL)
return -1;
- }
+
printf("[aul_launch_app %d test] %s \n", num++, gargv[2]);
ret = aul_launch_app(gargv[2], kb);
bundle *kb = NULL;
kb = create_internal_bundle(3);
- if (NULL == kb) {
+ if (kb == NULL)
return -1;
- }
+
printf("[aul_launch_app %d test] %s \n", num++, gargv[2]);
ret = aul_launch_app_for_uid(gargv[2], kb, atoi(gargv[3]));
kb = create_internal_bundle(3);
- if (NULL == kb) {
+ if (kb == NULL)
return -1;
- }
ret = aul_launch_app(gargv[2], kb);
{"n", launch_test, "launch_test", ""}
};
-static gboolean run_all_test(void *data)
-{
- static int pos = 0;
- int ret;
-
- if (pos > sizeof(scn_func) / sizeof(test_func_t) - 1) {
- printf("all internal test done\n");
- g_main_loop_quit(mainloop);
- return 0;
- }
-
- if (strncmp(scn_func[pos].name, "n", 1) == 0) {
- printf("[test %d] %s , pkgname = %s\n", pos, scn_func[pos].desc,
- gargv[2]);
- apn_pid = scn_func[pos].func();
- printf("... return pid = %d\n", apn_pid);
- } else {
- printf("[test %d] %s , pid = %d\n", pos, scn_func[pos].desc,
- apn_pid);
- ret = scn_func[pos].func();
- printf("... return res = %d\n", ret);
- }
- pos++;
-
- return 1;
-}
-
int all_test()
{
static int pos = 0;
}
static test_func_t test_func[] = {
- {"launch",launch_test,"aul_launch_app test",
+ {"launch", launch_test, "aul_launch_app test",
"[usage] launch <pkgname> <key1> <val1> <key2> <val2> ..."},
- {"launch_for_uid", launch_test_for_uid, "launch with uid test",
- "[usage] launch_for_uid <appid> <uid>"},
- {"open",open_test,"aul_open_app test",
+ {"launch_for_uid", launch_test_for_uid,
+ "launch with uid test", "[usage] launch_for_uid <appid> <uid>"},
+ {"open", open_test, "aul_open_app test",
"[usage] open <pkgname>" },
- {"resume",resume_test,"aul_resume_app test",
+ {"resume", resume_test, "aul_resume_app test",
"[usage] resume <pkgname>" },
- {"resume_pid",resume_pid_test,"aul_resume_pid test",
+ {"resume_pid", resume_pid_test, "aul_resume_pid test",
"[usage] resume_pid <pid>" },
- {"term_pid", term_pid_test,"aul_terminate_pid test",
+ {"term_pid", term_pid_test, "aul_terminate_pid test",
"[usage] term_pid <pid>" },
- {"term_req_pid", term_req_pid_test,"aul_subapp_terminate_request_pid test",
+ {"term_req_pid", term_req_pid_test, "aul_subapp_terminate_request_pid test",
"[usage] term_req_pid <pid>" },
{"term_pid_without_restart", term_pid_without_restart_test, "aul_terminate_pid_without_restart test",
"[usage] term_pid_without_restart <pid>" },
{"term_bgapp", term_bgapp_pid_test, "aul_terminate_bgapp_pid test",
"[usage] term_bgapp <pid>" },
- {"dbuslaunch", dbus_launch_test,"launch by dbus auto activation",
+ {"dbuslaunch", dbus_launch_test, "launch by dbus auto activation",
"[usage] term_pid <pid>" },
- {"all",all_test,"test based on predefine scenario",
+ {"all", all_test, "test based on predefine scenario",
"[usage] all <pkgname>"},
-
- {"is_run", is_run_test,"aul_is_running test",
+ {"is_run", is_run_test, "aul_is_running test",
"[usage] is_run <pkgname>"},
{"getallpkg", get_allpkg_test, "aul_app_get_running_app_info test",
"[usage] getallpkg all"},
"[usage] get_app_bypid <pid>"},
{"get_pkg_bypid", get_pkg_bypid_test, "aul_app_get_pkgid_bypid test",
"[usage] get_pkg_bypid <pid>"},
-
{"open_file", open_file_test, "aul_open_file test",
"[usage] open_file <filename>"},
{"open_content", open_content_test, "aul_open_content test",
"[usage] get_mime_file <filename>"},
{"get_mime_content", get_mime_content_test, "aul_get_mime_from_content",
"[usage] get_mime_content <content>"},
-
{"get_mime_icon", aul_get_mime_icon_test, "aul_get_mime_icon test",
"[usage] get_mime_icon <mimetype>"},
{"get_mime_desc", aul_get_mime_description_test, "aul_get_mime_description test",
"[usage] get_mime_desc <mimetype>"},
{"get_mime_ext", aul_get_mime_extension_test, "aul_get_mime_extension test",
"[usage] get_mime_ext <mimetype>"},
-
{"test_regex", test_regex, "regular expression parser test",
"[usage] test_regex <full text>"},
-
{"getpkg", get_pkg_func, "get package",
- "[usage] getpkg <pkgname>"},
- {"pause", pause_test,"aul_pause_app test",
+ "[usage] getpkg <pkgname>"},
+ {"pause", pause_test, "aul_pause_app test",
"[usage] pause <pkgname>" },
- {"pause_pid", pause_pid_test,"aul_pause_pid test",
+ {"pause_pid", pause_pid_test, "aul_pause_pid test",
"[usage] pause_pid <pid>" },
{"update_list", update_running_list, "update running list",
- "[usage] update_list <appid> <app_path> <pid>"},
+ "[usage] update_list <appid> <app_path> <pid>"},
{"reload", reload_appinfo, "reload appinfo table",
"[usage] reload"},
{"get_status_pid", get_status_pid, "aul_app_get_status_bypid test",
"[usage] get_status_pid <pid>"},
-/*
- {"setpkg", set_pkg_func, "set package",
- "[usage] setpkg <pkgname> <apppath>"},
- {"delpkg", del_pkg_func, "del package",
- "[usage] getpkg <pkgname>"},
-*/
};
int callfunc(char *testname)
/*aul_listen_app_dead_signal(dead_tracker,NULL); */
/*aul_listen_app_dead_signal(NULL,NULL); */
- g_idle_add(run_func,NULL);
+ g_idle_add(run_func, NULL);
mainloop = g_main_loop_new(NULL, FALSE);
if (!mainloop) {
bundle *kb;
int i;
char arg[1024] = {0, };
- char* val_array[128];
+ char *val_array[128];
kb = bundle_create();
for (i = start; i < gargc - 1; i++) {
else {
int j = 1;
strncpy(arg, gargv[i + 1], 1023);
- val_array[0] = strtok(arg,",");
- while(1)
- {
- val_array[j] = strtok(NULL,",");
- if(val_array[j] == NULL)
+ val_array[0] = strtok(arg, ",");
+ while (1) {
+ val_array[j] = strtok(NULL, ",");
+ if (val_array[j] == NULL)
break;
j++;
}
- if(j==1)
+
+ if (j == 1)
bundle_add(kb, gargv[i], gargv[i + 1]);
- else if(j>1)
+ else if (j > 1)
bundle_add_str_array(kb, gargv[i],
(const char**)val_array, j);
}
printf("bundle creation fail\n");
return -1;
}
+
pid = aul_launch_app(gargv[1], kb);
return pid;
}
{
int listen_pid = (intptr_t)data;
- if(listen_pid == pid)
+ if (listen_pid == pid)
g_main_loop_quit(mainloop);
return 0;
printf("... successfully launched\n");
str = bundle_get_val(kb, "__LAUNCH_APP_MODE__");
- if (str && strcmp(str, "SYNC") == 0 )
+ if (str && strcmp(str, "SYNC") == 0)
aul_listen_app_dead_signal(__launch_app_dead_handler, (void *)(intptr_t)pid);
else
g_main_loop_quit(mainloop);
return 0;
}
-