Blame support/subprocess.h

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