mirror of
https://github.com/git/git.git
synced 2025-12-12 20:36:24 +01:00
trace2: add trace2_child_ready() to report on background children
Create "child_ready" event to capture the state of a child process created in the background. When a child command is started a "child_start" event is generated in the Trace2 log. For normal synchronous children, a "child_exit" event is later generated when the child exits or is terminated. The two events include information, such as the "child_id" and "pid", to allow post analysis to match-up the command line and exit status. When a child is started in the background (and may outlive the parent process), it is not possible for the parent to emit a "child_exit" event. Create a new "child_ready" event to indicate whether the child was successfully started. Also include the "child_id" and "pid" to allow similar post processing. This will be used in a later commit with the new "start_bg_command()". Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
committed by
Junio C Hamano
parent
4c719308ce
commit
64bc75244b
25
trace2.h
25
trace2.h
@@ -253,6 +253,31 @@ void trace2_child_exit_fl(const char *file, int line, struct child_process *cmd,
|
||||
#define trace2_child_exit(cmd, code) \
|
||||
trace2_child_exit_fl(__FILE__, __LINE__, (cmd), (code))
|
||||
|
||||
/**
|
||||
* Emits a "child_ready" message containing the "child-id" and a flag
|
||||
* indicating whether the child was considered "ready" when we
|
||||
* released it.
|
||||
*
|
||||
* This function should be called after starting a daemon process in
|
||||
* the background (and after giving it sufficient time to boot
|
||||
* up) to indicate that we no longer control or own it.
|
||||
*
|
||||
* The "ready" argument should contain one of { "ready", "timeout",
|
||||
* "error" } to indicate the state of the running daemon when we
|
||||
* released it.
|
||||
*
|
||||
* If the daemon process fails to start or it exits or is terminated
|
||||
* while we are still waiting for it, the caller should emit a
|
||||
* regular "child_exit" to report the normal process exit information.
|
||||
*
|
||||
*/
|
||||
void trace2_child_ready_fl(const char *file, int line,
|
||||
struct child_process *cmd,
|
||||
const char *ready);
|
||||
|
||||
#define trace2_child_ready(cmd, ready) \
|
||||
trace2_child_ready_fl(__FILE__, __LINE__, (cmd), (ready))
|
||||
|
||||
/**
|
||||
* Emit an 'exec' event prior to calling one of exec(), execv(),
|
||||
* execvp(), and etc. On Unix-derived systems, this will be the
|
||||
|
||||
Reference in New Issue
Block a user