dbus/bus bus.c, 1.75, 1.76 bus.h, 1.28, 1.29 main.c, 1.36, 1.37 test.c, 1.26, 1.27

Ralf Habacker rhabacker at kemper.freedesktop.org
Sat Mar 10 01:10:39 PST 2007


Update of /cvs/dbus/dbus/bus
In directory kemper:/tmp/cvs-serv3846/bus

Modified Files:
	bus.c bus.h main.c test.c 
Log Message:
* bus/bus.c, bus/bus.h, bus/main.c, bus/test.c, dbus/dbus-sysdeps-unix.c, dbus/dbus-sysdeps-util-unix.c, dbus/dbus-sysdeps-util-win.c, bus/dbus-sysdeps-win.c,dbus/dbus-sysdeps.h: renamed _dbus_xxx_pipe to _dbus_pipe_xxx, completed _dbus_pipe support.

Index: bus.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.c,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- bus.c	8 Mar 2007 20:25:15 -0000	1.75
+++ bus.c	10 Mar 2007 09:10:36 -0000	1.76
@@ -527,8 +527,8 @@
 BusContext*
 bus_context_new (const DBusString *config_file,
                  ForceForkSetting  force_fork,
-                 int               print_addr_fd,
-                 int               print_pid_fd,
+                 DBusPipe          print_addr_fd,
+                 DBusPipe          print_pid_fd,
                  DBusError        *error)
 {
   BusContext *context;
@@ -603,7 +603,7 @@
    * other random thing. But I think the answer is "don't do
    * that then"
    */
-  if (print_addr_fd >= 0)
+  if (_dbus_pipe_is_valid(print_addr_fd))
     {
       DBusString addr;
       const char *a = bus_context_get_address (context);
@@ -625,7 +625,7 @@
         }
 
       bytes = _dbus_string_get_length (&addr);
-      if (_dbus_write_pipe (print_addr_fd, &addr, 0, bytes) != bytes)
+      if (_dbus_pipe_write(print_addr_fd, &addr, 0, bytes) != bytes)
         {
           dbus_set_error (error, DBUS_ERROR_FAILED,
                           "Printing message bus address: %s\n",
@@ -634,8 +634,8 @@
           goto failed;
         }
 
-      if (print_addr_fd > 2)
-        _dbus_close_socket (print_addr_fd, NULL);
+      if (_dbus_pipe_is_special(print_addr_fd))
+        _dbus_pipe_close(print_addr_fd, NULL);
 
       _dbus_string_free (&addr);
     }
@@ -706,7 +706,7 @@
     }
 
   /* Write PID if requested */
-  if (print_pid_fd >= 0)
+  if (_dbus_pipe_is_valid(print_pid_fd))
     {
       DBusString pid;
       int bytes;
@@ -726,7 +726,7 @@
         }
 
       bytes = _dbus_string_get_length (&pid);
-      if (_dbus_write_pipe (print_pid_fd, &pid, 0, bytes) != bytes)
+      if (_dbus_pipe_write (print_pid_fd, &pid, 0, bytes) != bytes)
         {
           dbus_set_error (error, DBUS_ERROR_FAILED,
                           "Printing message bus PID: %s\n",
@@ -735,8 +735,8 @@
           goto failed;
         }
 
-      if (print_pid_fd > 2)
-        _dbus_close_socket (print_pid_fd, NULL);
+      if (_dbus_pipe_is_special (print_pid_fd))
+        _dbus_pipe_close (print_pid_fd, NULL);
       
       _dbus_string_free (&pid);
     }

Index: bus.h
===================================================================
RCS file: /cvs/dbus/dbus/bus/bus.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- bus.h	12 Dec 2006 21:24:07 -0000	1.28
+++ bus.h	10 Mar 2007 09:10:36 -0000	1.29
@@ -70,8 +70,8 @@
 
 BusContext*       bus_context_new                                (const DBusString *config_file,
                                                                   ForceForkSetting  force_fork,
-                                                                  int               print_addr_fd,
-                                                                  int               print_pid_fd,
+                                                                  DBusPipe         print_addr_fd,
+                                                                  DBusPipe         print_pid_fd,
                                                                   DBusError        *error);
 dbus_bool_t       bus_context_reload_config                      (BusContext       *context,
 								  DBusError        *error);

Index: main.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/main.c,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- main.c	20 Dec 2006 06:18:19 -0000	1.36
+++ main.c	10 Mar 2007 09:10:36 -0000	1.37
@@ -247,8 +247,8 @@
   DBusString addr_fd;
   DBusString pid_fd;
   const char *prev_arg;
-  int print_addr_fd;
-  int print_pid_fd;
+  DBusPipe print_addr_fd;
+  DBusPipe print_pid_fd;
   int i;
   dbus_bool_t print_address;
   dbus_bool_t print_pid;
@@ -387,10 +387,10 @@
       usage ();
     }
 
-  print_addr_fd = -1;
+  print_addr_fd = _dbus_pipe_init(-1);
   if (print_address)
     {
-      print_addr_fd = 1; /* stdout */
+      print_addr_fd = _dbus_pipe_init(1); /* stdout */
       if (_dbus_string_get_length (&addr_fd) > 0)
         {
           long val;
@@ -404,15 +404,15 @@
               exit (1);
             }
 
-          print_addr_fd = val;
+          print_addr_fd = _dbus_pipe_init(val);
         }
     }
   _dbus_string_free (&addr_fd);
 
-  print_pid_fd = -1;
+  print_pid_fd = _dbus_pipe_init(-1);
   if (print_pid)
     {
-      print_pid_fd = 1; /* stdout */
+      print_pid_fd = _dbus_pipe_init(1); /* stdout */
       if (_dbus_string_get_length (&pid_fd) > 0)
         {
           long val;
@@ -426,7 +426,7 @@
               exit (1);
             }
 
-          print_pid_fd = val;
+          print_pid_fd = _dbus_pipe_init(val);
         }
     }
   _dbus_string_free (&pid_fd);

Index: test.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/test.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -d -r1.26 -r1.27
--- test.c	17 Feb 2005 21:19:49 -0000	1.26
+++ test.c	10 Mar 2007 09:10:36 -0000	1.27
@@ -27,6 +27,7 @@
 #include "test.h"
 #include <dbus/dbus-internals.h>
 #include <dbus/dbus-list.h>
+#include <dbus/dbus-sysdeps.h>
 
 /* The "debug client" watch/timeout handlers don't dispatch messages,
  * as we manually pull them in order to verify them. This is why they
@@ -297,6 +298,7 @@
   DBusString config_file;
   DBusString relative;
   BusContext *context;
+  DBusPipe pipe;
   
   if (!_dbus_string_init (&config_file))
     {
@@ -322,7 +324,8 @@
     }
   
   dbus_error_init (&error);
-  context = bus_context_new (&config_file, FALSE, -1, -1, &error);
+  pipe = _dbus_pipe_init(-1);
+  context = bus_context_new (&config_file, FALSE, pipe, pipe, &error);
   if (context == NULL)
     {
       _DBUS_ASSERT_ERROR_IS_SET (&error);



More information about the dbus-commit mailing list