D-Bus 1.13.18

dbus-spawn.h
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-spawn.h Wrapper around fork/exec
3 *
4 * Copyright (C) 2002, 2003 Red Hat, Inc.
5 * Copyright (C) 2003 CodeFactory AB
6 *
7 * Licensed under the Academic Free License version 2.1
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 */
24
25 #ifndef DBUS_SPAWN_H
26 #define DBUS_SPAWN_H
27
28 #include <dbus/dbus-string.h>
29 #include <dbus/dbus-errors.h>
30 #include <dbus/dbus-watch.h>
31
32 DBUS_BEGIN_DECLS
33
34 typedef void (* DBusSpawnChildSetupFunc) (void *user_data);
35
36 typedef struct DBusBabysitter DBusBabysitter;
37
38 typedef void (* DBusBabysitterFinishedFunc) (DBusBabysitter *sitter,
39 void *user_data);
40
41 typedef enum {
42 DBUS_SPAWN_REDIRECT_OUTPUT = (1 << 0),
43 DBUS_SPAWN_SILENCE_OUTPUT = (1 << 1),
44 DBUS_SPAWN_NONE = 0
45 } DBusSpawnFlags;
46
47 dbus_bool_t _dbus_spawn_async_with_babysitter (DBusBabysitter **sitter_p,
48 const char *log_name,
49 char * const *argv,
50 char * const *env,
51 DBusSpawnFlags flags,
52 DBusSpawnChildSetupFunc child_setup,
53 void *user_data,
54 DBusError *error);
55 void _dbus_babysitter_set_result_function (DBusBabysitter *sitter,
56 DBusBabysitterFinishedFunc finished,
57 void *user_data);
58 DBusBabysitter* _dbus_babysitter_ref (DBusBabysitter *sitter);
59 void _dbus_babysitter_unref (DBusBabysitter *sitter);
60 void _dbus_babysitter_kill_child (DBusBabysitter *sitter);
61 dbus_bool_t _dbus_babysitter_get_child_exited (DBusBabysitter *sitter);
62 void _dbus_babysitter_set_child_exit_error (DBusBabysitter *sitter,
63 DBusError *error);
64 dbus_bool_t _dbus_babysitter_get_child_exit_status (DBusBabysitter *sitter,
65 int *status);
66 dbus_bool_t _dbus_babysitter_set_watch_functions (DBusBabysitter *sitter,
67 DBusAddWatchFunction add_function,
68 DBusRemoveWatchFunction remove_function,
69 DBusWatchToggledFunction toggled_function,
70 void *data,
71 DBusFreeFunction free_data_function);
72 void _dbus_babysitter_block_for_child_exit (DBusBabysitter *sitter);
73
74 DBUS_END_DECLS
75
76 #endif /* DBUS_SPAWN_H */
_dbus_babysitter_ref
DBusBabysitter * _dbus_babysitter_ref(DBusBabysitter *sitter)
Increment the reference count on the babysitter object.
Definition: dbus-spawn-unix.c:312
_dbus_babysitter_get_child_exited
dbus_bool_t _dbus_babysitter_get_child_exited(DBusBabysitter *sitter)
Checks whether the child has exited, without blocking.
Definition: dbus-spawn-unix.c:726
DBusBabysitter::status
int status
Exit status code.
Definition: dbus-spawn-unix.c:271
_dbus_babysitter_set_child_exit_error
void _dbus_babysitter_set_child_exit_error(DBusBabysitter *sitter, DBusError *error)
Sets the DBusError with an explanation of why the spawned child process exited (on a signal,...
Definition: dbus-spawn-unix.c:775
DBusFreeFunction
void(* DBusFreeFunction)(void *memory)
Definition: dbus-memory.h:63
DBusBabysitter::log_name
char * log_name
the name under which to log messages about this process being spawned
Definition: dbus-spawn-unix.c:253
DBUS_END_DECLS
#define DBUS_END_DECLS
_dbus_babysitter_set_watch_functions
dbus_bool_t _dbus_babysitter_set_watch_functions(DBusBabysitter *sitter, DBusAddWatchFunction add_function, DBusRemoveWatchFunction remove_function, DBusWatchToggledFunction toggled_function, void *data, DBusFreeFunction free_data_function)
Sets watch functions to notify us when the babysitter object needs to read/write file descriptors.
Definition: dbus-spawn-unix.c:833
DBusAddWatchFunction
dbus_bool_t(* DBusAddWatchFunction)(DBusWatch *watch, void *data)
Called when libdbus needs a new watch to be monitored by the main loop.
Definition: dbus-connection.h:92
DBUS_BEGIN_DECLS
#define DBUS_BEGIN_DECLS
DBusBabysitter
Babysitter implementation details.
Definition: dbus-spawn-unix.c:250
DBusWatchToggledFunction
void(* DBusWatchToggledFunction)(DBusWatch *watch, void *data)
Called when dbus_watch_get_enabled() may return a different value than it did before.
Definition: dbus-connection.h:98
_dbus_babysitter_unref
void _dbus_babysitter_unref(DBusBabysitter *sitter)
Decrement the reference count on the babysitter object.
Definition: dbus-spawn-unix.c:334
DBusError
Object representing an exception.
Definition: dbus-errors.h:49
_dbus_spawn_async_with_babysitter
dbus_bool_t _dbus_spawn_async_with_babysitter(DBusBabysitter **sitter_p, const char *log_name, char *const *argv, char *const *env, DBusSpawnFlags flags, DBusSpawnChildSetupFunc child_setup, void *user_data, DBusError *error)
Spawns a new process.
Definition: dbus-spawn-unix.c:1271
DBusRemoveWatchFunction
void(* DBusRemoveWatchFunction)(DBusWatch *watch, void *data)
Called when libdbus no longer needs a watch to be monitored by the main loop.
Definition: dbus-connection.h:104
_dbus_babysitter_kill_child
void _dbus_babysitter_kill_child(DBusBabysitter *sitter)
Blocks until the babysitter process gives us the PID of the spawned grandchild, then kills the spawne...
Definition: dbus-spawn-unix.c:704
_dbus_babysitter_get_child_exit_status
dbus_bool_t _dbus_babysitter_get_child_exit_status(DBusBabysitter *sitter, int *status)
Gets the exit status of the child.
Definition: dbus-spawn-unix.c:751
dbus_bool_t
dbus_uint32_t dbus_bool_t
Definition: dbus-types.h:35