Blame support/subprocess.h

Packit Service b31fca
/* Create a subprocess.
Packit Service b31fca
   Copyright (C) 2019 Free Software Foundation, Inc.
Packit Service b31fca
   This file is part of the GNU C Library.
Packit Service b31fca
Packit Service b31fca
   The GNU C Library is free software; you can redistribute it and/or
Packit Service b31fca
   modify it under the terms of the GNU Lesser General Public
Packit Service b31fca
   License as published by the Free Software Foundation; either
Packit Service b31fca
   version 2.1 of the License, or (at your option) any later version.
Packit Service b31fca
Packit Service b31fca
   The GNU C Library is distributed in the hope that it will be useful,
Packit Service b31fca
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Service b31fca
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit Service b31fca
   Lesser General Public License for more details.
Packit Service b31fca
Packit Service b31fca
   You should have received a copy of the GNU Lesser General Public
Packit Service b31fca
   License along with the GNU C Library; if not, see
Packit Service b31fca
   <http://www.gnu.org/licenses/>.  */
Packit Service b31fca
Packit Service b31fca
#ifndef SUPPORT_SUBPROCESS_H
Packit Service b31fca
#define SUPPORT_SUBPROCESS_H
Packit Service b31fca
Packit Service b31fca
#include <sys/types.h>
Packit Service b31fca
Packit Service b31fca
struct support_subprocess
Packit Service b31fca
{
Packit Service b31fca
  int stdout_pipe[2];
Packit Service b31fca
  int stderr_pipe[2];
Packit Service b31fca
  pid_t pid;
Packit Service b31fca
};
Packit Service b31fca
Packit Service b31fca
/* Invoke CALLBACK (CLOSURE) in a subprocess created with fork and return
Packit Service b31fca
   its PID, a pipe redirected to STDOUT, and a pipe redirected to STDERR.  */
Packit Service b31fca
struct support_subprocess support_subprocess
Packit Service b31fca
  (void (*callback) (void *), void *closure);
Packit Service b31fca
Packit Service b31fca
/* Issue FILE with ARGV arguments by using posix_spawn and return is PID, a
Packit Service b31fca
   pipe redirected to STDOUT, and a pipe redirected to STDERR.  */
Packit Service b31fca
struct support_subprocess support_subprogram
Packit Service b31fca
  (const char *file, char *const argv[]);
Packit Service b31fca
Packit Service b31fca
/* Wait for the subprocess indicated by PROC::PID.  Return the status
Packit Service b31fca
   indicate by waitpid call.  */
Packit Service b31fca
int support_process_wait (struct support_subprocess *proc);
Packit Service b31fca
Packit Service b31fca
/* Terminate the subprocess indicated by PROC::PID, first with a SIGTERM and
Packit Service b31fca
   then with a SIGKILL.  Return the status as for waitpid call.  */
Packit Service b31fca
int support_process_terminate (struct support_subprocess *proc);
Packit Service b31fca
Packit Service b31fca
#endif