diff options
| -rw-r--r-- | audio/control.c | 1 | ||||
| -rw-r--r-- | audio/unix.c | 2 | ||||
| -rw-r--r-- | common/dbus.c | 24 | ||||
| -rw-r--r-- | common/dbus.h | 5 | ||||
| -rw-r--r-- | common/glib-helper.c | 19 | ||||
| -rw-r--r-- | common/glib-helper.h | 2 | 
6 files changed, 23 insertions, 30 deletions
| diff --git a/audio/control.c b/audio/control.c index 6007c82b..a6976d05 100644 --- a/audio/control.c +++ b/audio/control.c @@ -55,6 +55,7 @@  #include "avdtp.h"  #include "control.h"  #include "sdpd.h" +#include "glib-helper.h"  #define AVCTP_PSM 23 diff --git a/audio/unix.c b/audio/unix.c index bbb58d72..05ac448a 100644 --- a/audio/unix.c +++ b/audio/unix.c @@ -40,7 +40,6 @@  #include <glib.h>  #include "logging.h" -#include "dbus.h"  #include "ipc.h"  #include "device.h"  #include "manager.h" @@ -49,6 +48,7 @@  #include "headset.h"  #include "sink.h"  #include "unix.h" +#include "glib-helper.h"  typedef enum {  	TYPE_NONE, 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); | 
