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?