diff --git a/docs/reference/glib/Makefile.am b/docs/reference/glib/Makefile.am
index 472126b11..e990b98d4 100644
--- a/docs/reference/glib/Makefile.am
+++ b/docs/reference/glib/Makefile.am
@@ -22,6 +22,9 @@ MKDB_OPTIONS=--sgml-mode --output-format=xml --name-space=g
HFILE_GLOB=$(addprefix $(top_srcdir)/glib/,$(shell cat $(top_builddir)/glib/glib-public-headers.txt)) $(top_srcdir)/gmodule/*.h
CFILE_GLOB=$(top_srcdir)/glib/*.c $(top_srcdir)/gmodule/*.c
+# Ignore some private headers
+IGNORE_HFILES = gwakeup.h
+
# Images to copy into HTML directory
HTML_IMAGES = \
file-name-encodings.png \
diff --git a/docs/reference/glib/glib-docs.sgml b/docs/reference/glib/glib-docs.sgml
index fb63b05a5..208c49b3f 100644
--- a/docs/reference/glib/glib-docs.sgml
+++ b/docs/reference/glib/glib-docs.sgml
@@ -97,7 +97,6 @@ synchronize their operation.
-
diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt
index 8db7eb01d..853c793a0 100644
--- a/docs/reference/glib/glib-sections.txt
+++ b/docs/reference/glib/glib-sections.txt
@@ -3147,13 +3147,3 @@ g_hostname_is_ascii_encoded
g_hostname_is_ip_address
-
-
-gwakeup
-GWakeup
-g_wakeup_new
-g_wakeup_get_pollfd
-g_wakeup_signal
-g_wakeup_acknowledge
-g_wakeup_free
-
diff --git a/gio/Makefile.am b/gio/Makefile.am
index 77b1a84dc..148f4c5b1 100644
--- a/gio/Makefile.am
+++ b/gio/Makefile.am
@@ -286,6 +286,7 @@ libgio_2_0_la_SOURCES = \
gasyncresult.c \
gbufferedinputstream.c \
gbufferedoutputstream.c \
+ ../glib/gwakeup.c \
gcancellable.c \
gcontenttype.c \
gcontenttypeprivate.h \
diff --git a/gio/gcancellable.c b/gio/gcancellable.c
index 30bb0e97b..1c3c5b5d5 100644
--- a/gio/gcancellable.c
+++ b/gio/gcancellable.c
@@ -23,6 +23,7 @@
#include "config.h"
#include "glib.h"
#include
+#include "gwakeup.h"
#include "gcancellable.h"
#include "glibintl.h"
diff --git a/glib/Makefile.am b/glib/Makefile.am
index b4eaefec2..3823caf73 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -198,6 +198,7 @@ libglib_2_0_la_SOURCES = \
gvarianttypeinfo.h \
gvarianttypeinfo.c \
gvarianttype.c \
+ gwakeup.h \
gwakeup.c \
gdebug.h \
gprintf.c \
@@ -287,7 +288,6 @@ glibsubinclude_HEADERS = \
gutils.h \
gvarianttype.h \
gvariant.h \
- gwakeup.h \
gwin32.h \
gprintf.h
diff --git a/glib/glib.h b/glib/glib.h
index d2ce71d7e..06d0190b2 100644
--- a/glib/glib.h
+++ b/glib/glib.h
@@ -90,7 +90,6 @@
#include
#include
#include
-#include
#ifdef G_PLATFORM_WIN32
#include
#endif
diff --git a/glib/gwakeup.c b/glib/gwakeup.c
index 29a0fcad9..a65c2d002 100644
--- a/glib/gwakeup.c
+++ b/glib/gwakeup.c
@@ -21,6 +21,19 @@
#include "config.h"
+
+/* gwakeup.h is special -- GIO and some test cases include it. As such,
+ * it cannot include other glib headers without triggering the single
+ * includes warnings. We have to manually include its dependencies here
+ * (and at all other use sites).
+ */
+#ifdef GLIB_COMPILATION
+#include "gtypes.h"
+#include "gpoll.h"
+#else
+#include
+#endif
+
#include "gwakeup.h"
/**
@@ -128,7 +141,11 @@ g_wakeup_new (void)
/* try eventfd first, if we think we can */
#if defined (HAVE_EVENTFD)
+#ifndef TEST_EVENTFD_FALLBACK
wakeup->fds[0] = eventfd (0, EFD_CLOEXEC | EFD_NONBLOCK);
+#else
+ wakeup->fds[0] = -1;
+#endif
if (wakeup->fds[0] != -1)
{
diff --git a/glib/gwakeup.h b/glib/gwakeup.h
index 5cc587fd8..51f81ce44 100644
--- a/glib/gwakeup.h
+++ b/glib/gwakeup.h
@@ -22,17 +22,14 @@
#ifndef __G_WAKEUP_H__
#define __G_WAKEUP_H__
-#include
-#include
-
typedef struct _GWakeup GWakeup;
-GWakeup * g_wakeup_new (void);
-void g_wakeup_free (GWakeup *wakeup);
+G_GNUC_INTERNAL GWakeup * g_wakeup_new (void);
+G_GNUC_INTERNAL void g_wakeup_free (GWakeup *wakeup);
-void g_wakeup_get_pollfd (GWakeup *wakeup,
- GPollFD *poll_fd);
-void g_wakeup_signal (GWakeup *wakeup);
-void g_wakeup_acknowledge (GWakeup *wakeup);
+G_GNUC_INTERNAL void g_wakeup_get_pollfd (GWakeup *wakeup,
+ GPollFD *poll_fd);
+G_GNUC_INTERNAL void g_wakeup_signal (GWakeup *wakeup);
+G_GNUC_INTERNAL void g_wakeup_acknowledge (GWakeup *wakeup);
#endif
diff --git a/gthread/tests/Makefile.am b/gthread/tests/Makefile.am
index cc60d0f69..121ac5338 100644
--- a/gthread/tests/Makefile.am
+++ b/gthread/tests/Makefile.am
@@ -45,11 +45,12 @@ spawn_singlethread_SOURCES = spawn-singlethread.c
spawn_singlethread_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
TEST_PROGS += gwakeup
+gwakeup_SOURCES = gwakeuptest.c ../../glib/gwakeup.c
gwakeup_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
if HAVE_EVENTFD
TEST_PROGS += gwakeup-fallback
-gwakeup_fallback_SOURCES = gwakeup.c
+gwakeup_fallback_SOURCES = gwakeuptest.c ../../glib/gwakeup.c
gwakeup_fallback_CFLAGS = $(AM_CFLAGS) -DTEST_EVENTFD_FALLBACK
gwakeup_fallback_LDADD = $(progs_ldadd) $(top_builddir)/gthread/libgthread-2.0.la
endif
diff --git a/gthread/tests/gwakeup.c b/gthread/tests/gwakeuptest.c
similarity index 86%
rename from gthread/tests/gwakeup.c
rename to gthread/tests/gwakeuptest.c
index f1545d875..4b11f1730 100644
--- a/gthread/tests/gwakeup.c
+++ b/gthread/tests/gwakeuptest.c
@@ -1,31 +1,6 @@
#include
#include
-
-#ifdef TEST_EVENTFD_FALLBACK
- #include
-
- static gboolean we_broke_eventfd;
-
- /* We interpose over the eventfd() call in the libc to ensure that a
- * failed call to eventfd() gives us a working fallback.
- *
- * We need to do this because older kernel versions don't have eventfd
- * support, and some of them have eventfd but without support for some
- * of the flags we use.
- *
- * We use the we_broke_eventfd boolean to make sure that it actually
- * worked.
- */
- int eventfd (void) {
- we_broke_eventfd = TRUE;
- errno = EINVAL;
-
- return -1;
- }
- #define TESTNAME_SUFFIX "-fallback"
-#else
- #define TESTNAME_SUFFIX ""
-#endif
+#include
#ifdef _WIN32
void alarm (int sec) { }
@@ -58,18 +33,9 @@ test_semantics (void)
/* prevent the test from deadlocking */
alarm (30);
-#ifdef TEST_EVENTFD_FALLBACK
- we_broke_eventfd = FALSE;
-#endif
-
wakeup = g_wakeup_new ();
g_assert (!check_signaled (wakeup));
-#ifdef TEST_EVENTFD_FALLBACK
- /* make sure our interposed eventfd call worked */
- g_assert (we_broke_eventfd);
-#endif
-
g_wakeup_signal (wakeup);
g_assert (check_signaled (wakeup));
@@ -296,6 +262,13 @@ main (int argc, char **argv)
g_test_init (&argc, &argv, NULL);
+#ifdef TEST_EVENTFD_FALLBACK
+#define TESTNAME_SUFFIX "-fallback"
+#else
+#define TESTNAME_SUFFIX
+#endif
+
+
g_test_add_func ("/gwakeup/semantics" TESTNAME_SUFFIX, test_semantics);
g_test_add_func ("/gwakeup/threaded" TESTNAME_SUFFIX, test_threaded);