Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 3747b03

Browse files
authored
Merge pull request #216 from gao-feng/logs
fix incorrect logs
2 parents 0470974 + b1d90cf commit 3747b03

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/exec.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -435,9 +435,8 @@ static int hyper_setup_stdio_events(struct hyper_exec *exec, struct stdio_config
435435
}
436436
}
437437

438-
fprintf(stdout, "hyper_init_event container pts event %p, ops %p, fd %d\n",
439-
&exec->stdinev, &in_ops, exec->stdinev.fd);
440-
438+
fprintf(stdout, "hyper_init_event exec stdin event %p, ops %p, fd %d\n",
439+
&exec->stdinev, &in_ops, io->stdinevfd);
441440
exec->stdinev.fd = io->stdinevfd;
442441
if (hyper_init_event(&exec->stdinev, &in_ops, NULL) < 0 ||
443442
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
446445
}
447446
exec->ref++;
448447

448+
fprintf(stdout, "hyper_init_event exec stdout event %p, ops %p, fd %d\n",
449+
&exec->stdoutev, &out_ops, io->stdoutevfd);
449450
exec->stdoutev.fd = io->stdoutevfd;
450451
if (hyper_init_event(&exec->stdoutev, &out_ops, NULL) < 0 ||
451452
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
454455
}
455456
exec->ref++;
456457

458+
fprintf(stdout, "hyper_init_event exec stderr event %p, ops %p, fd %d\n",
459+
&exec->stderrev, &err_ops, io->stderrevfd);
457460
exec->stderrev.fd = io->stderrevfd;
458461
if (hyper_init_event(&exec->stderrev, &err_ops, NULL) < 0 ||
459462
hyper_add_event(ctl.efd, &exec->stderrev, EPOLLIN) < 0) {

src/init.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,7 @@ static int hyper_ttyfd_handle(struct hyper_event *de, uint32_t len)
905905

906906
seq = hyper_get_be64(rbuf->data);
907907

908-
dprintf(stdout, "\n%s seq %" PRIu64", len %" PRIu32"\n", __func__, seq, len - 12);
908+
fprintf(stdout, "\n%s seq %" PRIu64", len %" PRIu32"\n", __func__, seq, len - 12);
909909

910910
exec = hyper_find_exec_by_seq(pod, seq);
911911
if (exec == NULL) {
@@ -928,8 +928,8 @@ static int hyper_ttyfd_handle(struct hyper_event *de, uint32_t len)
928928
return 0;
929929
}
930930

931-
dprintf(stdout, "find exec %s pid %d, seq is %" PRIu64 "\n",
932-
exec->id ? exec->id : "pod", exec->pid, exec->seq);
931+
fprintf(stdout, "find exec %s pid %d, seq is %" PRIu64 "\n",
932+
exec->container_id ? exec->container_id : "pod", exec->pid, exec->seq);
933933
// if exec is exited, the event fd of exec is invalid. don't accept any input.
934934
if (exec->exit || exec->close_stdin_request) {
935935
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)
940940
/* size == 0 means we had received eof */
941941
if (size == 0 && !exec->tty) {
942942
exec->close_stdin_request = 1;
943+
fprintf(stdout, "get close stdin request\n");
943944
/* we can't hup the stdinev here, force hup on next write */
944945
if (hyper_modify_event(ctl.efd, &exec->stdinev, EPOLLOUT) < 0) {
945946
fprintf(stderr, "modify exec pts event to in & out failed\n");

0 commit comments

Comments
 (0)