1 /***************************************************************************
5 * hald_runner.h - Interface to the hal runner helper daemon
7 * Copyright (C) 2006 Sjoerd Simons <sjoerd@luon.net>
9 * Licensed under the Academic Free License version 2.1
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 **************************************************************************/
32 /* Successful run of the program */
33 #define HALD_RUN_SUCCESS 0x0
34 /* Process was killed because of running too long */
35 #define HALD_RUN_TIMEOUT 0x1
36 /* Failed to start for some reason */
37 #define HALD_RUN_FAILED 0x2
38 /* Killed on purpose, e.g. hal_runner_kill_device */
39 #define HALD_RUN_KILLED 0x4
41 /* Default sane timeout */
42 #define HAL_HELPER_TIMEOUT 10000
44 typedef void (*HalRunTerminatedCB
) (HalDevice
*d
, guint32 exit_type
,
45 gint return_code
, gchar
**error
,
46 gpointer data1
, gpointer data2
);
48 /* Start the runner daemon */
50 hald_runner_start_runner(void);
52 /* Start a helper, returns true on a successfull start.
53 * cb will be called on abnormal or premature termination
57 hald_runner_start (HalDevice
*device
, const gchar
*command_line
, char **extra_env
,
58 HalRunTerminatedCB cb
, gpointer data1
, gpointer data2
);
60 /* Run a helper program using the commandline, with input as infomation on
63 hald_runner_run(HalDevice
*device
,
64 const gchar
*command_line
, char **extra_env
,
66 HalRunTerminatedCB cb
,
67 gpointer data1
, gpointer data2
);
69 hald_runner_run_method(HalDevice
*device
,
70 const gchar
*command_line
, char **extra_env
,
71 gchar
*input
, gboolean error_on_stderr
,
73 HalRunTerminatedCB cb
,
74 gpointer data1
, gpointer data2
);
76 void hald_runner_kill_device(HalDevice
*device
);
77 void hald_runner_kill_all();
79 /* called by the core to tell the runner a device was finalized */
80 void runner_device_finalized (HalDevice
*device
);