1
/* ---------------------------------------------------------------------
2
* Definition of class AsyncProcess async_process.h
4
* Contains various bits and pieces ripped off from all over the
5
* place. No credit to me, all credit to the various authors.
8
* Executes a child program asynchronously (main program won't block
9
* waiting for the child to exit).
11
* The first string in arglist (ie. arglist[0]) is the name of the
12
* program to execute. By default, the name of the program must be a
13
* full path; the PATH shell variable will only be searched if you
14
* pass the SEARCH_PATH flag.
15
* ---------------------------------------------------------------------
16
* This file is part of Valkyrie, a front-end for Valgrind
17
* Copyright (C) 2000-2008, OpenWorks LLP <info@open-works.co.uk>
18
* This program is released under the terms of the GNU GPL v.2
19
* See the file COPYING for the full license details.
22
#ifndef __VK_ASYNC_PROCESS_H
23
#define __VK_ASYNC_PROCESS_H
26
#include <qstringlist.h>
33
LEAVE_FDS_OPEN = 1 << 0,
34
DONT_REAP_CHILD = 1 << 1,
38
AsyncProcess( QStringList arglist, AsyncFlags flags );
39
static bool spawn( QStringList arglist, AsyncFlags flags );
41
int closeAndInvalidate( int* fd );
43
bool makePipe( int p[2] );
44
bool midChild() { return intermediateChild; }
45
bool writeAll( int fd, const void* vbuf, unsigned int to_write );
47
void doExec( int child_err_report_fd );
51
int saneDup2( int fd1, int fd2 );
53
bool readInts( int fd, int* buf, int n_ints_in_buf, int* n_ints_read );
55
void writeErrAndExit( int fd, int msg );
56
void setCloexec( int fd );
57
void scriptExecute( const char* file, char** argv );
59
char* vkStrchrnul( const char* str, char c );
62
enum { CHILD_EXEC_FAILED, CHILD_DUP2_FAILED, CHILD_FORK_FAILED };
65
bool closeDescriptors;
66
bool intermediateChild;