summaryrefslogtreecommitdiffstats
path: root/dbus-win.patch
blob: 6ac028aebf0a6a5346511fe46b8d1d7668b27abe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
Index: bus/dispatch.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/dispatch.c,v
retrieving revision 1.79
diff -u -r1.79 dispatch.c
--- bus/dispatch.c	8 Mar 2007 08:30:17 -0000	1.79
+++ bus/dispatch.c	8 Mar 2007 20:25:42 -0000
@@ -428,6 +428,11 @@
     }
 }
 
+#ifdef DBUS_WIN
+#include <tools/dbus-print-message.h>
+#include <tools/dbus-print-message.c>
+#endif
+
 static void
 spin_connection_until_authenticated (BusContext     *context,
                                      DBusConnection *connection)
@@ -439,6 +444,19 @@
       bus_test_run_bus_loop (context, FALSE);
       bus_test_run_clients_loop (FALSE);
     }
+#ifdef DBUS_WIN
+  if ( dbus_connection_get_dispatch_status(connection) != DBUS_DISPATCH_COMPLETE)
+    {
+      DBusMessage *message;
+	  message = dbus_connection_pop_message (connection);
+	  printf ("spin_connection_until_authenticated failed,\n");
+	  printf ("because of a non dispatched message:\n");
+	  print_message(message, FALSE);
+	  printf ("\n");	 
+	  _dbus_assert_not_reached ("spin_connection_until_authenticated failed\n ");
+    }
+#endif
+
   _dbus_verbose (" ... done spinning to auth connection %p\n", connection);
 }
 
@@ -2699,9 +2717,12 @@
         }
       else
         {
+/* no DBUS_ERROR_NO_MEMORY on windows (no have_fork_errnum)*/
+#ifndef DBUS_WIN_FIXME
           warn_unexpected (connection, message, "not this error");
 
           goto out;
+#endif
         }
     }
   else
@@ -4064,29 +4085,36 @@
       _dbus_assert_not_reached ("initial connection setup failed");
     }
   
+#ifdef DBUS_WIN_FIXME
+  _dbus_warn("TODO: dispatch.c create_and_hello test\n");
+#else
   check1_try_iterations (context, "create_and_hello",
                          check_hello_connection);
+#endif
   
   check2_try_iterations (context, foo, "nonexistent_service_no_auto_start",
                          check_nonexistent_service_no_auto_start);
 
-#ifdef DBUS_WIN_FIXME
+#ifdef DBUS_WIN_FIXME
   _dbus_warn("TODO: dispatch.c segfault_service_no_auto_start test\n");
 #else
   check2_try_iterations (context, foo, "segfault_service_no_auto_start",
                          check_segfault_service_no_auto_start);
 #endif
   
+#ifdef DBUS_WIN_FIXME
+  _dbus_warn("TODO: dispatch.c existent_service_no_auto_start\n");
+#else
   check2_try_iterations (context, foo, "existent_service_no_auto_start",
                          check_existent_service_no_auto_start);
   
   check2_try_iterations (context, foo, "nonexistent_service_auto_start",
                          check_nonexistent_service_auto_start);
-  
+#endif
 
 #ifdef DBUS_WIN_FIXME    
   _dbus_warn("TODO: dispatch.c segfault_service_auto_start test\n");
-#else
+#else
   check2_try_iterations (context, foo, "segfault_service_auto_start",
                          check_segfault_service_auto_start);
 #endif
@@ -4106,8 +4134,12 @@
   if (!check_existent_service_auto_start (context, foo))
     _dbus_assert_not_reached ("existent service auto start failed");
 
+#ifdef DBUS_WIN_FIXME  
+  _dbus_warn("TODO: dispatch.c check_shell_service_success_auto_start test\n");
+#else
   if (!check_shell_service_success_auto_start (context, foo))
     _dbus_assert_not_reached ("shell success service auto start failed");
+#endif
 
   _dbus_verbose ("Disconnecting foo, bar, and baz\n");
 
@@ -4158,8 +4190,12 @@
       _dbus_assert_not_reached ("initial connection setup failed");
     }
   
+#ifdef DBUS_WIN_FIXME  
+  _dbus_warn("TODO: dispatch.c: create_and_hello_sha1 test\n");
+#else
   check1_try_iterations (context, "create_and_hello_sha1",
                          check_hello_connection);
+#endif
 
   kill_client_connection_unchecked (foo);
 
Index: dbus/dbus-bus.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-bus.c,v
retrieving revision 1.64
diff -u -r1.64 dbus-bus.c
--- dbus/dbus-bus.c	28 Oct 2006 01:41:37 -0000	1.64
+++ dbus/dbus-bus.c	8 Mar 2007 20:25:40 -0000
@@ -350,8 +350,10 @@
 {
   int i;
   
+#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
+   // qt example pong says "QMutex::lock: Deadlock detected"
   _DBUS_LOCK (bus);
-
+#endif
   /* We are expecting to have the connection saved in only one of these
    * slots, but someone could in a pathological case set system and session
    * bus to the same bus or something. Or set one of them to the starter
@@ -366,7 +368,9 @@
         }
     }
 
+#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
   _DBUS_UNLOCK (bus);
+#endif
 }
 
 static DBusConnection *
Index: dbus/dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.154
diff -u -r1.154 dbus-connection.c
--- dbus/dbus-connection.c	15 Nov 2006 03:07:59 -0000	1.154
+++ dbus/dbus-connection.c	8 Mar 2007 20:25:37 -0000
@@ -4790,14 +4790,6 @@
   _dbus_return_val_if_fail (connection != NULL, FALSE);
   _dbus_return_val_if_fail (uid != NULL, FALSE);
 
-#ifdef DBUS_WIN
-  /* FIXME this should be done at a lower level, but it's kind of hard,
-   * just want to be sure we don't ship with this API returning
-   * some weird internal fake uid for 1.0
-   */
-  return FALSE;
-#endif
-  
   CONNECTION_LOCK (connection);
 
   if (!_dbus_transport_get_is_authenticated (connection->transport))
@@ -4829,14 +4821,6 @@
   _dbus_return_val_if_fail (connection != NULL, FALSE);
   _dbus_return_val_if_fail (pid != NULL, FALSE);
 
-#ifdef DBUS_WIN
-  /* FIXME this should be done at a lower level, but it's kind of hard,
-   * just want to be sure we don't ship with this API returning
-   * some weird internal fake uid for 1.0
-   */
-  return FALSE;
-#endif
-  
   CONNECTION_LOCK (connection);
 
   if (!_dbus_transport_get_is_authenticated (connection->transport))
Index: dbus/dbus-connection.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.h,v
retrieving revision 1.49
diff -u -r1.49 dbus-connection.h
--- dbus/dbus-connection.h	15 Nov 2006 03:07:59 -0000	1.49
+++ dbus/dbus-connection.h	8 Mar 2007 20:25:40 -0000
@@ -330,6 +330,9 @@
  */
 
 int          dbus_watch_get_fd      (DBusWatch        *watch);
+#if defined (DBUS_COMPILATION)
+int          dbus_watch_get_handle  (DBusWatch        *watch);
+#endif
 unsigned int dbus_watch_get_flags   (DBusWatch        *watch);
 void*        dbus_watch_get_data    (DBusWatch        *watch);
 void         dbus_watch_set_data    (DBusWatch        *watch,
Index: dbus/dbus-mainloop.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-mainloop.c,v
retrieving revision 1.19
diff -u -r1.19 dbus-mainloop.c
--- dbus/dbus-mainloop.c	20 Oct 2006 03:04:59 -0000	1.19
+++ dbus/dbus-mainloop.c	8 Mar 2007 20:25:40 -0000
@@ -598,7 +598,7 @@
 
 #if MAINLOOP_SPEW
               _dbus_verbose ("  skipping watch on fd %d as it was out of memory last time\n",
-                             dbus_watch_get_fd (wcb->watch));
+                             dbus_watch_get_handle (wcb->watch));
 #endif
             }
           else if (dbus_watch_get_enabled (wcb->watch))
@@ -609,7 +609,7 @@
                   
               flags = dbus_watch_get_flags (wcb->watch);
                   
-              fds[n_fds].fd = dbus_watch_get_fd (wcb->watch);
+              fds[n_fds].fd = dbus_watch_get_handle (wcb->watch);
               fds[n_fds].revents = 0;
               fds[n_fds].events = 0;
               if (flags & DBUS_WATCH_READABLE)
@@ -628,7 +628,7 @@
             {
 #if MAINLOOP_SPEW
               _dbus_verbose ("  skipping disabled watch on fd %d  %s\n",
-                             dbus_watch_get_fd (wcb->watch),
+                             dbus_watch_get_handle (wcb->watch),
                              watch_flags_to_string (dbus_watch_get_flags (wcb->watch)));
 #endif
             }
@@ -883,6 +883,8 @@
   
   loop->depth -= 1;
 
+ _dbus_daemon_release ();
+
   _dbus_verbose ("Quit main loop, depth %d -> %d\n",
                  loop->depth + 1, loop->depth);
 }
Index: dbus/dbus-server-socket.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-server-socket.c,v
retrieving revision 1.3
diff -u -r1.3 dbus-server-socket.c
--- dbus/dbus-server-socket.c	1 Oct 2006 15:36:18 -0000	1.3
+++ dbus/dbus-server-socket.c	8 Mar 2007 20:25:40 -0000
@@ -161,7 +161,7 @@
       int client_fd;
       int listen_fd;
       
-      listen_fd = dbus_watch_get_fd (watch);
+      listen_fd = dbus_watch_get_handle (watch);
 
       client_fd = _dbus_accept (listen_fd);
       
Index: dbus/dbus-spawn.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-spawn.c,v
retrieving revision 1.25
diff -u -r1.25 dbus-spawn.c
--- dbus/dbus-spawn.c	4 Mar 2007 19:14:03 -0000	1.25
+++ dbus/dbus-spawn.c	8 Mar 2007 20:25:40 -0000
@@ -720,7 +720,7 @@
   if (condition & DBUS_WATCH_HANGUP)
     revents |= _DBUS_POLLHUP;
 
-  fd = dbus_watch_get_fd (watch);
+  fd = dbus_watch_get_handle (watch);
 
   if (fd == sitter->error_pipe_from_child)
     handle_error_pipe (sitter, revents);
Index: dbus/dbus-sysdeps-util.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-util.c,v
retrieving revision 1.10
diff -u -r1.10 dbus-sysdeps-util.c
--- dbus/dbus-sysdeps-util.c	13 Dec 2006 01:18:07 -0000	1.10
+++ dbus/dbus-sysdeps-util.c	8 Mar 2007 20:25:41 -0000
@@ -82,7 +82,7 @@
   double val;
   int pos;
 
-#ifdef DBUS_WIN
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
   check_dirname ("foo\\bar", "foo");
   check_dirname ("foo\\\\bar", "foo");
   check_dirname ("foo/\\/bar", "foo");
@@ -141,6 +141,7 @@
       exit (1);
     }
 
+#ifndef DBUS_WIN_FIXME
   _dbus_string_init_const (&str, "0xff");
   if (!_dbus_string_parse_double (&str,
 				  0, &val, &pos))
@@ -158,6 +159,8 @@
       _dbus_warn ("_dbus_string_parse_double of \"0xff\" returned wrong position %d", pos);
       exit (1);
     }
+#endif
+
 #ifdef DBUS_WIN
   check_path_absolute ("c:/", TRUE);
   check_path_absolute ("c:/foo", TRUE);
Index: dbus/dbus-sysdeps.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.h,v
retrieving revision 1.69
diff -u -r1.69 dbus-sysdeps.h
--- dbus/dbus-sysdeps.h	8 Mar 2007 20:25:15 -0000	1.69
+++ dbus/dbus-sysdeps.h	8 Mar 2007 20:25:41 -0000
@@ -119,6 +119,7 @@
  * 
  */
 
+void        _dbus_daemon_release   (void);
 dbus_bool_t _dbus_open_tcp_socket  (int              *fd,
                                     DBusError        *error);
 dbus_bool_t _dbus_close_socket     (int               fd,
Index: dbus/dbus-threads.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-threads.c,v
retrieving revision 1.36
diff -u -r1.36 dbus-threads.c
--- dbus/dbus-threads.c	28 Oct 2006 01:41:37 -0000	1.36
+++ dbus/dbus-threads.c	8 Mar 2007 20:25:41 -0000
@@ -810,7 +810,11 @@
 dbus_bool_t
 _dbus_threads_init_debug (void)
 {
+#if defined(DBUS_WIN)
+  return _dbus_threads_init_platform_specific();
+#else
   return dbus_threads_init (&fake_functions);
+#endif
 }
 
 #endif /* DBUS_BUILD_TESTS */
Index: dbus/dbus-transport.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-transport.c,v
retrieving revision 1.54
diff -u -r1.54 dbus-transport.c
--- dbus/dbus-transport.c	17 Oct 2006 20:52:13 -0000	1.54
+++ dbus/dbus-transport.c	8 Mar 2007 20:25:42 -0000
@@ -674,7 +676,7 @@
   if (transport->disconnected)
     return TRUE;
 
-  if (dbus_watch_get_fd (watch) < 0)
+  if (dbus_watch_get_handle (watch) < 0)
     {
       _dbus_warn_check_failed ("Tried to handle an invalidated watch; this watch should have been removed\n");
       return TRUE;
Index: dbus/dbus-watch.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-watch.c,v
retrieving revision 1.22
diff -u -r1.22 dbus-watch.c
--- dbus/dbus-watch.c	21 Oct 2006 21:57:31 -0000	1.22
+++ dbus/dbus-watch.c	8 Mar 2007 20:25:42 -0000
@@ -286,7 +286,7 @@
             
             _dbus_verbose ("Adding a %s watch on fd %d using newly-set add watch function\n",
                            watch_type,
-                           dbus_watch_get_fd (link->data));
+                           dbus_watch_get_handle (link->data));
           }
 #endif /* DBUS_ENABLE_VERBOSE_MODE */
           
@@ -302,7 +302,7 @@
                                                              link2);
                   
                   _dbus_verbose ("Removing watch on fd %d using newly-set remove function because initial add failed\n",
-                                 dbus_watch_get_fd (link2->data));
+                                 dbus_watch_get_handle (link2->data));
                   
                   (* remove_function) (link2->data, data);
                   
@@ -359,7 +359,7 @@
   if (watch_list->add_watch_function != NULL)
     {
       _dbus_verbose ("Adding watch on fd %d\n",
-                     dbus_watch_get_fd (watch));
+                     dbus_watch_get_handle (watch));
       
       if (!(* watch_list->add_watch_function) (watch,
                                                watch_list->watch_data))
@@ -390,7 +390,7 @@
   if (watch_list->remove_watch_function != NULL)
     {
       _dbus_verbose ("Removing watch on fd %d\n",
-                     dbus_watch_get_fd (watch));
+                     dbus_watch_get_handle (watch));
       
       (* watch_list->remove_watch_function) (watch,
                                              watch_list->watch_data);
@@ -422,7 +422,7 @@
   if (watch_list->watch_toggled_function != NULL)
     {
       _dbus_verbose ("Toggling watch %p on fd %d to %d\n",
-                     watch, dbus_watch_get_fd (watch), watch->enabled);
+                     watch, dbus_watch_get_handle (watch), watch->enabled);
       
       (* watch_list->watch_toggled_function) (watch,
                                               watch_list->watch_data);
@@ -490,10 +490,32 @@
  * @returns the file descriptor to watch.
  */
 int
+dbus_watch_get_handle (DBusWatch *watch)
+{
+  return watch->fd;
+}
+
+#if defined(DBUS_WIN)
+// never used by the dbus code
+#include "dbus-sysdeps-win.h"
+int 
+dbus_watch_get_fd (DBusWatch *watch)
+{
+	DBusSocket *p;
+	if (watch->fd != -1) {
+	    _dbus_handle_to_socket(watch->fd,&p);
+	    return p->fd;
+	}
+	else
+		return -1;
+}
+#else
+int
 dbus_watch_get_fd (DBusWatch *watch)
 {
   return watch->fd;
 }
+#endif
 
 /**
  * Gets flags from DBusWatchFlags indicating
@@ -546,7 +568,7 @@
                      DBusFreeFunction  free_data_function)
 {
   _dbus_verbose ("Setting watch fd %d data to data = %p function = %p from data = %p function = %p\n",
-                 dbus_watch_get_fd (watch),
+                 dbus_watch_get_handle (watch),
                  data, free_data_function, watch->data, watch->free_data_function);
   
   if (watch->free_data_function != NULL)