/***************************************************************************
* CVSID: $Id$
*
* main.c - Main dbus interface of the hald runner
*
* Copyright (C) 2006 Sjoerd Simons, <sjoerd@luon.net>
* Copyright (C) 2007 Codethink Ltd. Author Rob Taylor <rob.taylor@codethink.co.uk>
*
* 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 <stdlib.h>
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus-glib-lowlevel.h>
#include <glib.h>
#include "utils.h"
#include "runner.h"
#ifndef __GNUC__
#define __attribute__(x)
#endif
static gboolean
{
char *tmpstr;
/* Should be the device UDI */
goto malformed;
if (!dbus_message_iter_next(iter))
goto malformed;
return TRUE;
return FALSE;
}
static gboolean
{
char *tmpstr;
/* The environment array */
goto malformed;
/* Add default path for the programs we start */
#if defined(__FreeBSD__)
tmpstr = g_strdup_printf("PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/X11R6/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin:%s", getenv("PATH"));
#else
#endif
/* Then argv */
goto malformed;
return TRUE;
return FALSE;
}
static void
{
run_request *r;
char *tmpstr;
r = new_run_request();
goto malformed;
goto malformed;
/* Next a string of what should be written to stdin */
goto malformed;
/* Then an bool to indicate if we should grab stderr */
goto malformed;
/* Then an uint32 timeout for it */
goto malformed;
/* let run_request_run handle the reply */
return;
del_run_request(r);
"Malformed run request");
}
static void
{
run_request *r;
r = new_run_request();
r->is_singleton = is_singleton;
goto malformed;
goto malformed;
}
goto malformed;
}
} else {
"Start request failed");
}
return ;
del_run_request(r);
"Malformed start request");
}
static void
{
char *udi;
dbus_error_init (&error);
"Malformed kill message");
return;
}
/* always successfull */
}
static DBusHandlerResult
{
return DBUS_HANDLER_RESULT_HANDLED;
return DBUS_HANDLER_RESULT_HANDLED;
return DBUS_HANDLER_RESULT_HANDLED;
return DBUS_HANDLER_RESULT_HANDLED;
run_kill_all ();
exit (0);
return DBUS_HANDLER_RESULT_HANDLED;
run_kill_all();
/* alwasy successfull */
return DBUS_HANDLER_RESULT_HANDLED;
}
}
int
{
DBusConnection *c;
char *dbus_address;
run_init();
if (c == NULL)
goto error;
return -1;
}