return ret;
}
+static int __cmd_fast_start_init(struct launch_arg *arg)
+{
+ char buf[PATH_MAX];
+ int retry_count = 0;
+
+ if (__set_appinfo_for_launchpad(arg->b, arg->appid, arg->uid) < 0) {
+ fprintf(stderr, "Failed to set appinfo. appid(%s), uid(%u)\n",
+ arg->appid, arg->uid);
+ return -1;
+ }
+
+ snprintf(buf, sizeof(buf), "/run/aul/daemons/%u/%s",
+ arg->uid, LAUNCHPAD_PROCESS_POOL_SOCK);
+ while (access(buf, F_OK) != 0) {
+ usleep(100 * 1000);
+ if (++retry_count > 100) {
+ fprintf(stderr, "%s is not created\n", buf);
+ break;
+ }
+ }
+
+ return 0;
+}
+
static int __cmd_fast_start_run(struct launch_arg *arg)
{
int fd;
if (!access(PATH_AMD_READY, F_OK))
return __cmd_start_run(arg);
- if (__set_appinfo_for_launchpad(arg->b, arg->appid, arg->uid) < 0) {
- printf("Failed to set appinfo\n");
- return -1;
- }
-
fd = aul_sock_create_launchpad_client_without_timeout(
LAUNCHPAD_PROCESS_POOL_SOCK, arg->uid);
if (fd < 0) {
- printf("Failed to create client socket. error: %d\n", fd);
+ fprintf(stderr, "Failed to create client socket. error: %d\n",
+ fd);
return -1;
}
arg->pid = aul_sock_send_bundle_with_fd(fd, 0, arg->b, AUL_SOCK_NONE);
if (arg->pid <= 0) {
- printf("... launch failed\n");
+ fprintf(stderr, "... launch failed\n");
return -1;
}
},
[CMD_FAST_START] = {
.name = "fast-start",
- .init = NULL,
+ .init = __cmd_fast_start_init,
.run = __cmd_fast_start_run,
.finish = __cmd_fast_start_finish
},