summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
Diffstat (limited to 'bus')
-rw-r--r--bus/bus.c13
-rw-r--r--bus/bus.h1
-rw-r--r--bus/main.c26
-rw-r--r--bus/test.c2
4 files changed, 40 insertions, 2 deletions
diff --git a/bus/bus.c b/bus/bus.c
index db20bbbc..ea508d72 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -764,11 +764,13 @@ process_config_postinit (BusContext *context,
return TRUE;
}
+/* Takes ownership of print_addr_pipe fds, print_pid_pipe fds and ready_event_handle */
BusContext*
bus_context_new (const DBusString *config_file,
BusContextFlags flags,
DBusPipe *print_addr_pipe,
DBusPipe *print_pid_pipe,
+ void *ready_event_handle,
const DBusString *address,
DBusError *error)
{
@@ -891,6 +893,17 @@ bus_context_new (const DBusString *config_file,
_dbus_string_free (&addr);
}
+#ifdef DBUS_WIN
+ if (ready_event_handle != NULL)
+ {
+ _dbus_verbose ("Notifying that we are ready to receive connections (event handle=%p)\n", ready_event_handle);
+ if (!_dbus_win_event_set (ready_event_handle, error))
+ goto failed;
+ if (!_dbus_win_event_free (ready_event_handle, error))
+ goto failed;
+ }
+#endif
+
context->connections = bus_connections_new (context);
if (context->connections == NULL)
{
diff --git a/bus/bus.h b/bus/bus.h
index 99625ca3..b4411180 100644
--- a/bus/bus.h
+++ b/bus/bus.h
@@ -88,6 +88,7 @@ BusContext* bus_context_new (const DBusStri
BusContextFlags flags,
DBusPipe *print_addr_pipe,
DBusPipe *print_pid_pipe,
+ void *ready_event_handle,
const DBusString *address,
DBusError *error);
dbus_bool_t bus_context_reload_config (BusContext *context,
diff --git a/bus/main.c b/bus/main.c
index 84f601b3..5f756d5c 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -48,6 +48,10 @@
static BusContext *context;
+#ifdef DBUS_WIN
+#include <dbus/dbus-sysdeps-win.h>
+#endif
+
#ifdef DBUS_UNIX
/* Despite its name and its unidirectional nature, this is actually
@@ -163,6 +167,9 @@ usage (void)
" [--syslog]"
" [--syslog-only]"
" [--nofork]"
+#ifdef DBUS_WIN
+ " [--ready-event-handle=value]"
+#endif
#ifdef DBUS_UNIX
" [--fork]"
" [--systemd-activation]"
@@ -403,6 +410,8 @@ main (int argc, char **argv)
dbus_bool_t print_address;
dbus_bool_t print_pid;
BusContextFlags flags;
+ void *ready_event_handle;
+
#ifdef DBUS_UNIX
const char *error_str;
@@ -428,6 +437,7 @@ main (int argc, char **argv)
* to inherit fds we might have inherited from our caller. */
_dbus_fd_set_all_close_on_exec ();
#endif
+ ready_event_handle = NULL;
if (!_dbus_string_init (&config_file))
return 1;
@@ -619,6 +629,20 @@ main (int argc, char **argv)
{
print_pid = TRUE; /* and we'll get the next arg if appropriate */
}
+#ifdef DBUS_WIN
+ else if (strstr (arg, "--ready-event-handle=") == arg)
+ {
+ const char *desc;
+ desc = strchr (arg, '=');
+ _dbus_assert (desc != NULL);
+ ++desc;
+ if (sscanf (desc, "%p", &ready_event_handle) != 1)
+ {
+ fprintf (stderr, "%s specified, but invalid handle provided\n", arg);
+ exit (1);
+ }
+ }
+#endif
else
{
usage ();
@@ -693,7 +717,7 @@ main (int argc, char **argv)
dbus_error_init (&error);
context = bus_context_new (&config_file, flags,
- &print_addr_pipe, &print_pid_pipe,
+ &print_addr_pipe, &print_pid_pipe, ready_event_handle,
_dbus_string_get_length(&address) > 0 ? &address : NULL,
&error);
_dbus_string_free (&config_file);
diff --git a/bus/test.c b/bus/test.c
index 42651e77..8d413fb5 100644
--- a/bus/test.c
+++ b/bus/test.c
@@ -296,7 +296,7 @@ bus_context_new_test (const DBusString *test_data_dir,
}
dbus_error_init (&error);
- context = bus_context_new (&config_file, BUS_CONTEXT_FLAG_NONE, NULL, NULL, NULL, &error);
+ context = bus_context_new (&config_file, BUS_CONTEXT_FLAG_NONE, NULL, NULL, NULL, NULL, &error);
if (context == NULL)
{
_DBUS_ASSERT_ERROR_IS_SET (&error);