The launchpad_loader_dispose() function is added to dispose the loader iself.
The function sends a disposal request to the launchpad-process-pool.
When the launchpad-process-pool gets the request, it sends SIGKILL signal to
the running loader process.
Change-Id: I93889f3272704d140ce7f1ae86b328fbda384d13
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
return 0;
}
+static int __dispose_loader_handler(request_h request)
+{
+ candidate_process_context_t *cpc;
+
+ cpc = __find_slot_from_pid(request->caller_pid);
+ if (cpc == NULL) {
+ _E("Failed to find slot. pid(%d)", request->caller_pid);
+ __request_send_result(request, -ENOENT);
+ return -1;
+ }
+
+ __dispose_candidate_process(cpc);
+ _W("[PAD_CMD_DISPOSE_LOADER] loader_name(%s), pid(%d)",
+ cpc->loader_name, request->caller_pid);
+ __request_send_result(request, 0);
+ return 0;
+}
+
static request_handler __request_handlers[] = {
[PAD_CMD_VISIBILITY] = __visibility_request_handler,
[PAD_CMD_ADD_LOADER] = __add_loader_request_handler,
[PAD_CMD_UPDATE_APP_TYPE] = __update_app_type_request_handler,
[PAD_CMD_CONNECT] = __connect_request_handler,
[PAD_CMD_LAUNCH] = __launch_request_handler,
+ [PAD_CMD_DISPOSE_LOADER] = __dispose_loader_handler,
};
static bool __handle_launch_event(int fd, io_condition_e cond, void *data)
PAD_CMD_UPDATE_APP_TYPE = 16,
PAD_CMD_PREPARE_APP_DEFINED_LOADER = 17,
PAD_CMD_CONNECT = 18,
+ PAD_CMD_DISPOSE_LOADER = 21,
} pad_cmd_e;
typedef struct _app_pkt_t {
*/
int launchpad_loader_unblock_threads(void);
+/**
+ * @brief Disposes the loader.
+ * @details This function sends a disposal request to the launchpad.
+ * The launchpad will dispose the loader process using kill().
+ * @since_tizen 7.0
+ *
+ * @return @c on success,
+ * otherwise a negative error value
+ * @see launchpad_loader_main();
+ */
+int launchpad_loader_dispose(void);
+
#ifdef __cplusplus
}
#endif
#define AUL_PR_NAME 16
#define SIGRTINT (SIGRTMIN + 2)
+extern int app_send_cmd_to_launchpad(const char *pad_type,
+ uid_t uid, int cmd, bundle *kb);
+
typedef struct thread_handler_s {
struct sigaction old;
GMutex mutex;
return 0;
}
+
+API int launchpad_loader_dispose(void)
+{
+#define PROCESS_POOL_LAUNCHPAD_SOCK ".launchpad-process-pool-sock"
+ bundle *b;
+ int ret;
+
+ b = bundle_create();
+ if (b == NULL) {
+ _E("bundle_create() is failed");
+ return -ENOMEM;
+ }
+
+ ret = app_send_cmd_to_launchpad(PROCESS_POOL_LAUNCHPAD_SOCK, getuid(),
+ PAD_CMD_DISPOSE_LOADER, b);
+ bundle_free(b);
+ if (ret != AUL_R_OK) {
+ _E("Failed to send disposal request. error(%d)", ret);
+ return -ECOMM;
+ }
+
+ _W("Success to send disposal request");
+ return 0;
+}