2 * Copyright (c) 2015 - 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef __LAUNCHPAD_COMMON_H__
18 #define __LAUNCHPAD_COMMON_H__
25 #include <bundle_internal.h>
26 #include <sys/socket.h>
31 #define LOG_TAG "LAUNCHPAD"
34 #define SOCKET_PATH "/run/aul"
35 #define LAUNCHPAD_LOADER_SOCKET_NAME ".launchpad-type"
36 #define MAX_PENDING_CONNECTIONS 10
37 #define MAX_LOCAL_BUFSZ 128
38 #define AUL_SOCK_MAXBUFF 131071
39 #define LOADER_ARG_LEN 1024
41 #define PAD_CMD_LAUNCH 0
42 #define PAD_CMD_VISIBILITY 10
43 #define PAD_CMD_ADD_LOADER 11
44 #define PAD_CMD_REMOVE_LOADER 12
45 #define PAD_CMD_MAKE_DEFAULT_SLOTS 13
46 #define PAD_CMD_DEMAND 14
47 #define PAD_CMD_PING 15
49 #define LAUNCHPAD_LAUNCH_SIGNAL 85
50 #define LAUNCHPAD_DEAD_SIGNAL 61
51 #define APP_STARTUP_SIGNAL 89
53 #define PAD_LOADER_ID_STATIC 0
54 #define PAD_LOADER_ID_DIRECT 1
55 #define PAD_LOADER_ID_DYNAMIC_BASE 10
57 #define _E(fmt, arg...) LOGE(fmt, ##arg)
58 #define _D(fmt, arg...) LOGD(fmt, ##arg)
59 #define _W(fmt, arg...) LOGW(fmt, ##arg)
69 typedef struct _app_pkt_t {
73 unsigned char data[1];
79 char *original_app_path;
91 void _modify_bundle(bundle *kb, int caller_pid, appinfo_t *menu_info, int cmd);
93 int _send_cmd_to_amd(int cmd);
94 int _create_server_sock(const char *name);
95 app_pkt_t *_recv_pkt_raw(int fd);
96 app_pkt_t *_accept_recv_pkt_raw(int fd, int *clifd, struct ucred *cr);
97 int _send_pkt_raw(int client_fd, app_pkt_t *pkt);
98 int _connect_to_launchpad(int type, int id);
99 void _set_sock_option(int fd, int cli);
100 void _set_env(appinfo_t *menu_info, bundle *kb);
101 char **_create_argc_argv(bundle *kb, int *margc);
102 char *_get_libdir(const char *path);
103 int _delete_sock_path(int pid, uid_t uid);
105 appinfo_t *_appinfo_create(bundle *kb);
106 void _appinfo_free(appinfo_t *menu_info);
107 char *_appinfo_get_app_path(appinfo_t *menu_info);
108 int _proc_get_attr_by_pid(int pid, char *buf, int size);
109 int _close_all_fds(void);
110 void _get_cpu_idle(unsigned long long *total, unsigned long long *idle);
111 int _setup_stdio(const char *ident);
113 #endif /* __LAUNCHPAD_COMMON_H__ */