The Assimilation Project  based on Assimilation version 1.1.7.1474836767
childprocess.c File Reference

Implements the ChildProcess c-class for creating and tracking child processes. More...

#include <projectcommon.h>
#include <string.h>
#include <glib.h>
#include <gmainfd.h>
#include <logsourcefd.h>
#include <childprocess.h>
#include <misc.h>
#include <sys/wait.h>
Include dependency graph for childprocess.c:

Go to the source code of this file.

Macros

#define CHILDSTATE_RUNNING   0
 

Functions

FSTATIC void _childprocess_setup_child (gpointer childprocess_object)
 Function to perform setup for child between fork and exec (for UNIX-like systems) It doesn't get called under Windows. More...
 
FSTATIC gboolean _childprocess_timeout (gpointer childprocess_object)
 Function to handle child timeouts. More...
 
FSTATIC void _childprocess_childexit (GPid pid, gint status, gpointer childprocess_object)
 Function called when the child (finally) exits... More...
 
FSTATIC void _childprocess_finalize (AssimObj *aself)
 Routine to free/destroy/finalize our ChildProcess objects. More...
 
FSTATIC gchar * _childprocess_toString (gconstpointer)
 
WINEXPORT ChildProcesschildprocess_new (gsize cpsize, char **argv, const char **envp, ConfigContext *envmod, const char *curdir, void(*notify)(ChildProcess *, enum HowDied, int rc, int signal, gboolean core_dumped), gboolean save_stdout, const char *logdomain, const char *logprefix, GLogLevelFlags loglevel, guint32 timeout_seconds, gpointer user_data, enum ChildErrLogMode logmode, const char *logname)
 ChildProcess class. constructor. More...
 

Detailed Description

Implements the ChildProcess c-class for creating and tracking child processes.

forks off child processes, checking their return code, logging their standard error and timing them to make sure they don't take too long. If they take too long, they are killed. These child processes are also spawned as independent process groups so that if they fork children that we can easily kill their child processes as well.

Author
Alan Robertson alanr.nosp@m.@uni.nosp@m.x.sh - Copyright © 2013 - Assimilation Systems Limited
This file is part of the Assimilation Project. The Assimilation software is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

The Assimilation software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with the Assimilation Project software. If not, see http://www.gnu.org/licenses/

Definition in file childprocess.c.

Variable Documentation

int next_timeout

Definition at line 239 of file childprocess.c.

int signal

Definition at line 238 of file childprocess.c.

Referenced by _childprocess_childexit(), main(), and rmpid_and_exit_on_signal().