Blame support/subprocess.h

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