dbus ChangeLog, 1.1232, 1.1233 README.win, NONE, 1.1 dbus-win.patch, NONE, 1.1

Ralf Habacker rhabacker at kemper.freedesktop.org
Sun Mar 4 14:27:35 PST 2007


Update of /cvs/dbus/dbus
In directory kemper:/tmp/cvs-serv7618

Modified Files:
	ChangeLog 
Added Files:
	README.win dbus-win.patch 
Log Message:
* dbus-win.patch, README.win: added available win32 
patches from windbus project (http://sf.net/projects/windbus)

Index: ChangeLog
===================================================================
RCS file: /cvs/dbus/dbus/ChangeLog,v
retrieving revision 1.1232
retrieving revision 1.1233
diff -u -d -r1.1232 -r1.1233
--- ChangeLog	4 Mar 2007 22:09:49 -0000	1.1232
+++ ChangeLog	4 Mar 2007 22:27:33 -0000	1.1233
@@ -1,5 +1,10 @@
 2007-03-04  Ralf Habacker  <ralf.habacker at freenet.de>
 
+	* dbus-win.patch, README.win: added available win32 
+	patches from windbus project (http://sf.net/projects/windbus)
+
+2007-03-04  Ralf Habacker  <ralf.habacker at freenet.de>
+
 	* bus/activation.c: (bus_activation_activate_service):
 	fixed call to _dbus_spawn_async_with_babysitter().
 
@@ -24,7 +29,7 @@
 
 	* dbus/*-win.*,bus/*-win.*: added win32 platform related
 	files. These files are only added to the cmake build system.  
-	The missing dbus-win32.patch file will be added later. 
+	The missing dbus-win.patch file will be added later. 
 
 2007-03-03  Ralf Habacker  <ralf.habacker at freenet.de>
 

--- NEW FILE: README.win ---
----------------------------------------
Windows port of the freedesktop.org D-Bus
----------------------------------------

Requirements 
------------
- cmake version >= 2.4.4 see http://www.cmake.org 
- installed libxml2 or libexpat 

Build
-----

unix
1. install cmake and libxml or libexpat 
2. get dbus sources 
3. mkdir dbus-build 
4. cd dbus-build 
5. cmake <dbus-src-root>/cmake or cmake -DDBUS_USE_EXPAT=on <dbus-src-root>/cmake in case libexpat should de used
5. make 
6. make install

win32
1. Install your prefered compiler
	- Mingw from www.mingw.org 
	- Visual C++ 2005 Express/Studio
2. Install win32libs packages from 
		http://www.abi-neuhaus.de/chris/win32libs/
   into a subdir win32libs in your program installation eg c:\Programme\win32libs (german) 
   or "c:\Program Files\win32libs" (english) 
3. download and install the most recent CMake version from http://www.cmake.org/files/
4. apply dbus-win.patch: 'patch -p0 -i dbus-win.patch'
5. open command shell and run in the created build folder which resides side by side 
   to the D-Bus sources:
   	- for mingw: 
		cmake -G "MinGW Makefiles" <options> ..\<dbus-source-root>\cmake
	- for Visual C++
		cmake ..\<dbus-source-root>\cmake
7. build


Tests
-----
(when build with the Visual C++ IDE the *.exe files are 
in the bin/Debug and bin/Release folder)

 - dbus library check 
		bin\dbus-test.exe .\test\data
	
 - bus daemon check 
		bin\bus-test.exe .\test\data

 - check available names 
		bin\test_names.exe 

 - check if dbus-daemon is accessable 
		bin\dbus-send.exe --session --type=method_call --print-reply --dest=org.freedesktop.DBus / org.freedesktop.DBus.ListNames method return sender=org.freedesktop.DBus -> dest=:1.4 array [ 	      string "org.freedesktop.DBus"string ":1.4"] 
		
 - start dbus-daemon
		* set DBUS_VERBOSE=0  (=1 for getting debug infos)
		* start bin\dbus-daemon --session
		* bin\dbus-send.exe  --dest=org.freedesktop.DBus --print-reply --type=method_call / org.freedesktop.DBus.StartServiceByName string:org.freedesktop.DBus.TestSuiteEchoService  uint32:455 method return sender=org.freedesktop.DBus -> dest=:1.8 uint32 2



Some build options
-------------
    key                        description                            default value
    ---                        -----------                            -------------
DBUS_USE_EXPAT              "Use expat (== ON) or libxml2 (==OFF)         OFF
DBUS_DISABLE_ASSERTS        "Disable assertion checking"                  OFF
DBUS_BUILD_TESTS            "enable unit test code"                       ON
DBUS_ENABLE_ANSI            "enable -ansi -pedantic gcc flags"            OFF
DBUS_ENABLE_GCOV            "compile with coverage profiling 
                             instrumentation (gcc only)"                  OFF
DBUS_ENABLE_VERBOSE_MODE    "support verbose debug mode"                  ON
DBUS_DISABLE_CHECKS         "Disable public API sanity checking"          OFF
DBUS_INSTALL_SYSTEM_LIBS    "install required system libraries 
                             (mingw: libxml2, libiconv, mingw10)"         OFF
CMAKE_BUILD_TYPE            "build type (== debug) or (== release)        release



Developers
----------

Running the tests in Visual Studio:

 To successfully run the tests by the IDE you must add
 the FULL patch to test\data in your build directory
 (e.g. c:\dbus\build\test\data)  
 in something like 
  -> Project Settings
    -> Debugging
       -> Command line arguments
    
    
       
FAQ
---

- How much work remains till DBUS win32 can be merged with the main project?

There are some patches outstanding and the most effort is required in
discussions with the main dbus team how to implement some parts. One of
the main dbus team estimated the open work to one fulltime week.
http://lists.freedesktop.org/archives/dbus/2006-November/006264.html

I assume they will answer ALL your questions, and they are very
interested in fully supporting win32.

- How far is WinDBus from being usable for production ?
dbus comes with a test suite which is used on unix to guarantate
production quality and this test suite runs mostly. There are some 
test not running and we need help to get them running.

In the pratice I and some other people are using dbus for at least more
than a half year in conjunction with kde on windows without any problems.


- On UNIX D-Bus uses UNIX sockets to communicate (correct me if I'm wrong). 
  What is used on Windows ?
  
tcp sockets, there are some efforts to get named pipe running, but some
design problems of the win32 api, we are not able to solve without
bigger changes to the dbus code base let us stop this effort.


- Do you have any clue if dbus-win32 can run in a Windows CE environment?

I was told that windows ce does not have posix function
open/close/select/... and dbus code uses such function in some area.


- Do you know if the C++ binding made by OpenWengo will be easily portable to Windows?

We have already ported the OpenWengo dbus-c++ binding, see in WinDBus svn  (http://sf.net/projects/windbus)
The related test applicationa are running well.


TODO
----

February 2007:

- all changes of dbus-win.patch should become part of the official D-Bus code
  
- all code currently disabled by DBUS_WIN_FIXME should work
  
- clean up:
    * bus/bus-service-win.c
    * bus/dir-watch.c
    * dbus/dbus-spawn-win.c
    * dbus/dbus-sysdeps-util-win.c
    * dbus/dbus-sysdeps-win.c


see also:
http://lists.freedesktop.org/archives/dbus/2006-July/005076.html

--- NEW FILE: dbus-win.patch ---
Index: bus/activation.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/activation.c,v
retrieving revision 1.49
diff -u -b -B -r1.49 activation.c
--- bus/activation.c	4 Mar 2007 22:09:50 -0000	1.49
+++ bus/activation.c	4 Mar 2007 22:11:26 -0000
@@ -34,7 +34,6 @@
 #include <dbus/dbus-spawn.h>
 #include <dbus/dbus-timeout.h>
 #include <dbus/dbus-sysdeps.h>
-#include <dirent.h>
 #include <errno.h>
 
 #define DBUS_SERVICE_SECTION "D-BUS Service"
Index: bus/bus.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.c,v
retrieving revision 1.74
diff -u -b -B -r1.74 bus.c
--- bus/bus.c	20 Dec 2006 06:18:19 -0000	1.74
+++ bus/bus.c	4 Mar 2007 22:11:26 -0000
@@ -625,7 +625,7 @@
         }
 
       bytes = _dbus_string_get_length (&addr);
-      if (_dbus_write_socket (print_addr_fd, &addr, 0, bytes) != bytes)
+      if (_dbus_write_pipe (print_addr_fd, &addr, 0, bytes) != bytes)
         {
           dbus_set_error (error, DBUS_ERROR_FAILED,
                           "Printing message bus address: %s\n",
@@ -726,7 +726,7 @@
         }
 
       bytes = _dbus_string_get_length (&pid);
-      if (_dbus_write_socket (print_pid_fd, &pid, 0, bytes) != bytes)
+      if (_dbus_write_pipe (print_pid_fd, &pid, 0, bytes) != bytes)
         {
           dbus_set_error (error, DBUS_ERROR_FAILED,
                           "Printing message bus PID: %s\n",
Index: bus/config-loader-libxml.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/config-loader-libxml.c,v
retrieving revision 1.8
diff -u -b -B -r1.8 config-loader-libxml.c
--- bus/config-loader-libxml.c	10 Aug 2004 03:06:59 -0000	1.8
+++ bus/config-loader-libxml.c	4 Mar 2007 22:11:26 -0000
@@ -134,6 +134,9 @@
     }
 }
 
+#ifdef DBUS_WIN
+  DBusString *_dbus_get_working_dir(void);
+#endif
 
 BusConfigParser*
 bus_config_load (const DBusString      *file,
@@ -147,7 +150,9 @@
   DBusString dirname, data;
   DBusError tmp_error;
   int ret;
-  
+#ifdef DBUS_WIN
+	DBusString *dbusdir;
+#endif
   _DBUS_ASSERT_ERROR_IS_CLEAR (error);
   
   parser = NULL;
@@ -177,13 +182,19 @@
       xmlSetGenericErrorFunc (NULL, xml_shut_up);
     }
 
+#ifdef DBUS_WIN
+  dbusdir = _dbus_get_working_dir();
+	if (dbusdir)
+  	parser = bus_config_parser_new (dbusdir, is_toplevel, parent);
+  else  
+#endif
   if (!_dbus_string_get_dirname (file, &dirname))
     {
       _DBUS_SET_OOM (error);
       goto failed;
     }
-  
   parser = bus_config_parser_new (&dirname, is_toplevel, parent);
+  
   if (parser == NULL)
     {
       _DBUS_SET_OOM (error);
Index: bus/config-parser.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/config-parser.c,v
retrieving revision 1.47
diff -u -b -B -r1.47 config-parser.c
--- bus/config-parser.c	26 Jan 2007 16:10:09 -0000	1.47
+++ bus/config-parser.c	4 Mar 2007 22:11:26 -0000
@@ -27,6 +27,7 @@
 #include "selinux.h"
 #include <dbus/dbus-list.h>
 #include <dbus/dbus-internals.h>
+#include <dbus/dbus-userdb.h>
 #include <string.h>
 
 typedef enum
@@ -3070,10 +3071,15 @@
 
 static const char *test_service_dir_matches[] = 
         {
+#ifdef DBUS_WIN
+         DBUS_DATADIR"/dbus-1/services",
+         NULL,
+#else
          "/testusr/testlocal/testshare/dbus-1/services",
          "/testusr/testshare/dbus-1/services",
          DBUS_DATADIR"/dbus-1/services",
          "/testhome/foo/.testlocal/testshare/dbus-1/services",         
+#endif 
          NULL
         };
 
@@ -3082,11 +3088,32 @@
 {
   DBusList *dirs;
   DBusList *link;
+  DBusString progs;
+  const char *common_progs;
   int i;
 
+  common_progs = _dbus_getenv ("CommonProgramFiles");
+  if (common_progs) 
+    {
+      if (!_dbus_string_init (&progs))
+        return FALSE;
+
+      if (!_dbus_string_append (&progs, common_progs)) 
+        {
+          _dbus_string_free (&progs);
+          return FALSE;
+        }
+
+      if (!_dbus_string_append (&progs, "/dbus-1/services")) 
+        {
+          _dbus_string_free (&progs);
+          return FALSE;
+        }
+      test_service_dir_matches[1] = _dbus_string_get_const_data(&progs);
+    }
   dirs = NULL;
 
-  printf ("Testing retriving the default session service directories\n");
+  printf ("Testing retrieving the default session service directories\n");
   if (!_dbus_get_standard_session_servicedirs (&dirs))
     _dbus_assert_not_reached ("couldn't get stardard dirs");
 
@@ -3097,7 +3124,7 @@
       
       printf ("    default service dir: %s\n", (char *)link->data);
       _dbus_string_init_const (&path, (char *)link->data);
-      if (!_dbus_string_ends_with_c_str (&path, "share/dbus-1/services"))
+      if (!_dbus_string_ends_with_c_str (&path, "dbus-1/services"))
         {
           printf ("error with default session service directories\n");
           return FALSE;
@@ -3150,6 +3177,7 @@
       return FALSE;
     }
     
+  _dbus_string_free (&progs);
   return TRUE;
 }
 			   
Index: bus/connection.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/connection.c,v
retrieving revision 1.66
diff -u -b -B -r1.66 connection.c
--- bus/connection.c	12 Dec 2006 21:24:07 -0000	1.66
+++ bus/connection.c	4 Mar 2007 22:11:26 -0000
@@ -1536,7 +1536,7 @@
 {
   CancelPendingReplyData *d = data;
 
-  _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
+  _dbus_verbose_C_S ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
   
   if (!_dbus_list_remove (&d->connections->pending_replies->items,
                           d->pending))
@@ -1550,7 +1550,7 @@
 {
   CancelPendingReplyData *d = data;
 
-  _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
+  _dbus_verbose_C_S ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
   
   /* d->pending should be either freed or still
    * in the list of pending replies (owned by someone
@@ -1687,7 +1687,7 @@
 {
   CheckPendingReplyData *d = data;
 
-  _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
+  _dbus_verbose_C_S ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
   
   _dbus_list_prepend_link (&d->connections->pending_replies->items,
                            d->link);
@@ -1699,7 +1699,7 @@
 {
   CheckPendingReplyData *d = data;
 
-  _dbus_verbose ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
+  _dbus_verbose_C_S ("%s: d = %p\n", _DBUS_FUNCTION_NAME, d);
   
   if (d->link != NULL)
     {
Index: bus/dispatch.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/dispatch.c,v
retrieving revision 1.78
diff -u -b -B -r1.78 dispatch.c
--- bus/dispatch.c	23 Oct 2006 17:25:52 -0000	1.78
+++ bus/dispatch.c	4 Mar 2007 22:11:27 -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);
 }
 
@@ -2624,6 +2642,11 @@
   const char *segv_service;
   dbus_uint32_t flags;
   
+  _dbus_warn("TODO: dispatch.c: check_segfault_service_no_auto_start\n");
+#ifndef DBUS_WIN_FIXME
+  return TRUE;
+#endif
+
   message = dbus_message_new_method_call (DBUS_SERVICE_DBUS,
                                           DBUS_PATH_DBUS,
                                           DBUS_INTERFACE_DBUS,
@@ -2698,9 +2721,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
@@ -4062,14 +4088,20 @@
       _dbus_assert_not_reached ("initial connection setup failed");
     }
   
+  _dbus_warn("TODO: dispatch.c create_and_hello test\n");
+#ifndef DBUS_WIN_FIXME  
   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);
 
+  _dbus_warn("TODO: dispatch.c segfault_service_no_auto_start test\n");
+#ifndef DBUS_WIN_FIXME
   check2_try_iterations (context, foo, "segfault_service_no_auto_start",
                          check_segfault_service_no_auto_start);
+#endif
   
   check2_try_iterations (context, foo, "existent_service_no_auto_start",
                          check_existent_service_no_auto_start);
@@ -4077,8 +4109,12 @@
   check2_try_iterations (context, foo, "nonexistent_service_auto_start",
                          check_nonexistent_service_auto_start);
   
+
+  _dbus_warn("TODO: dispatch.c segfault_service_auto_start test\n");
+#ifndef DBUS_WIN_FIXME    
   check2_try_iterations (context, foo, "segfault_service_auto_start",
                          check_segfault_service_auto_start);
+#endif
 
   check2_try_iterations (context, foo, "shell_fail_service_auto_start",
                          check_shell_fail_service_auto_start);
@@ -4095,8 +4131,11 @@
   if (!check_existent_service_auto_start (context, foo))
     _dbus_assert_not_reached ("existent service auto start failed");
 
+  _dbus_warn("TODO: dispatch.c check_shell_service_success_auto_start test\n");
+#ifndef DBUS_WIN_FIXME  
   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");
 
@@ -4147,8 +4186,11 @@
       _dbus_assert_not_reached ("initial connection setup failed");
     }
   
+  _dbus_warn("TODO: dispatch.c: create_and_hello_sha1 test\n");
+#ifndef DBUS_WIN_FIXME  
   check1_try_iterations (context, "create_and_hello_sha1",
                          check_hello_connection);
+#endif
 
   kill_client_connection_unchecked (foo);
 
Index: bus/main.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/main.c,v
retrieving revision 1.36
diff -u -b -B -r1.36 main.c
--- bus/main.c	20 Dec 2006 06:18:19 -0000	1.36
+++ bus/main.c	4 Mar 2007 22:11:28 -0000
@@ -254,6 +254,12 @@
   dbus_bool_t print_pid;
   int force_fork;
 
+#ifdef _WIN32
+	extern int _dbus_init_working_dir(char *s);
+	if (!_dbus_init_working_dir(argv[0]))
+		return 1;
+#endif
+
   if (!_dbus_string_init (&config_file))
     return 1;
 
Index: bus/policy.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/policy.c,v
retrieving revision 1.24
diff -u -b -B -r1.24 policy.c
--- bus/policy.c	12 Dec 2006 21:24:07 -0000	1.24
+++ bus/policy.c	4 Mar 2007 22:11:28 -0000
@@ -324,9 +324,13 @@
 
   if (!dbus_connection_get_unix_user (connection, &uid))
     {
+#ifdef DBUS_WIN
+		_dbus_verbose ("policy.c: dbus_connection_get_unix_user check disabled under windows\n");
+#else
       dbus_set_error (error, DBUS_ERROR_FAILED,
                       "No user ID known for connection, cannot determine security policy\n");
       goto failed;
+#endif
     }
 
   if (_dbus_hash_table_get_n_entries (policy->rules_by_uid) > 0)
Index: dbus/dbus-bus.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-bus.c,v
retrieving revision 1.64
diff -u -b -B -r1.64 dbus-bus.c
--- dbus/dbus-bus.c	28 Oct 2006 01:41:37 -0000	1.64
+++ dbus/dbus-bus.c	4 Mar 2007 22:11:28 -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 -b -B -r1.154 dbus-connection.c
--- dbus/dbus-connection.c	15 Nov 2006 03:07:59 -0000	1.154
+++ dbus/dbus-connection.c	4 Mar 2007 22:11:28 -0000
@@ -62,7 +62,7 @@
 #define TRACE_LOCKS 1
 
 #define CONNECTION_LOCK(connection)   do {                                      \
-    if (TRACE_LOCKS) { _dbus_verbose ("  LOCK: %s\n", _DBUS_FUNCTION_NAME); }   \
+    if (TRACE_LOCKS) { _dbus_verbose ("  LOCK  : %s\n", _DBUS_FUNCTION_NAME); }   \
     _dbus_mutex_lock ((connection)->mutex);                                      \
     TOOK_LOCK_CHECK (connection);                                               \
   } while (0)
@@ -4718,9 +4718,9 @@
   _dbus_return_val_if_fail (connection != NULL, FALSE);
   _dbus_return_val_if_fail (connection->transport != NULL, FALSE);
 
-#ifdef DBUS_WIN
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
   /* FIXME do this on a lower level */
-  return FALSE;
+  //return FALSE;
 #endif
   
   return dbus_connection_get_socket(connection, fd);
@@ -4790,12 +4790,12 @@
   _dbus_return_val_if_fail (connection != NULL, FALSE);
   _dbus_return_val_if_fail (uid != NULL, FALSE);
 
-#ifdef DBUS_WIN
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
   /* 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;
+  //return FALSE;
 #endif
   
   CONNECTION_LOCK (connection);
@@ -4829,12 +4829,12 @@
   _dbus_return_val_if_fail (connection != NULL, FALSE);
   _dbus_return_val_if_fail (pid != NULL, FALSE);
 
-#ifdef DBUS_WIN
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
   /* 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;
+  //return FALSE;
 #endif
   
   CONNECTION_LOCK (connection);
Index: dbus/dbus-connection.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.h,v
retrieving revision 1.49
diff -u -b -B -r1.49 dbus-connection.h
--- dbus/dbus-connection.h	15 Nov 2006 03:07:59 -0000	1.49
+++ dbus/dbus-connection.h	4 Mar 2007 22:11:28 -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-internals.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-internals.c,v
retrieving revision 1.55
diff -u -b -B -r1.55 dbus-internals.c
--- dbus/dbus-internals.c	15 Nov 2006 01:52:01 -0000	1.55
+++ dbus/dbus-internals.c	4 Mar 2007 22:11:28 -0000
@@ -295,7 +295,7 @@
 #include <pthread.h>
 #endif
 
-static inline void
+static void
 _dbus_verbose_init (void)
 {
   if (!verbose_initted)
Index: dbus/dbus-mainloop.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-mainloop.c,v
retrieving revision 1.19
diff -u -b -B -r1.19 dbus-mainloop.c
--- dbus/dbus-mainloop.c	20 Oct 2006 03:04:59 -0000	1.19
+++ dbus/dbus-mainloop.c	4 Mar 2007 22:11:28 -0000
@@ -90,8 +90,8 @@
   Callback callback;
   DBusTimeout *timeout;
   DBusTimeoutFunction function;
-  unsigned long last_tv_sec;
-  unsigned long last_tv_usec;
+  long last_tv_sec;
+  long last_tv_usec;
 } TimeoutCallback;
 
 #define WATCH_CALLBACK(callback)   ((WatchCallback*)callback)
@@ -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
             }
@@ -640,8 +640,8 @@
   timeout = -1;
   if (loop->timeout_count > 0)
     {
-      unsigned long tv_sec;
-      unsigned long tv_usec;
+      long tv_sec;
+      long tv_usec;
       
       _dbus_get_current_time (&tv_sec, &tv_usec);
           
@@ -710,8 +710,8 @@
 
   if (loop->timeout_count > 0)
     {
-      unsigned long tv_sec;
-      unsigned long tv_usec;
+      long tv_sec;
+      long tv_usec;
 
       _dbus_get_current_time (&tv_sec, &tv_usec);
 
@@ -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-message.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-message.h,v
retrieving revision 1.65
diff -u -b -B -r1.65 dbus-message.h
--- dbus/dbus-message.h	21 Oct 2006 18:51:30 -0000	1.65
+++ dbus/dbus-message.h	4 Mar 2007 22:11:28 -0000
@@ -34,6 +34,10 @@
 #include <dbus/dbus-errors.h>
 #include <stdarg.h>
 
+#ifdef DBUS_WINCE
+#undef interface
+#endif
+
 DBUS_BEGIN_DECLS
 
 /**
Index: dbus/dbus-server-protected.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-server-protected.h,v
retrieving revision 1.23
diff -u -b -B -r1.23 dbus-server-protected.h
--- dbus/dbus-server-protected.h	1 Oct 2006 03:18:47 -0000	1.23
+++ dbus/dbus-server-protected.h	4 Mar 2007 22:11:28 -0000
@@ -144,7 +144,7 @@
 #define TRACE_LOCKS 0
 
 #define SERVER_LOCK(server)   do {                                              \
-    if (TRACE_LOCKS) { _dbus_verbose ("  LOCK: %s\n", _DBUS_FUNCTION_NAME); }   \
+    if (TRACE_LOCKS) { _dbus_verbose ("  LOCK  : %s\n", _DBUS_FUNCTION_NAME); }   \
     _dbus_mutex_lock ((server)->mutex);                                          \
     TOOK_LOCK_CHECK (server);                                                   \
   } while (0)
Index: dbus/dbus-server-socket.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-server-socket.c,v
retrieving revision 1.3
diff -u -b -B -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	4 Mar 2007 22:11:28 -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);
       
@@ -393,15 +393,19 @@
           
       if (port == NULL)
         {
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
+          port = "0";
+#else
           _dbus_set_bad_address(error, "tcp", "port", NULL);
           return DBUS_SERVER_LISTEN_BAD_ADDRESS;
+#endif
         }
 
       _dbus_string_init_const (&str, port);
       sresult = _dbus_string_parse_int (&str, 0, &lport, NULL);
       _dbus_string_free (&str);
           
-      if (sresult == FALSE || lport <= 0 || lport > 65535)
+      if (sresult == FALSE || lport < 0 || lport > 65535)
         {
           _dbus_set_bad_address(error, NULL, NULL, 
                                 "Port is not an integer between 0 and 65535");
Index: dbus/dbus-server-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-server-unix.c,v
retrieving revision 1.34
diff -u -b -B -r1.34 dbus-server-unix.c
--- dbus/dbus-server-unix.c	20 Oct 2006 03:04:59 -0000	1.34
+++ dbus/dbus-server-unix.c	4 Mar 2007 22:11:28 -0000
@@ -24,9 +24,9 @@
 #include "dbus-internals.h"
 #include "dbus-server-unix.h"
 #include "dbus-server-socket.h"
-#include "dbus-transport-unix.h"
+#include "dbus-transport.h"
 #include "dbus-connection-internal.h"
-#include "dbus-sysdeps-unix.h"
+#include "dbus-sysdeps-win.h"
 #include "dbus-string.h"
 
 /**
@@ -155,6 +155,8 @@
     }
 }
 
+#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
+
 /**
  * Creates a new server listening on the given Unix domain socket.
  *
@@ -232,5 +234,86 @@
   return NULL;
 }
 
+
+#else /* ifndef DBUS_WIN */
+
+// FIXME: move to dbus-serevrwin.c
+
+ /**
+ * Creates a new server listening on the given Windows named pipe.
+ *
+ * @param path the path for the domain socket.
+ * @param abstract #TRUE to use abstract socket namespace
+ * @param error location to store reason for failure.
+ * @returns the new server, or #NULL on failure.
+ */
+DBusServer*
+_dbus_server_new_for_domain_socket (const char     *path,
+                                    dbus_bool_t     abstract,
+                                    DBusError      *error)
+{
+  DBusServer *server;
+  int listen_fd;
+  DBusString address;
+  char *path_copy;
+  
+  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
+
+  if (!_dbus_string_init (&address))
+    {
+      _DBUS_SET_OOM (error);
+      return NULL;
+    }
+
+  if ((abstract &&
+       !_dbus_string_append (&address, "unix:abstract=")) ||
+      (!abstract &&
+       !_dbus_string_append (&address, "unix:path=")) ||
+      !_dbus_string_append (&address, path))
+    {
+      _DBUS_SET_OOM (error);
+      goto failed_0;
+    }
+
+  path_copy = _dbus_strdup (path);
+  if (path_copy == NULL)
+    {
+      _DBUS_SET_OOM (error);
+      goto failed_0;
+    }
+  
+  listen_fd = _dbus_listen_unix_socket (path, abstract, error);
+  
+  if (listen_fd < 0)
+    {
+      _DBUS_ASSERT_ERROR_IS_SET (error);
+      goto failed_1;
+    }
+  
+  _dbus_fd_set_close_on_exec (listen_fd);
+  server = _dbus_server_new_for_socket (listen_fd, &address);
+  if (server == NULL)
+    {
+      _DBUS_SET_OOM (error);
+      goto failed_2;
+    }
+
+  _dbus_server_socket_own_filename(server, path_copy);
+
+  _dbus_string_free (&address);
+  
+  return server;
+
+ failed_2:
+  _dbus_close_socket (listen_fd, NULL);
+ failed_1:
+  dbus_free (path_copy);
+ failed_0:
+  _dbus_string_free (&address);
+
+  return NULL;
+}
+
+#endif //DBUS_WIN
 /** @} */
 
Index: dbus/dbus-spawn.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-spawn.c,v
retrieving revision 1.25
diff -u -b -B -r1.25 dbus-spawn.c
--- dbus/dbus-spawn.c	4 Mar 2007 19:14:03 -0000	1.25
+++ dbus/dbus-spawn.c	4 Mar 2007 22:11:28 -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-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-unix.c,v
retrieving revision 1.19
diff -u -b -B -r1.19 dbus-sysdeps-unix.c
--- dbus/dbus-sysdeps-unix.c	3 Mar 2007 10:36:45 -0000	1.19
+++ dbus/dbus-sysdeps-unix.c	4 Mar 2007 22:11:29 -0000
@@ -169,6 +169,15 @@
   return _dbus_write (fd, buffer, start, len);
 }
 
+int
+_dbus_write_pipe (DBusStream        pipe,
+                  const DBusString *buffer,
+                  int               start,
+                  int               len)
+{
+	return _dbus_write (pipe, buffer, start, len);
+}
+
 /**
  * Like _dbus_write_two() but only works on sockets and is thus
  * available on Windows.
@@ -1493,6 +1502,53 @@
 #endif
 }
 
+/**
+ * Atomically increments an integer
+ *
+ * @param atomic pointer to the integer to increment
+ * @returns the value before incrementing
+ *
+ * @todo implement arch-specific faster atomic ops
+ */
+dbus_int32_t
+_dbus_atomic_inc (DBusAtomic *atomic)
+{
+#ifdef DBUS_USE_ATOMIC_INT_486
+  return atomic_exchange_and_add (atomic, 1);
+#else
+  dbus_int32_t res;
+  _DBUS_LOCK (atomic);
+  res = atomic->value;
+  atomic->value += 1;
+  _DBUS_UNLOCK (atomic);
+  return res;
+#endif
+}
+
+/**
+ * Atomically decrement an integer
+ *
+ * @param atomic pointer to the integer to decrement
+ * @returns the value before decrementing
+ *
+ * @todo implement arch-specific faster atomic ops
+ */
+dbus_int32_t
+_dbus_atomic_dec (DBusAtomic *atomic)
+{
+#ifdef DBUS_USE_ATOMIC_INT_486
+  return atomic_exchange_and_add (atomic, -1);
+#else
+  dbus_int32_t res;
+  
+  _DBUS_LOCK (atomic);
+  res = atomic->value;
+  atomic->value -= 1;
+  _DBUS_UNLOCK (atomic);
+  return res;
+#endif
+}
+
 #ifdef DBUS_BUILD_TESTS
 /** Gets our GID
  * @returns process GID
@@ -2840,4 +2896,9 @@
   return FALSE;
 }
 
+// non empty implementation in the Windows code
+void _dbus_daemon_release()
+{
+}
+
 /* tests in dbus-sysdeps-util.c */
Index: dbus/dbus-sysdeps-util.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps-util.c,v
retrieving revision 1.10
diff -u -b -B -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	4 Mar 2007 22:11:29 -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.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.c,v
retrieving revision 1.120
diff -u -b -B -r1.120 dbus-sysdeps.c
--- dbus/dbus-sysdeps.c	1 Jan 2007 21:29:59 -0000	1.120
+++ dbus/dbus-sysdeps.c	4 Mar 2007 22:11:29 -0000
@@ -119,11 +119,14 @@
        * will get upset about.
        */
       
-      putenv_value = malloc (len + 1);
+      putenv_value = malloc (len + 2);
       if (putenv_value == NULL)
         return FALSE;
 
       strcpy (putenv_value, varname);
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
+      strcat (putenv_value, "=");
+#endif
       
       return (putenv (putenv_value) == 0);
 #endif
@@ -413,6 +416,10 @@
 ascii_strtod (const char *nptr,
 	      char      **endptr)
 {
+  /* FIXME: The Win32 C library's strtod() doesn't handle hex.
+   * Presumably many Unixes don't either.
+   */
+
   char *fail_pos;
   double val;
   struct lconv *locale_data;
Index: dbus/dbus-sysdeps.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-sysdeps.h,v
retrieving revision 1.68
diff -u -b -B -r1.68 dbus-sysdeps.h
--- dbus/dbus-sysdeps.h	31 Dec 2006 12:16:04 -0000	1.68
+++ dbus/dbus-sysdeps.h	4 Mar 2007 22:11:29 -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,
@@ -229,7 +230,7 @@
  */
 struct DBusAtomic
 {
-#ifdef DBUS_WIN
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
   volatile long value; /**< Value of the atomic integer. */
 #else
   volatile dbus_int32_t value; /**< Value of the atomic integer. */
@@ -302,6 +303,12 @@
 
 dbus_bool_t _dbus_get_standard_session_servicedirs (DBusList **dirs);
 
+typedef int DBusPipe;
+int _dbus_write_pipe (DBusPipe          pipe,
+                      const DBusString *buffer,
+                      int               start,
+                      int               len);
+
 /** Opaque type for reading a directory listing */
 typedef struct DBusDirIter DBusDirIter;
 
@@ -317,6 +324,9 @@
 
 void _dbus_fd_set_close_on_exec (int fd);
 
+int _dbus_mkdir    (const char *path,
+                    mode_t mode);
+
 const char* _dbus_get_tmpdir      (void);
 
 /**
Index: dbus/dbus-test.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-test.c,v
retrieving revision 1.44
diff -u -b -B -r1.44 dbus-test.c
--- dbus/dbus-test.c	15 Nov 2006 03:07:59 -0000	1.44
+++ dbus/dbus-test.c	4 Mar 2007 22:11:29 -0000
@@ -156,7 +156,9 @@
   
   run_test ("hash", specific_test, _dbus_hash_test);
 
+#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
   run_data_test ("spawn", specific_test, _dbus_spawn_test, test_data_dir);
+#endif
   
   run_data_test ("userdb", specific_test, _dbus_userdb_test, test_data_dir);
   
Index: dbus/dbus-threads.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-threads.c,v
retrieving revision 1.36
diff -u -b -B -r1.36 dbus-threads.c
--- dbus/dbus-threads.c	28 Oct 2006 01:41:37 -0000	1.36
+++ dbus/dbus-threads.c	4 Mar 2007 22:11:29 -0000
@@ -810,7 +810,11 @@
 dbus_bool_t
 _dbus_threads_init_debug (void)
 {
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
+  return _dbus_threads_init_platform_specific();
+#else
   return dbus_threads_init (&fake_functions);
+#endif
 }
 
 #endif /* DBUS_BUILD_TESTS */
Index: dbus/dbus-transport-socket.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-transport-socket.c,v
retrieving revision 1.4
diff -u -b -B -r1.4 dbus-transport-socket.c
--- dbus/dbus-transport-socket.c	20 Oct 2006 03:05:00 -0000	1.4
+++ dbus/dbus-transport-socket.c	4 Mar 2007 22:11:29 -0000
@@ -175,7 +175,7 @@
   DBusTransportSocket *socket_transport = (DBusTransportSocket*) transport;
   dbus_bool_t need_read_watch;
 
-  _dbus_verbose ("%s: fd = %d\n",
+  _dbus_verbose (" %s: fd = %d\n",
                  _DBUS_FUNCTION_NAME, socket_transport->fd);
   
   if (transport->connection == NULL)
@@ -652,7 +652,7 @@
   int total;
   dbus_bool_t oom;
 
-  _dbus_verbose ("%s: fd = %d\n", _DBUS_FUNCTION_NAME,
+  _dbus_verbose (" %s: fd = %d\n", _DBUS_FUNCTION_NAME,
                  socket_transport->fd);
   
   /* No messages without authentication! */
@@ -873,7 +873,7 @@
                        flags);
       else
         _dbus_verbose ("asked to handle watch %p on fd %d that we don't recognize\n",
-                       watch, dbus_watch_get_fd (watch));
+                       watch, dbus_watch_get_handle (watch));
     }
 #endif /* DBUS_ENABLE_VERBOSE_MODE */
 
@@ -1286,15 +1286,19 @@
           
       if (port == NULL)
         {
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
+          port = "0";
+#else
           _dbus_set_bad_address (error, "tcp", "port", NULL);
           return DBUS_TRANSPORT_OPEN_BAD_ADDRESS;
+#endif
         }
 
       _dbus_string_init_const (&str, port);
       sresult = _dbus_string_parse_int (&str, 0, &lport, NULL);
       _dbus_string_free (&str);
           
-      if (sresult == FALSE || lport <= 0 || lport > 65535)
+      if (sresult == FALSE || lport < 0 || lport > 65535)
         {
           _dbus_set_bad_address (error, NULL, NULL,
                                  "Port is not an integer between 0 and 65535");
Index: dbus/dbus-transport-socket.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-transport-socket.h,v
retrieving revision 1.2
diff -u -b -B -r1.2 dbus-transport-socket.h
--- dbus/dbus-transport-socket.h	16 Sep 2006 19:24:08 -0000	1.2
+++ dbus/dbus-transport-socket.h	4 Mar 2007 22:11:29 -0000
@@ -25,6 +25,10 @@
 
 #include <dbus/dbus-transport-protected.h>
 
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
+#include <dbus/dbus-sockets-win.h>
+#endif
+
 DBUS_BEGIN_DECLS
 
 DBusTransport*          _dbus_transport_new_for_socket     (int                fd,
Index: dbus/dbus-transport-unix.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-transport-unix.c,v
retrieving revision 1.55
diff -u -b -B -r1.55 dbus-transport-unix.c
--- dbus/dbus-transport-unix.c	20 Oct 2006 03:05:00 -0000	1.55
+++ dbus/dbus-transport-unix.c	4 Mar 2007 22:11:29 -0000
@@ -23,11 +23,16 @@
 
 #include "dbus-internals.h"
 #include "dbus-connection-internal.h"
-#include "dbus-transport-unix.h"
 #include "dbus-transport-socket.h"
 #include "dbus-transport-protected.h"
 #include "dbus-watch.h"
+
+#if !defined(DBUS_WIN) && !defined(DBUS_WINCE)
+#include "dbus-transport-unix.h"
 #include "dbus-sysdeps-unix.h"
+#else
+#include "dbus-sysdeps-win.h"
+#endif
 
 /**
  * @defgroup DBusTransportUnix DBusTransport implementations for UNIX
Index: dbus/dbus-transport.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-transport.c,v
retrieving revision 1.54
diff -u -b -B -r1.54 dbus-transport.c
--- dbus/dbus-transport.c	17 Oct 2006 20:52:13 -0000	1.54
+++ dbus/dbus-transport.c	4 Mar 2007 22:11:29 -0000
@@ -496,7 +496,7 @@
    * set it and have it only be invoked when appropriate.
    */
   dbus_bool_t on_windows = FALSE;
-#ifdef DBUS_WIN
+#if defined(DBUS_WIN) || defined(DBUS_WINCE)
   on_windows = TRUE;
 #endif
   
@@ -674,7 +674,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 -b -B -r1.22 dbus-watch.c
--- dbus/dbus-watch.c	21 Oct 2006 21:57:31 -0000	1.22
+++ dbus/dbus-watch.c	4 Mar 2007 22:11:29 -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) || defined(DBUS_WINCE)
+// 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)
Index: test/test-segfault.c
===================================================================
RCS file: /cvs/dbus/dbus/test/test-segfault.c,v
retrieving revision 1.4
diff -u -b -B -r1.4 test-segfault.c
--- test/test-segfault.c	30 Nov 2005 19:32:26 -0000	1.4
+++ test/test-segfault.c	4 Mar 2007 22:11:31 -0000
@@ -1,9 +1,26 @@
 /* This is simply a process that segfaults */
+#include <config.h>
 #include <stdlib.h>
 #include <signal.h>
 
+#ifdef DBUS_WIN
+#define RLIMIT_CORE	4		/* max core file size */
+typedef unsigned long rlim_t;
+struct rlimit {
+	rlim_t	rlim_cur;
+	rlim_t	rlim_max;
+};
+static int getrlimit (int __resource, struct rlimit *__rlp) {
+  return -1;
+}
+static int setrlimit (int __resource, const struct rlimit *__rlp) {
+  return -1;
+}
+#else
 #include <sys/time.h>
 #include <sys/resource.h>
+#endif
+
 
 int
 main (int argc, char **argv)
Index: test/test-utils.c
===================================================================
RCS file: /cvs/dbus/dbus/test/test-utils.c,v
retrieving revision 1.8
diff -u -b -B -r1.8 test-utils.c
--- test/test-utils.c	1 Oct 2006 15:36:18 -0000	1.8
+++ test/test-utils.c	4 Mar 2007 22:11:31 -0000
@@ -1,5 +1,7 @@
 #include "test-utils.h"
 
+void _dbus_connection_close_internal (DBusConnection *connection);
+
 typedef struct
 {
   DBusLoop *loop;



More information about the dbus-commit mailing list