x86: Tunables may incorrectly set Prefer_PMINUB_for_stringop (bug 32047)
[glibc.git] / support / subprocess.h
blob8274a2b22bb10296ac9672aa7648de5c7d88ce56
1 /* Create a subprocess.
2 Copyright (C) 2019-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <https://www.gnu.org/licenses/>. */
19 #ifndef SUPPORT_SUBPROCESS_H
20 #define SUPPORT_SUBPROCESS_H
22 #include <sys/types.h>
24 struct support_subprocess
26 int stdout_pipe[2];
27 int stderr_pipe[2];
28 pid_t pid;
31 /* Invoke CALLBACK (CLOSURE) in a subprocess created with fork and return
32 its PID, a pipe redirected to STDOUT, and a pipe redirected to STDERR. */
33 struct support_subprocess support_subprocess
34 (void (*callback) (void *), void *closure);
36 /* Issue FILE with ARGV arguments and ENVP environments by using posix_spawn
37 and return is PID, a pipe redirected to STDOUT, and a pipe redirected to
38 STDERR. If ENVP is NULL the current environment variable is used. */
39 struct support_subprocess support_subprogram
40 (const char *file, char *const argv[], char *const envp[]);
42 /* Invoke program FILE with ARGV arguments by using posix_spawn and wait for it
43 to complete. Return program exit status. */
44 int support_subprogram_wait
45 (const char *file, char *const argv[]);
47 /* Wait for the subprocess indicated by PROC::PID. Return the status
48 indicate by waitpid call. */
49 int support_process_wait (struct support_subprocess *proc);
51 /* Terminate the subprocess indicated by PROC::PID, first with a SIGTERM and
52 then with a SIGKILL. Return the status as for waitpid call. */
53 int support_process_terminate (struct support_subprocess *proc);
55 #endif