Thread (9 messages) 9 messages, 3 authors, 2025-07-01
STALE366d

[RFC PATCH 1/2] run-command: add a pipe() write end to childs

From: Carlo Marcelo Arenas Belón <hidden>
Date: 2025-06-26 21:22:54
Subsystem: the rest · Maintainer: Linus Torvalds

Instruct the child to close the read side of a pipe provided by
the parent for notification that would be used in a future patch.

Signed-off-by: Carlo Marcelo Arenas Belón <redacted>
---
 run-command.c | 3 +++
 run-command.h | 2 ++
 2 files changed, 5 insertions(+)
diff --git a/run-command.c b/run-command.c
index 8833b23367..0156d3a01d 100644
--- a/run-command.c
+++ b/run-command.c
@@ -796,6 +796,9 @@ int start_command(struct child_process *cmd)
 		set_error_routine(child_error_fn);
 		set_warn_routine(child_warn_fn);
 
+		if (cmd->parent_ipc_in != -1)
+			close(cmd->parent_ipc_in);
+
 		close(notify_pipe[0]);
 		set_cloexec(notify_pipe[1]);
 		child_notifier = notify_pipe[1];
diff --git a/run-command.h b/run-command.h
index 0df25e445f..d731b400b9 100644
--- a/run-command.h
+++ b/run-command.h
@@ -81,6 +81,7 @@ struct child_process {
 	const char *trace2_child_class;
 	const char *trace2_hook_name;
 
+	int parent_ipc_in;
 	/*
 	 * Using .in, .out, .err:
 	 * - Specify 0 for no redirections. No new file descriptor is allocated.
@@ -147,6 +148,7 @@ struct child_process {
 #define CHILD_PROCESS_INIT { \
 	.args = STRVEC_INIT, \
 	.env = STRVEC_INIT, \
+	.parent_ipc_in = -1, \
 }
 
 /**
-- 
2.39.5 (Apple Git-154)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help