[go: up one dir, main page]

File: dpopen.h

package info (click to toggle)
cctools 1%3A7.15.9-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 40,008 kB
  • sloc: ansic: 117,215; python: 30,569; cpp: 20,301; sh: 13,834; perl: 4,056; xml: 3,688; makefile: 1,502
file content (36 lines) | stat: -rw-r--r-- 1,452 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
Copyright (C) 2022 The University of Notre Dame
This software is distributed under the GNU General Public License.
See the file COPYING for details.
*/

#ifndef DPOPEN_H
#define DPOPEN_H

#include <unistd.h>
#include <stdio.h>

/** @file dpopen.h Double Pipe process invocation. */

/** Fast process invocation.
@ref fast_popen opens a process for execution, providing its output
on a stream, just like the standard <tt>popen</tt>.  However, @ref fast_popen
does not invoke the shell to interpret the command, which can be very
time consuming.  Thus, the command must be given as a full path, and may
not include quotes, variables, or other features of the shell.
(Note: there is no pipe close, we rely on SIGPIPE to kill the child.)@param command The command string to execute.
@param in A pointer to a standard I/O stream, which this function will attach to the standard input of the process.
@param out A pointer to a standard I/O stream, which this function will attach to the standard input of the child process.
@return The process ID of the newly created process.
*/
pid_t dpopen(const char *command, FILE ** in, FILE ** out);

/** Conclude a fast process stream.
@param in The standard input stream returned from @ref dpopen.
@param out The standard input stream returned from @ref dpopen.
@param pid The process ID returned from @ref dpopen.
@return The exit status of the process.
*/
int dpclose(FILE * in, FILE * out, pid_t pid);

#endif