1 /* CC0 license (public domain) - see LICENSE file for details */
10 * pipecmd - run a command, optionally connect pipes.
11 * @infd: input fd to write to child (if non-NULL)
12 * @outfd: output fd to read from child (if non-NULL)
13 * @errfd: error-output fd to read from child (if non-NULL)
14 * @cmd...: NULL-terminate list of command and arguments.
16 * If @infd is NULL, the child's input is (read-only) /dev/null.
17 * If @outfd is NULL, the child's output is (write-only) /dev/null.
18 * If @errfd is NULL, the child's stderr is (write-only) /dev/null.
20 * If @errfd == @outfd (and non-NULL) they will be shared.
21 * If @infd, @outfd or @errfd is &pipecmd_preserve, it is unchanged.
23 * The return value is the pid of the child, or -1. All other file-descriptors
24 * are closed in the child.
26 pid_t pipecmd(int *infd, int *outfd, int *errfd, const char *cmd, ...);
29 * pipecmdv - run a command, optionally connect pipes (stdarg version)
30 * @infd: input fd to write to child (if non-NULL)
31 * @outfd: output fd to read from child (if non-NULL)
32 * @errfd: error-output fd to read from child (if non-NULL)
33 * @cmd: command to run.
34 * @ap: argument list for arguments.
36 pid_t pipecmdv(int *infd, int *outfd, int *errfd, const char *cmd, va_list ap);
39 * pipecmdarr - run a command, optionally connect pipes (char arry version)
40 * @infd: input fd to write to child (if non-NULL)
41 * @outfd: output fd to read from child (if non-NULL)
42 * @errfd: error-output fd to read from child (if non-NULL)
43 * @arr: NULL-terminated array for arguments (first is program to run).
45 pid_t pipecmdarr(int *infd, int *outfd, int *errfd, char *const *arr);
48 * pipecmd_preserve - special value for fds to indicate it is unchanged
50 extern int pipecmd_preserve;
52 #endif /* CCAN_PIPECMD_H */