From 91551d2f5a7ff42f4e179952c09f713856e42e04 Mon Sep 17 00:00:00 2001 From: "C. Guy Yarvin" Date: Mon, 14 Oct 2013 11:23:55 -0700 Subject: [PATCH] Changes for libuv bug reproduce. --- include/v/vere.h | 7 ++++--- v/save.c | 15 +++++++++++++++ v/unix.c | 6 +++++- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/include/v/vere.h b/include/v/vere.h index 6cdb7f0034..33f6d4cb40 100644 --- a/include/v/vere.h +++ b/include/v/vere.h @@ -168,9 +168,10 @@ /* u2_save: checkpoint control. */ typedef struct _u2_save { - uv_timer_t tim_u; // checkpoint timer - c3_w ent_w; // event number, XX 64 - c3_w pid_w; // pid of checkpoint process + uv_timer_t tim_u; // checkpoint timer + uv_signal_t sil_u; // child signal + c3_w ent_w; // event number, XX 64 + c3_w pid_w; // pid of checkpoint process } u2_save; /* u2_ubuf: unix tty i/o buffer. diff --git a/v/save.c b/v/save.c index f32385a1af..2fd92722bb 100644 --- a/v/save.c +++ b/v/save.c @@ -17,6 +17,19 @@ #include "all.h" #include "v/vere.h" +/* _save_sign_cb: signal callback. +*/ +static void +_save_sign_cb(uv_signal_t* sil_u, c3_i num_i) +{ + uL(fprintf(uH, "save: signal %d\n", num_i)); + { + switch ( num_i ) { + case SIGCHLD: u2_save_ef_chld(); break; + } + } +} + /* _save_time_cb(): timer callback. */ static void @@ -90,6 +103,8 @@ u2_save_io_init(void) uv_timer_init(u2L, &sav_u->tim_u); uv_timer_start(&sav_u->tim_u, _save_time_cb, 5000, 5000); + + uv_signal_start(&sav_u->sil_u, _save_sign_cb, SIGCHLD); } /* u2_save_io_exit(): terminate save I/O. diff --git a/v/unix.c b/v/unix.c index bcd324f3fc..44687c3756 100644 --- a/v/unix.c +++ b/v/unix.c @@ -1189,13 +1189,15 @@ _unix_sign_cb(uv_signal_t* sil_u, c3_i num_i) u2_lo_open(); { switch ( num_i ) { + default: fprintf(stderr, "\r\nmysterious signal %d\r\n", num_i); break; + case SIGTERM: fprintf(stderr, "\r\ncaught signal %d\r\n", num_i); u2_Host.liv = u2_no; break; case SIGINT: u2_term_ef_ctlc(); break; case SIGWINCH: u2_term_ef_winc(); break; - case SIGCHLD: u2_save_ef_chld(); break; + // case SIGCHLD: u2_save_ef_chld(); break; } } u2_lo_shut(u2_yes); @@ -1268,6 +1270,7 @@ u2_unix_io_init(void) sig_u->nex_u = unx_u->sig_u; unx_u->sig_u = sig_u; } +#if 0 { u2_usig* sig_u; @@ -1278,6 +1281,7 @@ u2_unix_io_init(void) sig_u->nex_u = unx_u->sig_u; unx_u->sig_u = sig_u; } +#endif u2_unix_ef_move(); }