git/run-command.c

#define USE_THE_REPOSITORY_VARIABLE

#include "git-compat-util.h"
#include "run-command.h"
#include "environment.h"
#include "exec-cmd.h"
#include "gettext.h"
#include "sigchain.h"
#include "strvec.h"
#include "symlinks.h"
#include "thread-utils.h"
#include "strbuf.h"
#include "string-list.h"
#include "trace.h"
#include "trace2.h"
#include "quote.h"
#include "config.h"
#include "packfile.h"
#include "compat/nonblock.h"

void child_process_init(struct child_process *child)
{}

void child_process_clear(struct child_process *child)
{}

struct child_to_clean {};
static struct child_to_clean *children_to_clean;
static int installed_child_cleanup_handler;

static void cleanup_children(int sig, int in_signal)
{}

static void cleanup_children_on_signal(int sig)
{}

static void cleanup_children_on_exit(void)
{}

static void mark_child_for_cleanup(pid_t pid, struct child_process *process)
{}

static void clear_child_for_cleanup(pid_t pid)
{}

static inline void close_pair(int fd[2])
{}

int is_executable(const char *name)
{}

#ifndef locate_in_PATH
/*
 * Search $PATH for a command.  This emulates the path search that
 * execvp would perform, without actually executing the command so it
 * can be used before fork() to prepare to run a command using
 * execve() or after execvp() to diagnose why it failed.
 *
 * The caller should ensure that file contains no directory
 * separators.
 *
 * Returns the path to the command, as found in $PATH or NULL if the
 * command could not be found.  The caller inherits ownership of the memory
 * used to store the resultant path.
 *
 * This should not be used on Windows, where the $PATH search rules
 * are more complicated (e.g., a search for "foo" should find
 * "foo.exe").
 */
static char *locate_in_PATH(const char *file)
{}
#endif

int exists_in_PATH(const char *command)
{}

int sane_execvp(const char *file, char * const argv[])
{}

char *git_shell_path(void)
{}

static const char **prepare_shell_cmd(struct strvec *out, const char **argv)
{}

#ifndef GIT_WINDOWS_NATIVE
static int child_notifier =;

enum child_errcode {};

struct child_err {};

static void child_die(enum child_errcode err)
{}

static void child_dup2(int fd, int to)
{}

static void child_close(int fd)
{}

static void child_close_pair(int fd[2])
{}

static void child_error_fn(const char *err UNUSED, va_list params UNUSED)
{}

static void child_warn_fn(const char *err UNUSED, va_list params UNUSED)
{}

static void NORETURN child_die_fn(const char *err UNUSED, va_list params UNUSED)
{}

/* this runs in the parent process */
static void child_err_spew(struct child_process *cmd, struct child_err *cerr)
{}

static int prepare_cmd(struct strvec *out, const struct child_process *cmd)
{}

static char **prep_childenv(const char *const *deltaenv)
{}

struct atfork_state {};

#define CHECK_BUG(err, msg)

static void atfork_prepare(struct atfork_state *as)
{}

static void atfork_parent(struct atfork_state *as)
{}
#endif /* GIT_WINDOWS_NATIVE */

static inline void set_cloexec(int fd)
{}

static int wait_or_whine(pid_t pid, const char *argv0, int in_signal)
{}

static void trace_add_env(struct strbuf *dst, const char *const *deltaenv)
{}

static void trace_run_command(const struct child_process *cp)
{}

int start_command(struct child_process *cmd)
{}

int finish_command(struct child_process *cmd)
{}

int finish_command_in_signal(struct child_process *cmd)
{}


int run_command(struct child_process *cmd)
{}

#ifndef NO_PTHREADS
static pthread_t main_thread;
static int main_thread_set;
static pthread_key_t async_key;
static pthread_key_t async_die_counter;

static void *run_thread(void *data)
{}

static NORETURN void die_async(const char *err, va_list params)
{}

static int async_die_is_recursing(void)
{}

int in_async(void)
{}

static void NORETURN async_exit(int code)
{}

#else

static struct {
	void (**handlers)(void);
	size_t nr;
	size_t alloc;
} git_atexit_hdlrs;

static int git_atexit_installed;

static void git_atexit_dispatch(void)
{
	size_t i;

	for (i=git_atexit_hdlrs.nr ; i ; i--)
		git_atexit_hdlrs.handlers[i-1]();
}

static void git_atexit_clear(void)
{
	free(git_atexit_hdlrs.handlers);
	memset(&git_atexit_hdlrs, 0, sizeof(git_atexit_hdlrs));
	git_atexit_installed = 0;
}

#undef atexit
int git_atexit(void (*handler)(void))
{
	ALLOC_GROW(git_atexit_hdlrs.handlers, git_atexit_hdlrs.nr + 1, git_atexit_hdlrs.alloc);
	git_atexit_hdlrs.handlers[git_atexit_hdlrs.nr++] = handler;
	if (!git_atexit_installed) {
		if (atexit(&git_atexit_dispatch))
			return -1;
		git_atexit_installed = 1;
	}
	return 0;
}
#define atexit

static int process_is_async;
int in_async(void)
{
	return process_is_async;
}

static void NORETURN async_exit(int code)
{
	exit(code);
}

#endif

void check_pipe(int err)
{}

int start_async(struct async *async)
{}

int finish_async(struct async *async)
{}

int async_with_fork(void)
{}

struct io_pump {};

static int pump_io_round(struct io_pump *slots, int nr, struct pollfd *pfd)
{}

static int pump_io(struct io_pump *slots, int nr)
{}


int pipe_command(struct child_process *cmd,
		 const char *in, size_t in_len,
		 struct strbuf *out, size_t out_hint,
		 struct strbuf *err, size_t err_hint)
{}

enum child_state {};

struct parallel_processes {};

struct parallel_processes_for_signal {};

static void kill_children(const struct parallel_processes *pp,
			  const struct run_process_parallel_opts *opts,
			  int signo)
{}

static void kill_children_signal(const struct parallel_processes_for_signal *pp_sig,
				 int signo)
{}

static struct parallel_processes_for_signal *pp_for_signal;

static void handle_children_on_signal(int signo)
{}

static void pp_init(struct parallel_processes *pp,
		    const struct run_process_parallel_opts *opts,
		    struct parallel_processes_for_signal *pp_sig)
{}

static void pp_cleanup(struct parallel_processes *pp,
		       const struct run_process_parallel_opts *opts)
{}

/* returns
 *  0 if a new task was started.
 *  1 if no new jobs was started (get_next_task ran out of work, non critical
 *    problem with starting a new command)
 * <0 no new job was started, user wishes to shutdown early. Use negative code
 *    to signal the children.
 */
static int pp_start_one(struct parallel_processes *pp,
			const struct run_process_parallel_opts *opts)
{}

static void pp_buffer_stderr(struct parallel_processes *pp,
			     const struct run_process_parallel_opts *opts,
			     int output_timeout)
{}

static void pp_output(const struct parallel_processes *pp)
{}

static int pp_collect_finished(struct parallel_processes *pp,
			       const struct run_process_parallel_opts *opts)
{}

void run_processes_parallel(const struct run_process_parallel_opts *opts)
{}

int prepare_auto_maintenance(int quiet, struct child_process *maint)
{}

int run_auto_maintenance(int quiet)
{}

void prepare_other_repo_env(struct strvec *env, const char *new_git_dir)
{}

enum start_bg_result start_bg_command(struct child_process *cmd,
				      start_bg_wait_cb *wait_cb,
				      void *cb_data,
				      unsigned int timeout_sec)
{}