x86-64: Add vector log2/log2f to libmvec microbenchmark
[glibc.git] / support / subprocess.h
blob55602f462f50ae8270445b0d5dc276d21f3a7c48
1 /* Create a subprocess.
2 Copyright (C) 2019-2022 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 by using posix_spawn and return is PID, a
37 pipe redirected to STDOUT, and a pipe redirected to STDERR. */
38 struct support_subprocess support_subprogram
39 (const char *file, char *const argv[]);
41 /* Invoke program FILE with ARGV arguments by using posix_spawn and wait for it
42 to complete. Return program exit status. */
43 int support_subprogram_wait
44 (const char *file, char *const argv[]);
46 /* Wait for the subprocess indicated by PROC::PID. Return the status
47 indicate by waitpid call. */
48 int support_process_wait (struct support_subprocess *proc);
50 /* Terminate the subprocess indicated by PROC::PID, first with a SIGTERM and
51 then with a SIGKILL. Return the status as for waitpid call. */
52 int support_process_terminate (struct support_subprocess *proc);
54 #endif