#include <stdlib.h>
#include <netinet/in.h>
#include <sys/select.h>
+#include <sys/fcntl.h>
#include "xcb.h"
#include "xcbint.h"
+static int set_fd_flags(const int fd)
+{
+ long flags = fcntl(fd, F_GETFL, 0);
+ if(flags == -1)
+ return 0;
+ flags |= O_NONBLOCK;
+ if(fcntl(fd, F_SETFL, flags) == -1)
+ return 0;
+ if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
+ return 0;
+ return 1;
+}
+
static int write_setup(XCBConnection *c, XCBAuthInfo *auth_info)
{
static const char pad[3];
c->fd = fd;
if(!(
- _xcb_set_fd_flags(fd) &&
+ set_fd_flags(fd) &&
pthread_mutex_init(&c->iolock, 0) == 0 &&
_xcb_in_init(&c->in) &&
_xcb_out_init(&c->out) &&
#include <assert.h>
#include <sys/select.h>
#include <sys/socket.h>
-#include <sys/fcntl.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netdb.h>
free(reply);
return reply != 0;
}
-
-/* The functions beyond this point still use only public interfaces,
- * but are not themselves part of the public interface. So their
- * prototypes are in xcbint.h. */
-
-#include "xcbint.h"
-
-int _xcb_set_fd_flags(const int fd)
-{
- long flags = fcntl(fd, F_GETFL, 0);
- if(flags == -1)
- return 0;
- flags |= O_NONBLOCK;
- if(fcntl(fd, F_SETFL, flags) == -1)
- return 0;
- if(fcntl(fd, F_SETFD, FD_CLOEXEC) == -1)
- return 0;
- return 1;
-}
WORKAROUND_GLX_GET_FB_CONFIGS_BUG
};
+#define XCB_PAD(i) (-(i) & 3)
+
/* xcb_list.c */
typedef struct _xcb_list _xcb_list;
void *_xcb_map_remove(_xcb_map *q, unsigned int key);
-/* xcb_util.c */
-
-#define XCB_PAD(i) (-(i) & 3)
-
-int _xcb_set_fd_flags(const int fd);
-
-
/* xcb_out.c */
typedef struct _xcb_out {