Skip to content

Commit

Permalink
patch SIGKILL for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
boazsegev committed Feb 2, 2025
1 parent fb9316d commit b1e72db
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fio-stl.h
Original file line number Diff line number Diff line change
Expand Up @@ -4760,6 +4760,11 @@ Patches for Windows


***************************************************************************** */
#ifndef SIGKILL
#ifdef SIGABRT
#define SIGKILL SIGABRT
#endif
#endif
#if FIO_OS_WIN

/* *****************************************************************************
Expand Down Expand Up @@ -36945,13 +36950,16 @@ The IO Reactor Cycle (the actual work)
static void fio___io_signal_crash(int sig, void *flg) {
FIO_LOG_FATAL("(%d) additional stop signal(!) - should crash.", FIO___IO.pid);
fio_signal_forget(sig);

#ifdef SIGKILL
/* cannot lock, signal may be received during critical section */
FIO_LIST_EACH(fio___io_pid_s, node, &FIO___IO.pids, pos) {
if (!pos->done)
fio_thread_kill(pos->pid, SIGKILL);
}
fio_thread_kill(FIO___IO.root_pid, SIGKILL);
fio_thread_kill(FIO___IO.pid, SIGKILL);
#endif
exit(-1);
(void)sig, (void)flg;
}
Expand Down
5 changes: 5 additions & 0 deletions fio-stl/001 patches.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ Patches for Windows
***************************************************************************** */
#ifndef SIGKILL
#ifdef SIGABRT
#define SIGKILL SIGABRT
#endif
#endif
#if FIO_OS_WIN

/* *****************************************************************************
Expand Down
3 changes: 3 additions & 0 deletions fio-stl/402 io reactor.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ The IO Reactor Cycle (the actual work)
static void fio___io_signal_crash(int sig, void *flg) {
FIO_LOG_FATAL("(%d) additional stop signal(!) - should crash.", FIO___IO.pid);
fio_signal_forget(sig);

#ifdef SIGKILL
/* cannot lock, signal may be received during critical section */
FIO_LIST_EACH(fio___io_pid_s, node, &FIO___IO.pids, pos) {
if (!pos->done)
fio_thread_kill(pos->pid, SIGKILL);
}
fio_thread_kill(FIO___IO.root_pid, SIGKILL);
fio_thread_kill(FIO___IO.pid, SIGKILL);
#endif
exit(-1);
(void)sig, (void)flg;
}
Expand Down

0 comments on commit b1e72db

Please sign in to comment.