summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2008-05-08 18:47:21 +0000
committerMarcel Holtmann <marcel@holtmann.org>2008-05-08 18:47:21 +0000
commit4d39e4d2ea552e2d4ad36c085700f513e10be7e0 (patch)
tree49f9b22a972b09445eec7581b2d460bd0ee6189c /common
parentb5514e6c7f0258da455bbde02482fbcdb29d4442 (diff)
Move set_nonblocking() to the GLib helpers for now
Diffstat (limited to 'common')
-rw-r--r--common/dbus.c24
-rw-r--r--common/dbus.h5
-rw-r--r--common/glib-helper.c19
-rw-r--r--common/glib-helper.h2
4 files changed, 21 insertions, 29 deletions
diff --git a/common/dbus.c b/common/dbus.c
index ccf7c46c..15716d7f 100644
--- a/common/dbus.c
+++ b/common/dbus.c
@@ -826,27 +826,3 @@ DBusConnection *dbus_bus_system_setup_with_main_loop(const char *name,
{
return init_dbus(name, disconnect_cb, user_data);
}
-
-int set_nonblocking(int fd)
-{
- long arg;
-
- arg = fcntl(fd, F_GETFL);
- if (arg < 0) {
- error("fcntl(F_GETFL): %s (%d)", strerror(errno), errno);
- return -errno;
- }
-
- /* Return if already nonblocking */
- if (arg & O_NONBLOCK)
- return 0;
-
- arg |= O_NONBLOCK;
- if (fcntl(fd, F_SETFL, arg) < 0) {
- error("fcntl(F_SETFL, O_NONBLOCK): %s (%d)",
- strerror(errno), errno);
- return -errno;
- }
-
- return 0;
-}
diff --git a/common/dbus.h b/common/dbus.h
index 2a182ac8..5b133191 100644
--- a/common/dbus.h
+++ b/common/dbus.h
@@ -60,9 +60,4 @@ static inline DBusHandlerResult send_message_and_unref(DBusConnection *conn, DBu
return DBUS_HANDLER_RESULT_HANDLED;
}
-int set_nonblocking(int fd);
-
-void register_external_service(DBusConnection *conn, const char *identifier,
- const char *name, const char *description);
-
#endif /* __H_BLUEZ_DBUS_H__ */
diff --git a/common/glib-helper.c b/common/glib-helper.c
index 8fa8efcf..36228d45 100644
--- a/common/glib-helper.c
+++ b/common/glib-helper.c
@@ -43,6 +43,25 @@
#include "glib-helper.h"
+int set_nonblocking(int fd)
+{
+ long arg;
+
+ arg = fcntl(fd, F_GETFL);
+ if (arg < 0)
+ return -errno;
+
+ /* Return if already nonblocking */
+ if (arg & O_NONBLOCK)
+ return 0;
+
+ arg |= O_NONBLOCK;
+ if (fcntl(fd, F_SETFL, arg) < 0)
+ return -errno;
+
+ return 0;
+}
+
struct io_context {
GIOChannel *io;
bt_io_callback_t cb;
diff --git a/common/glib-helper.h b/common/glib-helper.h
index 97f51b11..7a312005 100644
--- a/common/glib-helper.h
+++ b/common/glib-helper.h
@@ -21,6 +21,8 @@
*
*/
+int set_nonblocking(int fd);
+
typedef void (*bt_io_callback_t) (GIOChannel *io, int err, gpointer user_data);
typedef void (*bt_callback_t) (sdp_list_t *recs, int err, gpointer user_data);
typedef void (*bt_destroy_t) (gpointer user_data);