1 /*
2  *
3  * honggfuzz - routines dealing with subprocesses
4  * -----------------------------------------
5  *
6  * Author: Robert Swiecki <swiecki@google.com>
7  *
8  * Copyright 2010-2018 by Google Inc. All Rights Reserved.
9  *
10  * Licensed under the Apache License, Version 2.0 (the "License"); you may
11  * not use this file except in compliance with the License. You may obtain
12  * a copy of the License at
13  *
14  * http://www.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * distributed under the License is distributed on an "AS IS" BASIS,
18  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
19  * implied. See the License for the specific language governing
20  * permissions and limitations under the License.
21  *
22  */
23 
24 #ifndef _HF_SUBPROC_H_
25 #define _HF_SUBPROC_H_
26 
27 #include <pthread.h>
28 
29 #include "honggfuzz.h"
30 
31 /* Missing WIFCONTINUED in Android */
32 #ifndef WIFCONTINUED
33 #define WIFCONTINUED(x) WEXITSTATUS(0)
34 #endif
35 
36 extern const char* subproc_StatusToStr(int status, char* str, size_t len);
37 
38 extern bool subproc_Run(run_t* run);
39 
40 extern bool subproc_persistentModeStateMachine(run_t* run);
41 
42 extern uint8_t subproc_System(run_t* run, const char* const argv[]);
43 
44 extern void subproc_checkTimeLimit(run_t* run);
45 
46 extern void subproc_checkTermination(run_t* run);
47 
48 bool subproc_runThread(honggfuzz_t* hfuzz, pthread_t* thread, void* (*thread_func)(void*));
49 
50 #endif
51