From b1d90cf796bb662e8e51ad86047194d512585c53 Mon Sep 17 00:00:00 2001 From: Gao feng Date: Sat, 15 Oct 2016 12:10:22 +0800 Subject: [PATCH] fix incorrect logs Signed-off-by: Gao feng --- src/exec.c | 9 ++++++--- src/init.c | 7 ++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/exec.c b/src/exec.c index 40e13dd..ab7a68b 100644 --- a/src/exec.c +++ b/src/exec.c @@ -435,9 +435,8 @@ static int hyper_setup_stdio_events(struct hyper_exec *exec, struct stdio_config } } - fprintf(stdout, "hyper_init_event container pts event %p, ops %p, fd %d\n", - &exec->stdinev, &in_ops, exec->stdinev.fd); - + fprintf(stdout, "hyper_init_event exec stdin event %p, ops %p, fd %d\n", + &exec->stdinev, &in_ops, io->stdinevfd); exec->stdinev.fd = io->stdinevfd; if (hyper_init_event(&exec->stdinev, &in_ops, NULL) < 0 || hyper_add_event(ctl.efd, &exec->stdinev, EPOLLOUT) < 0) { @@ -446,6 +445,8 @@ static int hyper_setup_stdio_events(struct hyper_exec *exec, struct stdio_config } exec->ref++; + fprintf(stdout, "hyper_init_event exec stdout event %p, ops %p, fd %d\n", + &exec->stdoutev, &out_ops, io->stdoutevfd); exec->stdoutev.fd = io->stdoutevfd; if (hyper_init_event(&exec->stdoutev, &out_ops, NULL) < 0 || hyper_add_event(ctl.efd, &exec->stdoutev, EPOLLIN) < 0) { @@ -454,6 +455,8 @@ static int hyper_setup_stdio_events(struct hyper_exec *exec, struct stdio_config } exec->ref++; + fprintf(stdout, "hyper_init_event exec stderr event %p, ops %p, fd %d\n", + &exec->stderrev, &err_ops, io->stderrevfd); exec->stderrev.fd = io->stderrevfd; if (hyper_init_event(&exec->stderrev, &err_ops, NULL) < 0 || hyper_add_event(ctl.efd, &exec->stderrev, EPOLLIN) < 0) { diff --git a/src/init.c b/src/init.c index a14ca31..f366d3a 100644 --- a/src/init.c +++ b/src/init.c @@ -905,7 +905,7 @@ static int hyper_ttyfd_handle(struct hyper_event *de, uint32_t len) seq = hyper_get_be64(rbuf->data); - dprintf(stdout, "\n%s seq %" PRIu64", len %" PRIu32"\n", __func__, seq, len - 12); + fprintf(stdout, "\n%s seq %" PRIu64", len %" PRIu32"\n", __func__, seq, len - 12); exec = hyper_find_exec_by_seq(pod, seq); if (exec == NULL) { @@ -928,8 +928,8 @@ static int hyper_ttyfd_handle(struct hyper_event *de, uint32_t len) return 0; } - dprintf(stdout, "find exec %s pid %d, seq is %" PRIu64 "\n", - exec->id ? exec->id : "pod", exec->pid, exec->seq); + fprintf(stdout, "find exec %s pid %d, seq is %" PRIu64 "\n", + exec->container_id ? exec->container_id : "pod", exec->pid, exec->seq); // if exec is exited, the event fd of exec is invalid. don't accept any input. if (exec->exit || exec->close_stdin_request) { fprintf(stdout, "exec seq %" PRIu64 " exited, don't accept any input\n", exec->seq); @@ -940,6 +940,7 @@ static int hyper_ttyfd_handle(struct hyper_event *de, uint32_t len) /* size == 0 means we had received eof */ if (size == 0 && !exec->tty) { exec->close_stdin_request = 1; + fprintf(stdout, "get close stdin request\n"); /* we can't hup the stdinev here, force hup on next write */ if (hyper_modify_event(ctl.efd, &exec->stdinev, EPOLLOUT) < 0) { fprintf(stderr, "modify exec pts event to in & out failed\n");