summaryrefslogtreecommitdiffstats
path: root/bus
diff options
context:
space:
mode:
authorRalf Habacker <ralf.habacker@freenet.de>2007-03-10 09:10:36 +0000
committerRalf Habacker <ralf.habacker@freenet.de>2007-03-10 09:10:36 +0000
commit47e318a6e1893069e1326945ce1af25ddf8201d1 (patch)
treeaae5bbc914c095d75ce7c40712d89ac847002e00 /bus
parentf3fd4d60ad5de9f0c6576f6e100f944792fed255 (diff)
* 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.
Diffstat (limited to 'bus')
-rw-r--r--bus/bus.c20
-rw-r--r--bus/bus.h4
-rw-r--r--bus/main.c16
-rw-r--r--bus/test.c5
4 files changed, 24 insertions, 21 deletions
diff --git a/bus/bus.c b/bus/bus.c
index 020ac546..b54ea2d8 100644
--- a/bus/bus.c
+++ b/bus/bus.c
@@ -527,8 +527,8 @@ process_config_postinit (BusContext *context,
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 @@ bus_context_new (const DBusString *config_file,
* 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 @@ bus_context_new (const DBusString *config_file,
}
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 @@ bus_context_new (const DBusString *config_file,
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 @@ bus_context_new (const DBusString *config_file,
}
/* 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 @@ bus_context_new (const DBusString *config_file,
}
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 @@ bus_context_new (const DBusString *config_file,
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);
}
diff --git a/bus/bus.h b/bus/bus.h
index 77d764db..0aea841a 100644
--- a/bus/bus.h
+++ b/bus/bus.h
@@ -70,8 +70,8 @@ typedef enum
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);
diff --git a/bus/main.c b/bus/main.c
index 0caa2979..b73c683f 100644
--- a/bus/main.c
+++ b/bus/main.c
@@ -247,8 +247,8 @@ main (int argc, char **argv)
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 @@ main (int argc, char **argv)
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 @@ main (int argc, char **argv)
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 @@ main (int argc, char **argv)
exit (1);
}
- print_pid_fd = val;
+ print_pid_fd = _dbus_pipe_init(val);
}
}
_dbus_string_free (&pid_fd);
diff --git a/bus/test.c b/bus/test.c
index 599e7caf..3315a702 100644
--- a/bus/test.c
+++ b/bus/test.c
@@ -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 @@ bus_context_new_test (const DBusString *test_data_dir,
DBusString config_file;
DBusString relative;
BusContext *context;
+ DBusPipe pipe;
if (!_dbus_string_init (&config_file))
{
@@ -322,7 +324,8 @@ bus_context_new_test (const DBusString *test_data_dir,
}
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);