blob: 40acac337fc7cc62791ad3ef6dcf97a5125aee7c [file] [log] [blame]
diff --git a/configure b/configure
--- a/configure
+++ b/configure
@@ -13123,7 +13136,9 @@ else
$as_echo "yes" >&6; }
fi
-NEEDED="pthread-stubs xau >= 0.99.2"
+# Dropped pthread-stubs since for nacl we can always build against pthreads.
+# This avoids an unused package.
+NEEDED="xau >= 0.99.2"
pkg_failed=no
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for NEEDED" >&5
diff --git a/src/xcb_conn.c b/src/xcb_conn.c
--- a/src/xcb_conn.c
+++ b/src/xcb_conn.c
@@ -63,6 +63,26 @@ static const int xcb_con_error = XCB_CONN_ERROR;
static const int xcb_con_closed_mem_er = XCB_CONN_CLOSED_MEM_INSUFFICIENT;
static const int xcb_con_closed_parse_er = XCB_CONN_CLOSED_PARSE_ERR;
+#if defined(__native_client__) && defined(__GLIBC__)
+#include "nacl_io/kernel_intercept.h"
+#include "nacl_io/kernel_wrap.h"
+#include <stdarg.h>
+
+/*
+ * Explicitly use nacl_fcntl.
+ * When built as a shared library, without this xcb seems to hit stubs.
+ */
+static int nacl_fcntl(int fd, int cmd, ...) {
+ va_list ap;
+ va_start(ap, cmd);
+ int rtn = ki_fcntl(fd, cmd, ap);
+ va_end(ap);
+ return rtn;
+}
+#define fcntl nacl_fcntl
+#endif
+
+
static int set_fd_flags(const int fd)
{
/* Win32 doesn't have file descriptors and the fcntl function. This block sets the socket in non-blocking mode */