Commit 85253791 authored by Ralf Habacker's avatar Ralf Habacker

Merge branch 'rename-dbus-socket-set' into 'master'

Rename structure DBusSocketSet to DBusPollableSet and adjust the corresponding functions/files

See merge request !81

Reviewed-by: Simon McVittie
parents 20deb4b6 4573c15e
Pipeline #14473 passed with stage
in 29 minutes and 10 seconds
...@@ -162,8 +162,8 @@ set (DBUS_UTIL_SOURCES ...@@ -162,8 +162,8 @@ set (DBUS_UTIL_SOURCES
${DBUS_DIR}/dbus-message-factory.c ${DBUS_DIR}/dbus-message-factory.c
${DBUS_DIR}/dbus-message-util.c ${DBUS_DIR}/dbus-message-util.c
${DBUS_DIR}/dbus-shell.c ${DBUS_DIR}/dbus-shell.c
${DBUS_DIR}/dbus-socket-set.c ${DBUS_DIR}/dbus-pollable-set.c
${DBUS_DIR}/dbus-socket-set-poll.c ${DBUS_DIR}/dbus-pollable-set-poll.c
${DBUS_DIR}/dbus-string-util.c ${DBUS_DIR}/dbus-string-util.c
${DBUS_DIR}/dbus-sysdeps-util.c ${DBUS_DIR}/dbus-sysdeps-util.c
) )
...@@ -182,7 +182,7 @@ set (DBUS_UTIL_HEADERS ...@@ -182,7 +182,7 @@ set (DBUS_UTIL_HEADERS
${DBUS_DIR}/dbus-mainloop.h ${DBUS_DIR}/dbus-mainloop.h
${DBUS_DIR}/dbus-message-factory.h ${DBUS_DIR}/dbus-message-factory.h
${DBUS_DIR}/dbus-shell.h ${DBUS_DIR}/dbus-shell.h
${DBUS_DIR}/dbus-socket-set.h ${DBUS_DIR}/dbus-pollable-set.h
${DBUS_DIR}/dbus-spawn.h ${DBUS_DIR}/dbus-spawn.h
${DBUS_DIR}/dbus-test.h ${DBUS_DIR}/dbus-test.h
${DBUS_DIR}/dbus-test-wrappers.h ${DBUS_DIR}/dbus-test-wrappers.h
...@@ -237,7 +237,7 @@ endif (WIN32) ...@@ -237,7 +237,7 @@ endif (WIN32)
if(DBUS_HAVE_LINUX_EPOLL) if(DBUS_HAVE_LINUX_EPOLL)
set(DBUS_UTIL_SOURCES set(DBUS_UTIL_SOURCES
${DBUS_UTIL_SOURCES} ${DBUS_UTIL_SOURCES}
${DBUS_DIR}/dbus-socket-set-epoll.c ${DBUS_DIR}/dbus-pollable-set-epoll.c
) )
endif() endif()
......
...@@ -122,7 +122,7 @@ DBUS_UTIL_arch_sources = \ ...@@ -122,7 +122,7 @@ DBUS_UTIL_arch_sources = \
endif endif
if DBUS_HAVE_LINUX_EPOLL if DBUS_HAVE_LINUX_EPOLL
DBUS_UTIL_arch_sources += dbus-socket-set-epoll.c DBUS_UTIL_arch_sources += dbus-pollable-set-epoll.c
endif endif
dbusinclude_HEADERS= \ dbusinclude_HEADERS= \
...@@ -260,9 +260,9 @@ DBUS_UTIL_SOURCES= \ ...@@ -260,9 +260,9 @@ DBUS_UTIL_SOURCES= \
dbus-shell.c \ dbus-shell.c \
dbus-shell.h \ dbus-shell.h \
$(DBUS_UTIL_arch_sources) \ $(DBUS_UTIL_arch_sources) \
dbus-socket-set.h \ dbus-pollable-set.h \
dbus-socket-set.c \ dbus-pollable-set.c \
dbus-socket-set-poll.c \ dbus-pollable-set-poll.c \
dbus-spawn.h \ dbus-spawn.h \
dbus-string-util.c \ dbus-string-util.c \
dbus-sysdeps-util.c \ dbus-sysdeps-util.c \
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include <dbus/dbus-hash.h> #include <dbus/dbus-hash.h>
#include <dbus/dbus-list.h> #include <dbus/dbus-list.h>
#include <dbus/dbus-socket-set.h> #include <dbus/dbus-pollable-set.h>
#include <dbus/dbus-timeout.h> #include <dbus/dbus-timeout.h>
#include <dbus/dbus-watch.h> #include <dbus/dbus-watch.h>
...@@ -40,7 +40,7 @@ struct DBusLoop ...@@ -40,7 +40,7 @@ struct DBusLoop
int refcount; int refcount;
/** DBusPollable => dbus_malloc'd DBusList ** of references to DBusWatch */ /** DBusPollable => dbus_malloc'd DBusList ** of references to DBusWatch */
DBusHashTable *watches; DBusHashTable *watches;
DBusSocketSet *socket_set; DBusPollableSet *pollable_set;
DBusList *timeouts; DBusList *timeouts;
int callback_list_serial; int callback_list_serial;
int watch_count; int watch_count;
...@@ -116,15 +116,15 @@ _dbus_loop_new (void) ...@@ -116,15 +116,15 @@ _dbus_loop_new (void)
loop->watches = _dbus_hash_table_new (DBUS_HASH_POLLABLE, NULL, loop->watches = _dbus_hash_table_new (DBUS_HASH_POLLABLE, NULL,
free_watch_table_entry); free_watch_table_entry);
loop->socket_set = _dbus_socket_set_new (0); loop->pollable_set = _dbus_pollable_set_new (0);
if (loop->watches == NULL || loop->socket_set == NULL) if (loop->watches == NULL || loop->pollable_set == NULL)
{ {
if (loop->watches != NULL) if (loop->watches != NULL)
_dbus_hash_table_unref (loop->watches); _dbus_hash_table_unref (loop->watches);
if (loop->socket_set != NULL) if (loop->pollable_set != NULL)
_dbus_socket_set_free (loop->socket_set); _dbus_pollable_set_free (loop->pollable_set);
dbus_free (loop); dbus_free (loop);
return NULL; return NULL;
...@@ -163,7 +163,7 @@ _dbus_loop_unref (DBusLoop *loop) ...@@ -163,7 +163,7 @@ _dbus_loop_unref (DBusLoop *loop)
} }
_dbus_hash_table_unref (loop->watches); _dbus_hash_table_unref (loop->watches);
_dbus_socket_set_free (loop->socket_set); _dbus_pollable_set_free (loop->pollable_set);
dbus_free (loop); dbus_free (loop);
} }
} }
...@@ -263,9 +263,9 @@ refresh_watches_for_fd (DBusLoop *loop, ...@@ -263,9 +263,9 @@ refresh_watches_for_fd (DBusLoop *loop,
} }
if (interested) if (interested)
_dbus_socket_set_enable (loop->socket_set, fd, flags); _dbus_pollable_set_enable (loop->pollable_set, fd, flags);
else else
_dbus_socket_set_disable (loop->socket_set, fd); _dbus_pollable_set_disable (loop->pollable_set, fd);
} }
dbus_bool_t dbus_bool_t
...@@ -293,7 +293,7 @@ _dbus_loop_add_watch (DBusLoop *loop, ...@@ -293,7 +293,7 @@ _dbus_loop_add_watch (DBusLoop *loop,
if (_dbus_list_length_is_one (watches)) if (_dbus_list_length_is_one (watches))
{ {
if (!_dbus_socket_set_add (loop->socket_set, fd, if (!_dbus_pollable_set_add (loop->pollable_set, fd,
dbus_watch_get_flags (watch), dbus_watch_get_flags (watch),
dbus_watch_get_enabled (watch))) dbus_watch_get_enabled (watch)))
{ {
...@@ -354,7 +354,7 @@ _dbus_loop_remove_watch (DBusLoop *loop, ...@@ -354,7 +354,7 @@ _dbus_loop_remove_watch (DBusLoop *loop,
* entry, and stop reserving space for it in the socket set */ * entry, and stop reserving space for it in the socket set */
if (gc_watch_table_entry (loop, watches, fd)) if (gc_watch_table_entry (loop, watches, fd))
{ {
_dbus_socket_set_remove (loop->socket_set, fd); _dbus_pollable_set_remove (loop->pollable_set, fd);
} }
return; return;
...@@ -570,7 +570,7 @@ _dbus_loop_iterate (DBusLoop *loop, ...@@ -570,7 +570,7 @@ _dbus_loop_iterate (DBusLoop *loop,
{ {
#define N_STACK_DESCRIPTORS 64 #define N_STACK_DESCRIPTORS 64
dbus_bool_t retval; dbus_bool_t retval;
DBusSocketEvent ready_fds[N_STACK_DESCRIPTORS]; DBusPollableEvent ready_fds[N_STACK_DESCRIPTORS];
int i; int i;
DBusList *link; DBusList *link;
int n_ready; int n_ready;
...@@ -660,8 +660,8 @@ _dbus_loop_iterate (DBusLoop *loop, ...@@ -660,8 +660,8 @@ _dbus_loop_iterate (DBusLoop *loop,
_dbus_verbose (" polling on %d descriptors timeout %ld\n", _DBUS_N_ELEMENTS (ready_fds), timeout); _dbus_verbose (" polling on %d descriptors timeout %ld\n", _DBUS_N_ELEMENTS (ready_fds), timeout);
#endif #endif
n_ready = _dbus_socket_set_poll (loop->socket_set, ready_fds, n_ready = _dbus_pollable_set_poll (loop->pollable_set, ready_fds,
_DBUS_N_ELEMENTS (ready_fds), timeout); _DBUS_N_ELEMENTS (ready_fds), timeout);
/* re-enable any watches we skipped this time */ /* re-enable any watches we skipped this time */
if (loop->oom_watch_pending) if (loop->oom_watch_pending)
......
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-socket-set-epoll.c - a socket set implemented via Linux epoll(4) /* dbus-pollable-set-epoll.c - a pollable set implemented via Linux epoll(4)
* *
* Copyright © 2011 Nokia Corporation * Copyright © 2011 Nokia Corporation
* *
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
#include <config.h> #include <config.h>
#include "dbus-socket-set.h" #include "dbus-pollable-set.h"
#include <dbus/dbus-internals.h> #include <dbus/dbus-internals.h>
#include <dbus/dbus-sysdeps.h> #include <dbus/dbus-sysdeps.h>
...@@ -40,22 +40,22 @@ ...@@ -40,22 +40,22 @@
#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct { typedef struct {
DBusSocketSet parent; DBusPollableSet parent;
int epfd; int epfd;
} DBusSocketSetEpoll; } DBusPollableSetEpoll;
static inline DBusSocketSetEpoll * static inline DBusPollableSetEpoll *
socket_set_epoll_cast (DBusSocketSet *set) socket_set_epoll_cast (DBusPollableSet *set)
{ {
_dbus_assert (set->cls == &_dbus_socket_set_epoll_class); _dbus_assert (set->cls == &_dbus_pollable_set_epoll_class);
return (DBusSocketSetEpoll *) set; return (DBusPollableSetEpoll *) set;
} }
/* this is safe to call on a partially-allocated socket set */ /* this is safe to call on a partially-allocated socket set */
static void static void
socket_set_epoll_free (DBusSocketSet *set) socket_set_epoll_free (DBusPollableSet *set)
{ {
DBusSocketSetEpoll *self = socket_set_epoll_cast (set); DBusPollableSetEpoll *self = socket_set_epoll_cast (set);
if (self == NULL) if (self == NULL)
return; return;
...@@ -66,17 +66,17 @@ socket_set_epoll_free (DBusSocketSet *set) ...@@ -66,17 +66,17 @@ socket_set_epoll_free (DBusSocketSet *set)
dbus_free (self); dbus_free (self);
} }
DBusSocketSet * DBusPollableSet *
_dbus_socket_set_epoll_new (void) _dbus_pollable_set_epoll_new (void)
{ {
DBusSocketSetEpoll *self; DBusPollableSetEpoll *self;
self = dbus_new0 (DBusSocketSetEpoll, 1); self = dbus_new0 (DBusPollableSetEpoll, 1);
if (self == NULL) if (self == NULL)
return NULL; return NULL;
self->parent.cls = &_dbus_socket_set_epoll_class; self->parent.cls = &_dbus_pollable_set_epoll_class;
self->epfd = epoll_create1 (EPOLL_CLOEXEC); self->epfd = epoll_create1 (EPOLL_CLOEXEC);
...@@ -97,11 +97,11 @@ _dbus_socket_set_epoll_new (void) ...@@ -97,11 +97,11 @@ _dbus_socket_set_epoll_new (void)
if (self->epfd == -1) if (self->epfd == -1)
{ {
socket_set_epoll_free ((DBusSocketSet *) self); socket_set_epoll_free ((DBusPollableSet *) self);
return NULL; return NULL;
} }
return (DBusSocketSet *) self; return (DBusPollableSet *) self;
} }
static uint32_t static uint32_t
...@@ -135,12 +135,12 @@ epoll_events_to_watch_flags (uint32_t events) ...@@ -135,12 +135,12 @@ epoll_events_to_watch_flags (uint32_t events)
} }
static dbus_bool_t static dbus_bool_t
socket_set_epoll_add (DBusSocketSet *set, socket_set_epoll_add (DBusPollableSet *set,
DBusPollable fd, DBusPollable fd,
unsigned int flags, unsigned int flags,
dbus_bool_t enabled) dbus_bool_t enabled)
{ {
DBusSocketSetEpoll *self = socket_set_epoll_cast (set); DBusPollableSetEpoll *self = socket_set_epoll_cast (set);
struct epoll_event event; struct epoll_event event;
int err; int err;
...@@ -189,11 +189,11 @@ socket_set_epoll_add (DBusSocketSet *set, ...@@ -189,11 +189,11 @@ socket_set_epoll_add (DBusSocketSet *set,
} }
static void static void
socket_set_epoll_enable (DBusSocketSet *set, socket_set_epoll_enable (DBusPollableSet *set,
DBusPollable fd, DBusPollable fd,
unsigned int flags) unsigned int flags)
{ {
DBusSocketSetEpoll *self = socket_set_epoll_cast (set); DBusPollableSetEpoll *self = socket_set_epoll_cast (set);
struct epoll_event event; struct epoll_event event;
int err; int err;
...@@ -230,10 +230,10 @@ socket_set_epoll_enable (DBusSocketSet *set, ...@@ -230,10 +230,10 @@ socket_set_epoll_enable (DBusSocketSet *set,
} }
static void static void
socket_set_epoll_disable (DBusSocketSet *set, socket_set_epoll_disable (DBusPollableSet *set,
DBusPollable fd) DBusPollable fd)
{ {
DBusSocketSetEpoll *self = socket_set_epoll_cast (set); DBusPollableSetEpoll *self = socket_set_epoll_cast (set);
struct epoll_event event; struct epoll_event event;
int err; int err;
...@@ -266,10 +266,10 @@ socket_set_epoll_disable (DBusSocketSet *set, ...@@ -266,10 +266,10 @@ socket_set_epoll_disable (DBusSocketSet *set,
} }
static void static void
socket_set_epoll_remove (DBusSocketSet *set, socket_set_epoll_remove (DBusPollableSet *set,
DBusPollable fd) DBusPollable fd)
{ {
DBusSocketSetEpoll *self = socket_set_epoll_cast (set); DBusPollableSetEpoll *self = socket_set_epoll_cast (set);
int err; int err;
/* Kernels < 2.6.9 require a non-NULL struct pointer, even though its /* Kernels < 2.6.9 require a non-NULL struct pointer, even though its
* contents are ignored */ * contents are ignored */
...@@ -289,12 +289,12 @@ socket_set_epoll_remove (DBusSocketSet *set, ...@@ -289,12 +289,12 @@ socket_set_epoll_remove (DBusSocketSet *set,
#define N_STACK_DESCRIPTORS 64 #define N_STACK_DESCRIPTORS 64
static int static int
socket_set_epoll_poll (DBusSocketSet *set, socket_set_epoll_poll (DBusPollableSet *set,
DBusSocketEvent *revents, DBusPollableEvent *revents,
int max_events, int max_events,
int timeout_ms) int timeout_ms)
{ {
DBusSocketSetEpoll *self = socket_set_epoll_cast (set); DBusPollableSetEpoll *self = socket_set_epoll_cast (set);
struct epoll_event events[N_STACK_DESCRIPTORS]; struct epoll_event events[N_STACK_DESCRIPTORS];
int n_ready; int n_ready;
int i; int i;
...@@ -317,7 +317,7 @@ socket_set_epoll_poll (DBusSocketSet *set, ...@@ -317,7 +317,7 @@ socket_set_epoll_poll (DBusSocketSet *set,
return n_ready; return n_ready;
} }
DBusSocketSetClass _dbus_socket_set_epoll_class = { DBusPollableSetClass _dbus_pollable_set_epoll_class = {
socket_set_epoll_free, socket_set_epoll_free,
socket_set_epoll_add, socket_set_epoll_add,
socket_set_epoll_remove, socket_set_epoll_remove,
......
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* dbus-socket-set-poll.c - a socket set implemented via _dbus_poll /* dbus-pollable-set-poll.c - a pollable set implemented via _dbus_poll
* *
* Copyright © 2011 Nokia Corporation * Copyright © 2011 Nokia Corporation
* *
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
*/ */
#include <config.h> #include <config.h>
#include "dbus-socket-set.h" #include "dbus-pollable-set.h"
#include <dbus/dbus-internals.h> #include <dbus/dbus-internals.h>
#include <dbus/dbus-list.h> #include <dbus/dbus-list.h>
...@@ -33,12 +33,12 @@ ...@@ -33,12 +33,12 @@
#ifndef DOXYGEN_SHOULD_SKIP_THIS #ifndef DOXYGEN_SHOULD_SKIP_THIS
typedef struct { typedef struct {
DBusSocketSet parent; DBusPollableSet parent;
DBusPollFD *fds; DBusPollFD *fds;
int n_fds; int n_fds;
int n_reserved; int n_reserved;
int n_allocated; int n_allocated;
} DBusSocketSetPoll; } DBusPollableSetPoll;
#define REALLOC_INCREMENT 8 #define REALLOC_INCREMENT 8
#define MINIMUM_SIZE 8 #define MINIMUM_SIZE 8
...@@ -50,38 +50,38 @@ typedef struct { ...@@ -50,38 +50,38 @@ typedef struct {
#define DEFAULT_SIZE_HINT MINIMUM_SIZE #define DEFAULT_SIZE_HINT MINIMUM_SIZE
#endif #endif
static inline DBusSocketSetPoll * static inline DBusPollableSetPoll *
socket_set_poll_cast (DBusSocketSet *set) socket_set_poll_cast (DBusPollableSet *set)
{ {
_dbus_assert (set->cls == &_dbus_socket_set_poll_class); _dbus_assert (set->cls == &_dbus_pollable_set_poll_class);
return (DBusSocketSetPoll *) set; return (DBusPollableSetPoll *) set;
} }
/* this is safe to call on a partially-allocated socket set */ /* this is safe to call on a partially-allocated socket set */
static void static void
socket_set_poll_free (DBusSocketSet *set) socket_set_poll_free (DBusPollableSet *set)
{ {
DBusSocketSetPoll *self = socket_set_poll_cast (set); DBusPollableSetPoll *self = socket_set_poll_cast (set);
dbus_free (self->fds); dbus_free (self->fds);
dbus_free (self); dbus_free (self);
_dbus_verbose ("freed socket set %p\n", self); _dbus_verbose ("freed socket set %p\n", self);
} }
DBusSocketSet * DBusPollableSet *
_dbus_socket_set_poll_new (int size_hint) _dbus_pollable_set_poll_new (int size_hint)
{ {
DBusSocketSetPoll *ret; DBusPollableSetPoll *ret;
if (size_hint <= 0) if (size_hint <= 0)
size_hint = DEFAULT_SIZE_HINT; size_hint = DEFAULT_SIZE_HINT;
ret = dbus_new0 (DBusSocketSetPoll, 1); ret = dbus_new0 (DBusPollableSetPoll, 1);
if (ret == NULL) if (ret == NULL)
return NULL; return NULL;
ret->parent.cls = &_dbus_socket_set_poll_class; ret->parent.cls = &_dbus_pollable_set_poll_class;
ret->n_fds = 0; ret->n_fds = 0;
ret->n_allocated = size_hint; ret->n_allocated = size_hint;
...@@ -91,12 +91,12 @@ _dbus_socket_set_poll_new (int size_hint) ...@@ -91,12 +91,12 @@ _dbus_socket_set_poll_new (int size_hint)
{ {
/* socket_set_poll_free specifically supports half-constructed /* socket_set_poll_free specifically supports half-constructed
* socket sets */ * socket sets */
socket_set_poll_free ((DBusSocketSet *) ret); socket_set_poll_free ((DBusPollableSet *) ret);
return NULL; return NULL;
} }
_dbus_verbose ("new socket set at %p\n", ret); _dbus_verbose ("new socket set at %p\n", ret);
return (DBusSocketSet *) ret; return (DBusPollableSet *) ret;
} }
static short static short
...@@ -113,12 +113,12 @@ watch_flags_to_poll_events (unsigned int flags) ...@@ -113,12 +113,12 @@ watch_flags_to_poll_events (unsigned int flags)
} }
static dbus_bool_t static dbus_bool_t
socket_set_poll_add (DBusSocketSet *set, socket_set_poll_add (DBusPollableSet *set,
DBusPollable fd, DBusPollable fd,
unsigned int flags, unsigned int flags,
dbus_bool_t enabled) dbus_bool_t enabled)
{ {
DBusSocketSetPoll *self = socket_set_poll_cast (set); DBusPollableSetPoll *self = socket_set_poll_cast (set);
#ifndef DBUS_DISABLE_ASSERT #ifndef DBUS_DISABLE_ASSERT
int i; int i;
...@@ -160,11 +160,11 @@ socket_set_poll_add (DBusSocketSet *set, ...@@ -160,11 +160,11 @@ socket_set_poll_add (DBusSocketSet *set,
} }
static void static void
socket_set_poll_enable (DBusSocketSet *set, socket_set_poll_enable (DBusPollableSet *set,
DBusPollable fd, DBusPollable fd,
unsigned int flags) unsigned int flags)
{ {
DBusSocketSetPoll *self = socket_set_poll_cast (set); DBusPollableSetPoll *self = socket_set_poll_cast (set);
int i; int i;
for (i = 0; i < self->n_fds; i++) for (i = 0; i < self->n_fds; i++)
...@@ -186,10 +186,10 @@ socket_set_poll_enable (DBusSocketSet *set, ...@@ -186,10 +186,10 @@ socket_set_poll_enable (DBusSocketSet *set,
} }
static void static void
socket_set_poll_disable (DBusSocketSet *set, socket_set_poll_disable (DBusPollableSet *set,
DBusPollable fd) DBusPollable fd)
{ {
DBusSocketSetPoll *self = socket_set_poll_cast (set); DBusPollableSetPoll *self = socket_set_poll_cast (set);
int i; int i;
for (i = 0; i < self->n_fds; i++) for (i = 0; i < self->n_fds; i++)
...@@ -209,10 +209,10 @@ socket_set_poll_disable (DBusSocketSet *set, ...@@ -209,10 +209,10 @@ socket_set_poll_disable (DBusSocketSet *set,
} }
static void static void
socket_set_poll_remove (DBusSocketSet *set, socket_set_poll_remove (DBusPollableSet *set,
DBusPollable fd) DBusPollable fd)
{ {
DBusSocketSetPoll *self = socket_set_poll_cast (set); DBusPollableSetPoll *self = socket_set_poll_cast (set);
socket_set_poll_disable (set, fd); socket_set_poll_disable (set, fd);
self->n_reserved--; self->n_reserved--;
...@@ -266,12 +266,12 @@ watch_flags_from_poll_revents (short revents) ...@@ -266,12 +266,12 @@ watch_flags_from_poll_revents (short revents)
/** This is basically Linux's epoll_wait(2) implemented in terms of poll(2); /** This is basically Linux's epoll_wait(2) implemented in terms of poll(2);
* it returns results into a caller-supplied buffer so we can be reentrant. */ * it returns results into a caller-supplied buffer so we can be reentrant. */
static int static int
socket_set_poll_poll (DBusSocketSet *set, socket_set_poll_poll (DBusPollableSet *set,
DBusSocketEvent *revents, DBusPollableEvent *revents,
int max_events, int max_events,
int timeout_ms) int timeout_ms)
{ {
DBusSocketSetPoll *self = socket_set_poll_cast (set); DBusPollableSetPoll *self = socket_set_poll_cast (set);
int i; int i;
int n_events; int n_events;
int n_ready; int n_ready;
...@@ -308,7 +308,7 @@ socket_set_poll_poll (DBusSocketSet *set, ...@@ -308,7 +308,7 @@ socket_set_poll_poll (DBusSocketSet *set,
return n_events; return n_events;
} }
DBusSocketSetClass _dbus_socket_set_poll_class = { DBusPollableSetClass _dbus_pollable_set_poll_class = {
socket_set_poll_free, socket_set_poll_free,
socket_set_poll_add, socket_set_poll_add,
socket_set_poll_remove, socket_set_poll_remove,
......
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* /*
* dbus-socket-set.c - used to bolt file descriptors onto a bus * dbus-pollable-set.c - a set of pollable objects (file descriptors, sockets or handles)
* *
* Copyright © 2011 Nokia Corporation * Copyright © 2011 Nokia Corporation
* *
...@@ -24,21 +24,21 @@ ...@@ -24,21 +24,21 @@
*/ */
#include <config.h> #include <config.h>
#include <dbus/dbus-socket-set.h> #include <dbus/dbus-pollable-set.h>
DBusSocketSet * DBusPollableSet *
_dbus_socket_set_new (int size_hint) _dbus_pollable_set_new (int size_hint)
{ {
DBusSocketSet *ret; DBusPollableSet *ret;
#ifdef DBUS_HAVE_LINUX_EPOLL #ifdef DBUS_HAVE_LINUX_EPOLL
ret = _dbus_socket_set_epoll_new (); ret = _dbus_pollable_set_epoll_new ();
if (ret != NULL) if (ret != NULL)
return ret; return ret;
#endif #endif
ret = _dbus_socket_set_poll_new (size_hint); ret = _dbus_pollable_set_poll_new (size_hint);
if (ret != NULL) if (ret != NULL)
return ret; return ret;
......
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
/* /*
* dbus-socket-set.h - used to bolt file descriptors onto a bus * dbus-pollable-set.h - a set of pollable objects (file descriptors, sockets or handles)
* *
* Copyright © 2011 Nokia Corporation * Copyright © 2011 Nokia Corporation
* *
...@@ -23,8 +23,8 @@ ...@@ -23,8 +23,8 @@
* *
*/ */