From 0c115a4bc9f0a2d0e69e7e0080ae6faa8c207da6 Mon Sep 17 00:00:00 2001 From: Bo Date: Tue, 4 Feb 2025 04:01:41 +0200 Subject: [PATCH] fix dependency in state logging + fix child double signaling. --- fio-stl.h | 5 +++-- fio-stl/004 state callbacks.h | 2 +- fio-stl/402 io reactor.h | 3 ++- tests/url.c | 7 +++++++ 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/fio-stl.h b/fio-stl.h index be4fa032..da9bd9a9 100644 --- a/fio-stl.h +++ b/fio-stl.h @@ -11705,7 +11705,7 @@ SFUNC void fio_state_callback_force(fio_state_event_type_e e) { } FIO_LOG_DEBUG2("(%d) scheduling %s callbacks (%zu tasks).", - (int)(fio_thread_getpid()), + (int)(fio_getpid()), FIO___STATE_TASKS_NAMES[e], (size_t)FIO___STATE_TASKS_ARRAY[e].count); if (!FIO___STATE_TASKS_ARRAY[e].count) @@ -36969,7 +36969,8 @@ static void fio___io_signal_crash(int sig, void *flg) { static void fio___io_signal_stop(int sig, void *flg) { FIO_LOG_INFO("(%d) stop signal detected.", FIO___IO.pid); fio_io_stop(); - fio_signal_monitor(sig, fio___io_signal_crash, flg, 0); + if (fio_io_is_master()) + fio_signal_monitor(sig, fio___io_signal_crash, flg, 0); (void)sig, (void)flg; } diff --git a/fio-stl/004 state callbacks.h b/fio-stl/004 state callbacks.h index cf7cef88..78cea3de 100644 --- a/fio-stl/004 state callbacks.h +++ b/fio-stl/004 state callbacks.h @@ -257,7 +257,7 @@ SFUNC void fio_state_callback_force(fio_state_event_type_e e) { } FIO_LOG_DEBUG2("(%d) scheduling %s callbacks (%zu tasks).", - (int)(fio_thread_getpid()), + (int)(fio_getpid()), FIO___STATE_TASKS_NAMES[e], (size_t)FIO___STATE_TASKS_ARRAY[e].count); if (!FIO___STATE_TASKS_ARRAY[e].count) diff --git a/fio-stl/402 io reactor.h b/fio-stl/402 io reactor.h index 75ff2765..c46479a6 100644 --- a/fio-stl/402 io reactor.h +++ b/fio-stl/402 io reactor.h @@ -39,7 +39,8 @@ static void fio___io_signal_crash(int sig, void *flg) { static void fio___io_signal_stop(int sig, void *flg) { FIO_LOG_INFO("(%d) stop signal detected.", FIO___IO.pid); fio_io_stop(); - fio_signal_monitor(sig, fio___io_signal_crash, flg, 0); + if (fio_io_is_master()) + fio_signal_monitor(sig, fio___io_signal_crash, flg, 0); (void)sig, (void)flg; } diff --git a/tests/url.c b/tests/url.c index 94b7388b..ade43755 100644 --- a/tests/url.c +++ b/tests/url.c @@ -1,4 +1,5 @@ #define FIO_URL +#define FIO_STR #include "fio-stl.h" int main(int argc, char const *argv[]) { @@ -6,6 +7,7 @@ int main(int argc, char const *argv[]) { (char *)"http://anon:1234@example.com:443/my/path?answer=42#target"; if (argc >= 2) to_parse = (char *)argv[1]; + FIO_STR_INFO_TMP_VAR(path, 1024); fio_url_s u = fio_url_parse(to_parse, strlen(to_parse)); fprintf(stderr, "Parsed URL:\n" @@ -43,5 +45,10 @@ int main(int argc, char const *argv[]) { i.value.buf); } } + if (u.path.len < 1024) { + fio_string_write_url_dec(&path, NULL, u.path.buf, u.path.len); + if (!FIO_STR_INFO_IS_EQ(path, u.path)) + printf("\tdecoded path:\t%s\n", path.buf); + } return 0; }