From: Hwankyu Jhun Date: Mon, 18 Jan 2016 10:30:32 +0000 (+0900) Subject: Add option on app_pkt_t type X-Git-Tag: submit/tizen/20160119.012430^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8966ff9ce9bd6e5e94662b05b7853b7fc5d0fd83;p=platform%2Fcore%2Fappfw%2Fdebug-launchpad.git Add option on app_pkt_t type - remove unused function Change-Id: If7326aa3cac98016b451202b5aee2a5a4c60e8ff Signed-off-by: Hwankyu Jhun --- diff --git a/include/common.h b/include/common.h index de44eab..cff6fa6 100644 --- a/include/common.h +++ b/include/common.h @@ -43,6 +43,7 @@ typedef struct _app_pkt_t { int cmd; int len; + int opt; unsigned char data[1]; } app_pkt_t; @@ -61,7 +62,6 @@ struct ucred; int _create_server_sock(void); app_pkt_t *_recv_pkt_raw(int fd, int *clifd, struct ucred *cr); -int _send_pkt_raw(int client_fd, app_pkt_t *pkt); appinfo_t *_appinfo_create(bundle *kb); void _appinfo_free(appinfo_t *appinfo); diff --git a/src/common.c b/src/common.c index a84ac6a..5cb31e1 100644 --- a/src/common.c +++ b/src/common.c @@ -51,7 +51,7 @@ #define MAX_CMD_BUFSZ 1024 #define PATH_TMP "/tmp" #define PATH_DATA "/data" -#define AUL_PKT_HEADER_SIZE (sizeof(int) + sizeof(int)) +#define AUL_PKT_HEADER_SIZE (sizeof(int) + sizeof(int) + sizeof(int)) static void __set_sock_option(int fd, int cli) { @@ -162,6 +162,7 @@ app_pkt_t *_recv_pkt_raw(int fd, int *clifd, struct ucred *cr) unsigned char buf[AUL_SOCK_MAXBUFF]; int cmd; int datalen; + int opt; sun_size = sizeof(struct sockaddr_un); @@ -195,6 +196,7 @@ retry_recv: } memcpy(&cmd, buf, sizeof(int)); memcpy(&datalen, buf + sizeof(int), sizeof(int)); + memcpy(&opt, buf + sizeof(int) + sizeof(int), sizeof(int)); /* allocate for a null byte */ pkt = (app_pkt_t *)calloc(1, AUL_PKT_HEADER_SIZE + datalen + 1); @@ -204,6 +206,7 @@ retry_recv: } pkt->cmd = cmd; pkt->len = datalen; + pkt->opt = opt; len = 0; while (len != pkt->len) { @@ -221,32 +224,6 @@ retry_recv: return pkt; } -int _send_pkt_raw(int client_fd, app_pkt_t *pkt) -{ - int send_ret = 0; - int pkt_size = 0; - - if (client_fd == -1 || pkt == NULL) { - _E("arguments error!"); - return -1; - } - - pkt_size = sizeof(pkt->cmd) + sizeof(pkt->len) + pkt->len; - - send_ret = send(client_fd, pkt, pkt_size, 0); - _D("send(%d) : %d / %d", client_fd, send_ret, pkt_size); - - if (send_ret == -1) { - _E("send error!"); - return -1; - } else if (send_ret != pkt_size) { - _E("send byte fail!"); - return -1; - } - - return 0; -} - static char *__appinfo_get_app_path(appinfo_t *appinfo) { int i = 0;