gmerlin
subprocess.h
1 /*****************************************************************
2  * gmerlin - a general purpose multimedia framework and applications
3  *
4  * Copyright (c) 2001 - 2011 Members of the Gmerlin project
5  * gmerlin-general@lists.sourceforge.net
6  * http://gmerlin.sourceforge.net
7  *
8  * This program is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  * *****************************************************************/
21 
32 typedef struct
33  {
34  int stdin_fd;
35  int stdout_fd;
36  int stderr_fd;
37 
38  void * priv;
40 
51 bg_subprocess_t * bg_subprocess_create(const char * command, int do_stdin,
52  int do_stdout, int do_stderr);
53 
61 void bg_subprocess_kill(bg_subprocess_t* proc, int signal);
62 
69 
78 int bg_subprocess_read_line(int fd, char ** ret, int * ret_alloc,
79  int timeout);
80 
91 int bg_subprocess_read_data(int fd, uint8_t * ret, int len);
92 
100 int bg_system(const char * command);
101 
void bg_subprocess_kill(bg_subprocess_t *proc, int signal)
Send a signal to a process.
int bg_subprocess_read_line(int fd, char **ret, int *ret_alloc, int timeout)
Read a line from stdout or stderr of a process.
int bg_system(const char *command)
Run a command as a subprocess.
bg_subprocess_t * bg_subprocess_create(const char *command, int do_stdin, int do_stdout, int do_stderr)
Create a subprocess.
int stdout_fd
Filedescriptor, which is a pipe to the stdout of the process.
Definition: subprocess.h:35
int bg_subprocess_read_data(int fd, uint8_t *ret, int len)
Read data from stdout or stderr of a process.
Subprocess handle.
Definition: subprocess.h:32
int stdin_fd
Filedescriptor, which is a pipe to the stdin of the process.
Definition: subprocess.h:34
int stderr_fd
Filedescriptor, which is a pipe to the stderr of the process.
Definition: subprocess.h:36
void * priv
Internals made opaque.
Definition: subprocess.h:38
int bg_subprocess_close(bg_subprocess_t *proc)
Close a subprocess and free all associated memory.