git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v3 7/8] sub-process: move sub-process functions into separate files

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 29, 2017, 20:43 UTC
Message-ID
<xmqqmvc3ak6b.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170329155330.12860-8-benpeart@microsoft.com>
Ben Peart <peartben@gmail.com> writes:
Show 32 quoted lines
> +Types
> +-----
> +
> +'int(*subprocess_start_fn)(struct subprocess_entry *entry)'::
> +
> +	User-supplied function to initialize the sub-process.  This is
> +	typically used to negoiate the interface version and capabilities.
> +
> +
> +Functions
> +---------
> +
> +`subprocess_start`::
> +
> +	Start a subprocess and add it to the subprocess hashmap.
> +
> +`subprocess_stop`::
> +
> +	Kill a subprocess and remove it from the subprocess hashmap.
> +
> +`subprocess_find_entry`::
> +
> +	Find a subprocess in the subprocess hashmap.
> +
> +`subprocess_get_child_process`::
> +
> +	Get the underlying `struct child_process` from a subprocess.
> +
> +`subprocess_read_status`::
> +
> +	Helper function to read packets looking for the last "status=<foo>"
> +	key/value pair.
OK.
Show 15 quoted lines
> diff --git a/sub-process.c b/sub-process.c
> new file mode 100644
> index 0000000000..2c4d27c193
> --- /dev/null
> +++ b/sub-process.c
> @@ -0,0 +1,116 @@
> +/*
> + * Generic implementation of background process infrastructure.
> + */
> +#include "sub-process.h"
> +#include "sigchain.h"
> +#include "pkt-line.h"
> + ...
> +void subprocess_exit_handler(struct child_process *process)
> +{

This is not only undocumented in the above, but it does not seem to be necessary to be a public function. The only thing that uses this is subprocess_start(), which is in this file. Perhaps make it static?

Previous: Ben PeartNext: Ben Peart
Message 7 of 13 in “refactor the filter process code into a reusable module”
  1. 0/8 refactor the filter process code into a reusable moduleBen Peart, Mar 29, 2017
  2. 2/8 convert: Update convert to use new packet_writel() functionBen Peart, Mar 29, 2017
  3. 1/8 pkt-line: add packet_writel() and packet_read_line_gently()Ben Peart, Mar 29, 2017
  4. 3/8 convert: Split start_multi_file_filter into two separate functionsBen Peart, Mar 29, 2017
  5. 6/8 convert: rename reusable sub-process functionsBen Peart, Mar 29, 2017
  6. 7/8 sub-process: move sub-process functions into separate filesBen Peart, Mar 29, 2017
  7. Junio C HamanoMar 29, 2017
  8. Ben PeartMar 30, 2017
  9. 8/8 convert: Update subprocess_read_status to not die on EOFBen Peart, Mar 29, 2017
  10. 4/8 convert: Separate generic structures and variables from the filter specific onesBen Peart, Mar 29, 2017
  11. 5/8 convert: Update generic functions to only use generic data structuresBen Peart, Mar 29, 2017
  12. Junio C HamanoMar 29, 2017
  13. Ben PeartMar 30, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.