Merge lp:~stgraber/upstart/upstart-events-bridge into lp:upstart
- upstart-events-bridge
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 1421 |
Proposed branch: | lp:~stgraber/upstart/upstart-events-bridge |
Merge into: | lp:upstart |
Diff against target: |
444 lines (+405/-2) 4 files modified
extra/Makefile.am (+17/-2) extra/conf/upstart-event-bridge.conf (+16/-0) extra/man/upstart-event-bridge.8 (+68/-0) extra/upstart-event-bridge.c (+304/-0) |
To merge this branch: | bzr merge lp:~stgraber/upstart/upstart-events-bridge |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
James Hunt | Approve | ||
Review via email: mp+140693@code.launchpad.net |
Commit message
Description of the change
This introduces a new upstart-
the user session and which then relays events from the system upstart to the
session upstart.
Events are all prefixed with ":sys:" and a special even also exists for when
the system upstart is restarted (":sys:restarted").
Testing was only done with the current upstart listening to the session bus,
but it should still work fine once we have the full user session support
implemented.
James Hunt (jamesodhunt) wrote : | # |
- 1418. By Stéphane Graber
-
Update manpage
- 1419. By Stéphane Graber
-
Remove logging to syslog
Steve Langasek (vorlon) wrote : | # |
On Wed, Dec 19, 2012 at 02:55:24PM -0000, Stéphane Graber wrote:
> This introduces a new upstart-
> the user session and which then relays events from the system upstart to the
> session upstart.
> Events are all prefixed with ":sys:" and a special even also exists for when
> the system upstart is restarted (":sys:restarted").
> Testing was only done with the current upstart listening to the session bus,
> but it should still work fine once we have the full user session support
> implemented.
What's the rationale for implementing this over the user dbus, instead of
having the user session's init process connecting to upstart directly? dbus
looks like needless indirection here to me.
Stéphane Graber (stgraber) wrote : | # |
Because it's the only way to catch the Restarted event. If we connected to the upstart system socket instead (assuming we can as a user, haven't checked), we'd loose the connection and have to reconnect, most likely loosing the Restarted event in the process.
Steve Langasek (vorlon) wrote : | # |
On Wed, Dec 19, 2012 at 06:03:28PM -0000, Stéphane Graber wrote:
> Because it's the only way to catch the Restarted event. If we connected to
> the upstart system socket instead (assuming we can as a user, haven't
> checked), we'd loose the connection and have to reconnect, most likely
> loosing the Restarted event in the process.
Sorry, what I meant was, why are we using dbus on the *user session* side?
The user session init should be able to connect directly to the system bus,
with no need for this separate bridge process that's dependent on having a
session bus running.
Stéphane Graber (stgraber) wrote : | # |
Ah right, well, we figured it was the easiest way to implement it, would make it much easier to support scenario where we use upstart for the user session but not for the system itself (thinking of Debian there). I vaguely remember something else being mentioned, maybe James can refresh my memory there.
For the session bus, that part should be easy to improve by using upstart's own socket for the user session. This feature doesn't exist yet though so I could use it. It's on my todo for tomorrow, so after that I should be able to avoid using the session bus.
Preview Diff
1 | === modified file 'extra/Makefile.am' | |||
2 | --- extra/Makefile.am 2011-06-06 15:49:43 +0000 | |||
3 | +++ extra/Makefile.am 2012-12-19 17:07:26 +0000 | |||
4 | @@ -17,13 +17,16 @@ | |||
5 | 17 | 17 | ||
6 | 18 | 18 | ||
7 | 19 | sbin_PROGRAMS = \ | 19 | sbin_PROGRAMS = \ |
9 | 20 | upstart-socket-bridge | 20 | upstart-socket-bridge \ |
10 | 21 | upstart-event-bridge | ||
11 | 21 | 22 | ||
12 | 22 | dist_init_DATA = \ | 23 | dist_init_DATA = \ |
14 | 23 | conf/upstart-socket-bridge.conf | 24 | conf/upstart-socket-bridge.conf \ |
15 | 25 | conf/upstart-event-bridge.conf | ||
16 | 24 | 26 | ||
17 | 25 | dist_man_MANS = \ | 27 | dist_man_MANS = \ |
18 | 26 | man/upstart-socket-bridge.8 \ | 28 | man/upstart-socket-bridge.8 \ |
19 | 29 | man/upstart-event-bridge.8 \ | ||
20 | 27 | man/socket-event.7 | 30 | man/socket-event.7 |
21 | 28 | 31 | ||
22 | 29 | upstart_socket_bridge_SOURCES = \ | 32 | upstart_socket_bridge_SOURCES = \ |
23 | @@ -37,6 +40,18 @@ | |||
24 | 37 | $(NIH_DBUS_LIBS) \ | 40 | $(NIH_DBUS_LIBS) \ |
25 | 38 | $(DBUS_LIBS) | 41 | $(DBUS_LIBS) |
26 | 39 | 42 | ||
27 | 43 | upstart_event_bridge_SOURCES = \ | ||
28 | 44 | upstart-event-bridge.c | ||
29 | 45 | nodist_upstart_event_bridge_SOURCES = \ | ||
30 | 46 | $(com_ubuntu_Upstart_OUTPUTS) \ | ||
31 | 47 | $(com_ubuntu_Upstart_Job_OUTPUTS) | ||
32 | 48 | upstart_event_bridge_LDADD = \ | ||
33 | 49 | $(LTLIBINTL) \ | ||
34 | 50 | $(NIH_LIBS) \ | ||
35 | 51 | $(NIH_DBUS_LIBS) \ | ||
36 | 52 | $(DBUS_LIBS) | ||
37 | 53 | |||
38 | 54 | |||
39 | 40 | 55 | ||
40 | 41 | if HAVE_UDEV | 56 | if HAVE_UDEV |
41 | 42 | dist_init_DATA += \ | 57 | dist_init_DATA += \ |
42 | 43 | 58 | ||
43 | === added file 'extra/conf/upstart-event-bridge.conf' | |||
44 | --- extra/conf/upstart-event-bridge.conf 1970-01-01 00:00:00 +0000 | |||
45 | +++ extra/conf/upstart-event-bridge.conf 2012-12-19 17:07:26 +0000 | |||
46 | @@ -0,0 +1,16 @@ | |||
47 | 1 | # upstart-events-bridge - Bridge system upstarts events into session upstart | ||
48 | 2 | # | ||
49 | 3 | # This helper daemon receives system upstart events from the DBus system bus | ||
50 | 4 | # and emits equivalent events (with a :sys:) prefix to the session bus | ||
51 | 5 | |||
52 | 6 | description "Bridge Upstart system events into session Upstart" | ||
53 | 7 | |||
54 | 8 | emits :sys:* | ||
55 | 9 | |||
56 | 10 | start on started dbus | ||
57 | 11 | stop on stopped dbus | ||
58 | 12 | |||
59 | 13 | expect daemon | ||
60 | 14 | respawn | ||
61 | 15 | |||
62 | 16 | exec upstart-events-bridge --daemon | ||
63 | 0 | 17 | ||
64 | === added file 'extra/man/upstart-event-bridge.8' | |||
65 | --- extra/man/upstart-event-bridge.8 1970-01-01 00:00:00 +0000 | |||
66 | +++ extra/man/upstart-event-bridge.8 2012-12-19 17:07:26 +0000 | |||
67 | @@ -0,0 +1,68 @@ | |||
68 | 1 | .TH upstart\-events\-bridge 8 2011-03-08 upstart | ||
69 | 2 | .\" | ||
70 | 3 | .SH NAME | ||
71 | 4 | upstart\-events\-bridge \- Bridge between system Upstart and session Upstart | ||
72 | 5 | .\" | ||
73 | 6 | .SH SYNOPSIS | ||
74 | 7 | .B upstart\-events\-bridge | ||
75 | 8 | .RI [ OPTIONS ]... | ||
76 | 9 | .\" | ||
77 | 10 | .SH DESCRIPTION | ||
78 | 11 | .B upstart\-events\-bridge | ||
79 | 12 | receives information about Upstart system | ||
80 | 13 | .BR events (8) | ||
81 | 14 | have completed and creates Upstart session events for them. | ||
82 | 15 | |||
83 | 16 | It emits events which match the pattern ":sys:*". Forwarding any event that's | ||
84 | 17 | triggered on the system upstart as well as a virtual "restarted" event when | ||
85 | 18 | upstart itself is restarted (during upgrades). | ||
86 | 19 | |||
87 | 20 | See \fBupstart-events\fP(7) and for further details. | ||
88 | 21 | |||
89 | 22 | This bridge should be run as a user, after the session bus has been setup and | ||
90 | 23 | only once per session init. | ||
91 | 24 | |||
92 | 25 | .\" | ||
93 | 26 | .SH OPTIONS | ||
94 | 27 | .\" | ||
95 | 28 | .TP | ||
96 | 29 | .B \-\-daemon | ||
97 | 30 | Detach and run in the background. | ||
98 | 31 | .\" | ||
99 | 32 | .TP | ||
100 | 33 | .B \-\-debug | ||
101 | 34 | Enable debugging output. | ||
102 | 35 | .\" | ||
103 | 36 | .TP | ||
104 | 37 | .B \-\-help | ||
105 | 38 | Show brief usage summary. | ||
106 | 39 | .\" | ||
107 | 40 | .TP | ||
108 | 41 | .B \-\-verbose | ||
109 | 42 | Enable verbose output. | ||
110 | 43 | .\" | ||
111 | 44 | .SH EXAMPLES | ||
112 | 45 | |||
113 | 46 | Some examples of Upstart events generated by this bridge: | ||
114 | 47 | .IP :sys:restarted | ||
115 | 48 | Event emitted when the system Upstart is restarted. | ||
116 | 49 | .IP :sys:* | ||
117 | 50 | Any event emitted on the system Upstart. | ||
118 | 51 | .\" | ||
119 | 52 | .SH AUTHOR | ||
120 | 53 | Written by Stéphane Graber | ||
121 | 54 | .RB < stgraber@ubuntu.com > | ||
122 | 55 | .\" | ||
123 | 56 | .SH BUGS | ||
124 | 57 | Report bugs at | ||
125 | 58 | .RB < https://launchpad.net/ubuntu/+source/upstart/+bugs > | ||
126 | 59 | .\" | ||
127 | 60 | .SH COPYRIGHT | ||
128 | 61 | Copyright \(co 2012 Canonical Ltd. | ||
129 | 62 | .PP | ||
130 | 63 | This is free software; see the source for copying conditions. There is NO | ||
131 | 64 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
132 | 65 | .SH SEE ALSO | ||
133 | 66 | .BR init (5) | ||
134 | 67 | .BR init (8) | ||
135 | 68 | .BR events (7) | ||
136 | 0 | 69 | ||
137 | === added file 'extra/upstart-event-bridge.c' | |||
138 | --- extra/upstart-event-bridge.c 1970-01-01 00:00:00 +0000 | |||
139 | +++ extra/upstart-event-bridge.c 2012-12-19 17:07:26 +0000 | |||
140 | @@ -0,0 +1,304 @@ | |||
141 | 1 | /* upstart | ||
142 | 2 | * | ||
143 | 3 | * Copyright © 2012 Canonical Ltd. | ||
144 | 4 | * Author: Stéphane Graber <stgraber@ubuntu.com> | ||
145 | 5 | * | ||
146 | 6 | * This program is free software; you can redistribute it and/or modify | ||
147 | 7 | * it under the terms of the GNU General Public License version 2, as | ||
148 | 8 | * published by the Free Software Foundation. | ||
149 | 9 | * | ||
150 | 10 | * This program is distributed in the hope that it will be useful, | ||
151 | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
152 | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
153 | 13 | * GNU General Public License for more details. | ||
154 | 14 | * | ||
155 | 15 | * You should have received a copy of the GNU General Public License along | ||
156 | 16 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
157 | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
158 | 18 | */ | ||
159 | 19 | |||
160 | 20 | #ifdef HAVE_CONFIG_H | ||
161 | 21 | # include <config.h> | ||
162 | 22 | #endif /* HAVE_CONFIG_H */ | ||
163 | 23 | |||
164 | 24 | |||
165 | 25 | #include <stdio.h> | ||
166 | 26 | #include <stdlib.h> | ||
167 | 27 | #include <string.h> | ||
168 | 28 | #include <ctype.h> | ||
169 | 29 | |||
170 | 30 | #include <nih/macros.h> | ||
171 | 31 | #include <nih/alloc.h> | ||
172 | 32 | #include <nih/string.h> | ||
173 | 33 | #include <nih/io.h> | ||
174 | 34 | #include <nih/option.h> | ||
175 | 35 | #include <nih/main.h> | ||
176 | 36 | #include <nih/logging.h> | ||
177 | 37 | #include <nih/error.h> | ||
178 | 38 | |||
179 | 39 | #include <nih-dbus/dbus_connection.h> | ||
180 | 40 | #include <nih-dbus/dbus_proxy.h> | ||
181 | 41 | |||
182 | 42 | #include "dbus/upstart.h" | ||
183 | 43 | #include "com.ubuntu.Upstart.h" | ||
184 | 44 | |||
185 | 45 | |||
186 | 46 | /* Prototypes for static functions */ | ||
187 | 47 | static void upstart_disconnected (DBusConnection *connection); | ||
188 | 48 | static void upstart_forward_event (void *data, NihDBusMessage *message, | ||
189 | 49 | const char *path); | ||
190 | 50 | static void upstart_forward_restarted (void *data, NihDBusMessage *message, | ||
191 | 51 | const char *path); | ||
192 | 52 | static void emit_event_error (void *data, NihDBusMessage *message); | ||
193 | 53 | |||
194 | 54 | /** | ||
195 | 55 | * daemonise: | ||
196 | 56 | * | ||
197 | 57 | * Set to TRUE if we should become a daemon, rather than just running | ||
198 | 58 | * in the foreground. | ||
199 | 59 | **/ | ||
200 | 60 | static int daemonise = FALSE; | ||
201 | 61 | |||
202 | 62 | /** | ||
203 | 63 | * system_upstart: | ||
204 | 64 | * | ||
205 | 65 | * Proxy to system Upstart daemon. | ||
206 | 66 | **/ | ||
207 | 67 | static NihDBusProxy *system_upstart = NULL; | ||
208 | 68 | |||
209 | 69 | /** | ||
210 | 70 | * session_upstart: | ||
211 | 71 | * | ||
212 | 72 | * Proxy to session Upstart daemon. | ||
213 | 73 | **/ | ||
214 | 74 | static NihDBusProxy *session_upstart = NULL; | ||
215 | 75 | |||
216 | 76 | /** | ||
217 | 77 | * options: | ||
218 | 78 | * | ||
219 | 79 | * Command-line options accepted by this program. | ||
220 | 80 | **/ | ||
221 | 81 | static NihOption options[] = { | ||
222 | 82 | { 0, "daemon", N_("Detach and run in the background"), | ||
223 | 83 | NULL, NULL, &daemonise, NULL }, | ||
224 | 84 | |||
225 | 85 | NIH_OPTION_LAST | ||
226 | 86 | }; | ||
227 | 87 | |||
228 | 88 | |||
229 | 89 | int | ||
230 | 90 | main (int argc, | ||
231 | 91 | char *argv[]) | ||
232 | 92 | { | ||
233 | 93 | char ** args; | ||
234 | 94 | DBusConnection * system_connection; | ||
235 | 95 | DBusConnection * session_connection; | ||
236 | 96 | int ret; | ||
237 | 97 | |||
238 | 98 | |||
239 | 99 | nih_main_init (argv[0]); | ||
240 | 100 | |||
241 | 101 | nih_option_set_synopsis (_("Bridge system upstart events into session upstart")); | ||
242 | 102 | nih_option_set_help ( | ||
243 | 103 | _("By default, upstart-event-bridge does not detach from the " | ||
244 | 104 | "console and remains in the foreground. Use the --daemon " | ||
245 | 105 | "option to have it detach.")); | ||
246 | 106 | |||
247 | 107 | args = nih_option_parser (NULL, argc, argv, options, FALSE); | ||
248 | 108 | if (! args) | ||
249 | 109 | exit (1); | ||
250 | 110 | |||
251 | 111 | /* Initialise the connection to system Upstart */ | ||
252 | 112 | system_connection = NIH_SHOULD (nih_dbus_bus (DBUS_BUS_SYSTEM, upstart_disconnected)); | ||
253 | 113 | |||
254 | 114 | if (! system_connection) { | ||
255 | 115 | NihError *err; | ||
256 | 116 | |||
257 | 117 | err = nih_error_get (); | ||
258 | 118 | nih_fatal ("%s: %s", _("Could not connect to system Upstart"), | ||
259 | 119 | err->message); | ||
260 | 120 | nih_free (err); | ||
261 | 121 | |||
262 | 122 | exit (1); | ||
263 | 123 | } | ||
264 | 124 | |||
265 | 125 | system_upstart = NIH_SHOULD (nih_dbus_proxy_new (NULL, system_connection, | ||
266 | 126 | DBUS_SERVICE_UPSTART, DBUS_PATH_UPSTART, | ||
267 | 127 | NULL, NULL)); | ||
268 | 128 | if (! system_upstart) { | ||
269 | 129 | NihError *err; | ||
270 | 130 | |||
271 | 131 | err = nih_error_get (); | ||
272 | 132 | nih_fatal ("%s: %s", _("Could not create Upstart proxy"), | ||
273 | 133 | err->message); | ||
274 | 134 | nih_free (err); | ||
275 | 135 | |||
276 | 136 | exit (1); | ||
277 | 137 | } | ||
278 | 138 | |||
279 | 139 | if (! nih_dbus_proxy_connect (system_upstart, &upstart_com_ubuntu_Upstart0_6, "EventEmitted", | ||
280 | 140 | (NihDBusSignalHandler)upstart_forward_event, NULL)) { | ||
281 | 141 | NihError *err; | ||
282 | 142 | |||
283 | 143 | err = nih_error_get (); | ||
284 | 144 | nih_fatal ("%s: %s", _("Could not create EventEmitted signal connection"), | ||
285 | 145 | err->message); | ||
286 | 146 | nih_free (err); | ||
287 | 147 | |||
288 | 148 | exit (1); | ||
289 | 149 | } | ||
290 | 150 | |||
291 | 151 | if (! nih_dbus_proxy_connect (system_upstart, &upstart_com_ubuntu_Upstart0_6, "Restarted", | ||
292 | 152 | (NihDBusSignalHandler)upstart_forward_restarted, NULL)) { | ||
293 | 153 | NihError *err; | ||
294 | 154 | |||
295 | 155 | err = nih_error_get (); | ||
296 | 156 | nih_fatal ("%s: %s", _("Could not create Restarted signal connection"), | ||
297 | 157 | err->message); | ||
298 | 158 | nih_free (err); | ||
299 | 159 | |||
300 | 160 | exit (1); | ||
301 | 161 | } | ||
302 | 162 | |||
303 | 163 | /* Initialise the connection to session Upstart */ | ||
304 | 164 | session_connection = nih_dbus_bus (DBUS_BUS_SESSION, upstart_disconnected); | ||
305 | 165 | |||
306 | 166 | if (! session_connection) { | ||
307 | 167 | NihError *err; | ||
308 | 168 | |||
309 | 169 | err = nih_error_get (); | ||
310 | 170 | nih_fatal ("%s: %s", _("Could not connect to session Upstart"), | ||
311 | 171 | err->message); | ||
312 | 172 | nih_free (err); | ||
313 | 173 | |||
314 | 174 | exit (1); | ||
315 | 175 | } | ||
316 | 176 | |||
317 | 177 | session_upstart = NIH_SHOULD (nih_dbus_proxy_new (NULL, session_connection, | ||
318 | 178 | DBUS_SERVICE_UPSTART, DBUS_PATH_UPSTART, | ||
319 | 179 | NULL, NULL)); | ||
320 | 180 | if (! session_upstart) { | ||
321 | 181 | NihError *err; | ||
322 | 182 | |||
323 | 183 | err = nih_error_get (); | ||
324 | 184 | nih_fatal ("%s: %s", _("Could not create Upstart proxy"), | ||
325 | 185 | err->message); | ||
326 | 186 | nih_free (err); | ||
327 | 187 | |||
328 | 188 | exit (1); | ||
329 | 189 | } | ||
330 | 190 | |||
331 | 191 | /* Become daemon */ | ||
332 | 192 | if (daemonise) { | ||
333 | 193 | if (nih_main_daemonise () < 0) { | ||
334 | 194 | NihError *err; | ||
335 | 195 | |||
336 | 196 | err = nih_error_get (); | ||
337 | 197 | nih_fatal ("%s: %s", _("Unable to become daemon"), | ||
338 | 198 | err->message); | ||
339 | 199 | nih_free (err); | ||
340 | 200 | |||
341 | 201 | exit (1); | ||
342 | 202 | } | ||
343 | 203 | } | ||
344 | 204 | |||
345 | 205 | /* Handle TERM and INT signals gracefully */ | ||
346 | 206 | nih_signal_set_handler (SIGTERM, nih_signal_handler); | ||
347 | 207 | NIH_MUST (nih_signal_add_handler (NULL, SIGTERM, nih_main_term_signal, NULL)); | ||
348 | 208 | |||
349 | 209 | if (! daemonise) { | ||
350 | 210 | nih_signal_set_handler (SIGINT, nih_signal_handler); | ||
351 | 211 | NIH_MUST (nih_signal_add_handler (NULL, SIGINT, nih_main_term_signal, NULL)); | ||
352 | 212 | } | ||
353 | 213 | |||
354 | 214 | ret = nih_main_loop (); | ||
355 | 215 | |||
356 | 216 | return ret; | ||
357 | 217 | } | ||
358 | 218 | |||
359 | 219 | static void | ||
360 | 220 | upstart_disconnected (DBusConnection *connection) | ||
361 | 221 | { | ||
362 | 222 | nih_fatal (_("Disconnected from Upstart")); | ||
363 | 223 | nih_main_loop_exit (1); | ||
364 | 224 | } | ||
365 | 225 | |||
366 | 226 | static void | ||
367 | 227 | upstart_forward_event (void * data, | ||
368 | 228 | NihDBusMessage *message, | ||
369 | 229 | const char * path) | ||
370 | 230 | { | ||
371 | 231 | char * event_name = NULL; | ||
372 | 232 | nih_local char * new_event_name = NULL; | ||
373 | 233 | char ** event_env = NULL; | ||
374 | 234 | int event_env_count = 0; | ||
375 | 235 | DBusError error; | ||
376 | 236 | DBusPendingCall * pending_call; | ||
377 | 237 | |||
378 | 238 | dbus_error_init (&error); | ||
379 | 239 | |||
380 | 240 | /* Extract information from the original event */ | ||
381 | 241 | if (!dbus_message_get_args (message->message, &error, | ||
382 | 242 | DBUS_TYPE_STRING, &event_name, | ||
383 | 243 | DBUS_TYPE_ARRAY, DBUS_TYPE_STRING, &event_env, &event_env_count, | ||
384 | 244 | DBUS_TYPE_INVALID)) { | ||
385 | 245 | nih_error("DBUS error: %s", error.message); | ||
386 | 246 | dbus_error_free(&error); | ||
387 | 247 | return; | ||
388 | 248 | } | ||
389 | 249 | |||
390 | 250 | nih_assert (event_name != NULL); | ||
391 | 251 | |||
392 | 252 | /* Build the new event name */ | ||
393 | 253 | NIH_MUST (nih_strcat_sprintf (&new_event_name, NULL, ":sys:%s", event_name)); | ||
394 | 254 | |||
395 | 255 | /* Re-transmit the event */ | ||
396 | 256 | pending_call = upstart_emit_event (session_upstart, | ||
397 | 257 | new_event_name, event_env, FALSE, | ||
398 | 258 | NULL, emit_event_error, NULL, | ||
399 | 259 | NIH_DBUS_TIMEOUT_NEVER); | ||
400 | 260 | |||
401 | 261 | if (! pending_call) { | ||
402 | 262 | NihError *err; | ||
403 | 263 | err = nih_error_get (); | ||
404 | 264 | nih_warn ("%s", err->message); | ||
405 | 265 | nih_free (err); | ||
406 | 266 | } | ||
407 | 267 | |||
408 | 268 | dbus_pending_call_unref (pending_call); | ||
409 | 269 | dbus_free_string_array (event_env); | ||
410 | 270 | } | ||
411 | 271 | |||
412 | 272 | static void | ||
413 | 273 | upstart_forward_restarted (void * data, | ||
414 | 274 | NihDBusMessage *message, | ||
415 | 275 | const char * path) | ||
416 | 276 | { | ||
417 | 277 | DBusPendingCall * pending_call; | ||
418 | 278 | |||
419 | 279 | /* Re-transmit the event */ | ||
420 | 280 | pending_call = upstart_emit_event (session_upstart, | ||
421 | 281 | ":sys:restarted", NULL, FALSE, | ||
422 | 282 | NULL, emit_event_error, NULL, | ||
423 | 283 | NIH_DBUS_TIMEOUT_NEVER); | ||
424 | 284 | |||
425 | 285 | if (! pending_call) { | ||
426 | 286 | NihError *err; | ||
427 | 287 | err = nih_error_get (); | ||
428 | 288 | nih_warn ("%s", err->message); | ||
429 | 289 | nih_free (err); | ||
430 | 290 | } | ||
431 | 291 | |||
432 | 292 | dbus_pending_call_unref (pending_call); | ||
433 | 293 | } | ||
434 | 294 | |||
435 | 295 | static void | ||
436 | 296 | emit_event_error (void * data, | ||
437 | 297 | NihDBusMessage *message) | ||
438 | 298 | { | ||
439 | 299 | NihError *err; | ||
440 | 300 | |||
441 | 301 | err = nih_error_get (); | ||
442 | 302 | nih_warn ("%s", err->message); | ||
443 | 303 | nih_free (err); | ||
444 | 304 | } |
* extra/man/ upstart- event-bridge. 8: event-bridge. c: I'm wondering if we want to not forward output to syslog in the daemonise case? Users may prefer to have the output logged to ~/.cache/ upstart/ upstart- event-bridge. log.
- 'See events(7)' should be upstart-events(7).
- Can you mention that this should (generally) run as a non-priv user, 1 per Session Init.
* extra/upstart-