[PATCH 02/22] Minimal changes to debugfs necessary to exit

Valerie Aurora val at versity.com
Tue Feb 11 13:18:57 PST 2025


The main monitoring thread of debugfs is waiting for a signal, but
when the child exits, it does not send a signal. Use SIGUSR1 to signal
orderly shutdown.

Signed-off-by: Valerie Aurora <val at versity.com>
---
 cli/debugfs.c   | 2 ++
 shared/thread.c | 3 +++
 2 files changed, 5 insertions(+)

diff --git a/cli/debugfs.c b/cli/debugfs.c
index 9f13e99..f59d57c 100644
--- a/cli/debugfs.c
+++ b/cli/debugfs.c
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 
+#include <signal.h>
 #include <unistd.h>
 #include <stdlib.h>
 #include <stdio.h>
@@ -220,6 +221,7 @@ out:
 	free(line);
 	free(line_argv);
 	ctx->ret = ret;
+	kill(0, SIGUSR1);
 }
 
 /*
diff --git a/shared/thread.c b/shared/thread.c
index d04ff24..c5bb25e 100644
--- a/shared/thread.c
+++ b/shared/thread.c
@@ -95,6 +95,9 @@ int thread_sigwait(void)
 			break;
 		}
 
+		if (sig == SIGUSR1)
+			break;
+
 		printf("got signal %u, exiting\n", sig);
 		exit(1);
 	}
-- 
2.48.1




More information about the ngnfs-devel mailing list