/***************************************************************************
* CVSID: $Id$
*
* runner.c - Process running code
*
* Copyright (C) 2006 Sjoerd Simons, <sjoerd@luon.net>
*
* Licensed under the Academic Free License version 2.1
*
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
**************************************************************************/
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <signal.h>
#include <string.h>
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus-glib-lowlevel.h>
#include <glib.h>
#include "utils.h"
#include "runner.h"
/* Successful run of the program */
/* Process was killed because of running too long */
/* Failed to start for some reason */
/* Killed on purpose, e.g. hal_util_kill_device_helpers */
typedef struct {
run_request *r;
} run_data;
static void
{
return;
del_run_request(rd->r);
}
new_run_request(void)
{
return result;
}
void
{
if (r == NULL)
return;
free_string_array(r->argv);
g_free(r);
}
static void
send_reply(DBusConnection *con, DBusMessage *msg, guint32 exit_type, gint32 return_code, gchar **error)
{
int i;
return;
}
}
static void
{
/* Remove to the hashtable */
/* The hash table will take care to not leak the dupped string */
}
static void
{
/* We send it a kill, so ignore */
return;
}
/* Check if it was a normal exit */
/* No not normal termination ? crash ? */
goto out;
}
/* normal exit */
/* Need to read stderr */
}
out:
/* emit a signal that this PID exited */
"org.freedesktop.HalRunner",
"StartedProcessExited");
}
}
static gboolean
/* Time is up, kill the process, send reply that it was killed!
* Don't wait for exit, because it could hang in state D
*/
/* Ensure the timeout is not removed in the delete */
/* So the exit watch will know it's killed in case it runs*/
return FALSE;
}
static gboolean
{
/* Search for the program in the dirs where it's allowed to be */
char *program;
return FALSE;
/* first search $PATH to make e.g. run-hald.sh work */
return FALSE;
else {
/* Replace program in argv[0] with the full path */
}
return TRUE;
}
/* Run the given request and reply it's result on msg */
{
r->error_on_stderr);
}
if (r->error_on_stderr) {
}
if (program_exists) {
}
if (!program_exists ||
del_run_request(r);
return FALSE;
}
if (r->input) {
}
rd->r = r;
/* Add watch for exit of the program */
/* Add timeout if needed */
if (r->timeout > 0)
else
/* Add to the hashtable */
/* The hash table will take care to not leak the dupped string */
/* send back PID if requested.. and only emit StartedProcessExited in this case */
}
return TRUE;
}
static void
{
/* Remove the timeout watch */
}
/* So the exit watch will know it's killed in case it runs */
}
static void
{
}
/* Kill all running request for a udi */
void
{
}
static gboolean
return TRUE;
}
/* Kill all running request*/
void
{
}
void
run_init()
{
}