include libmemcachedinternal/include.am
include libmemcachedinternal/util/include.am
-include poll/include.am
include rpm/include.am
include support/include.am
include tests/include.am
#pragma once
+#ifdef __cplusplus
+# include <cassert>
+#else
+# include <assert.h>
+#endif // __cplusplus
+
#ifdef NDEBUG
# define assert_msg(__expr, __mesg) (void)(__expr); (void)(__mesg);
# define assert_vmsg(__expr, __mesg, ...) (void)(__expr); (void)(__mesg);
# include <alloca.h>
# endif
+#ifdef __cplusplus
# include <cstdarg>
+# include <cstdio>
+#else
+# include <stdarg.h>
+# include <stdio.h>
+#endif
+
# include <libmemcached/backtrace.hpp>
# define assert_msg(__expr, __mesg) \
*
* libmcachedd client library.
*
- * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2011-2013 Data Differential, http://datadifferential.com/
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#pragma once
+#ifdef __cplusplus
+extern "C" {
+#endif
+
void custom_backtrace(void);
+
+#ifdef __cplusplus
+}
+#endif
#ifdef HAVE_POLL_H
# include <poll.h>
#else
-# include "poll/poll.h"
-#endif
-
-#ifndef POLLHUP
-# define POLLHUP 0x0010
-#endif
-
-#ifndef POLLNVAL
-# define POLLNVAL 0x0020
+# include "libmemcached/poll.h"
#endif
#ifdef __cplusplus
noinst_HEADERS+= libmemcached/memory.h
noinst_HEADERS+= libmemcached/namespace.h
noinst_HEADERS+= libmemcached/options.hpp
+noinst_HEADERS+= libmemcached/poll.h
noinst_HEADERS+= libmemcached/response.h
noinst_HEADERS+= libmemcached/result.h
noinst_HEADERS+= libmemcached/sasl.hpp
libmemcached_libmemcached_la_SOURCES+= libmemcached/namespace.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/options.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/parse.cc
+libmemcached_libmemcached_la_SOURCES+= libmemcached/poll.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/purge.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/quit.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/quit.hpp
libmemcached_libmemcached_la_SOURCES+= libmemcached/strerror.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/string.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/touch.cc
+libmemcached_libmemcached_la_SOURCES+= libmemcached/udp.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/verbosity.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/version.cc
-libmemcached_libmemcached_la_SOURCES+= libmemcached/udp.cc
libmemcached_libmemcached_la_SOURCES+= libmemcached/virtual_bucket.c
libmemcached/options.cc: libmemcached/csl/parser.h
--- /dev/null
+/* LibMemcached
+ * Copyright (C) 2013 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2010 Brian Aker, Trond Norbye
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ *
+ * Summary: Implementation of poll by using select
+ *
+ */
+
+#include "libmemcached/common.h"
+
+#if defined(WIN32) || defined(__MINGW32__)
+#include "libmemcached/poll.h"
+
+#include <sys/time.h>
+#include <strings.h>
+
+int poll(struct pollfd fds[], nfds_t nfds, int tmo)
+{
+ fd_set readfds, writefds, errorfds;
+ FD_ZERO(&readfds);
+ FD_ZERO(&writefds);
+ FD_ZERO(&errorfds);
+
+ int maxfd= 0;
+
+ for (nfds_t x= 0; x < nfds; ++x)
+ {
+ if (fds[x].events & (POLLIN | POLLOUT))
+ {
+#ifndef WIN32
+ if (fds[x].fd > maxfd)
+ {
+ maxfd= fds[x].fd;
+ }
+#endif
+ if (fds[x].events & POLLIN)
+ {
+ FD_SET(fds[x].fd, &readfds);
+ }
+ if (fds[x].events & POLLOUT)
+ {
+ FD_SET(fds[x].fd, &writefds);
+ }
+ }
+ }
+
+ struct timeval timeout= { .tv_sec = tmo / 1000,
+ .tv_usec= (tmo % 1000) * 1000 };
+ struct timeval *tp= &timeout;
+ if (tmo == -1)
+ {
+ tp= NULL;
+ }
+ int ret= select(maxfd + 1, &readfds, &writefds, &errorfds, tp);
+ if (ret <= 0)
+ {
+ return ret;
+ }
+
+ /* Iterate through all of them because I need to clear the revent map */
+ for (nfds_t x= 0; x < nfds; ++x)
+ {
+ fds[x].revents= 0;
+ if (FD_ISSET(fds[x].fd, &readfds))
+ {
+ fds[x].revents |= POLLIN;
+ }
+ if (FD_ISSET(fds[x].fd, &writefds))
+ {
+ fds[x].revents |= POLLOUT;
+ }
+ if (FD_ISSET(fds[x].fd, &errorfds))
+ {
+ fds[x].revents |= POLLERR;
+ }
+ }
+
+ return ret;
+}
+
+#endif // defined(WIN32) || defined(__MINGW32__)
--- /dev/null
+/* LibMemcached
+ * Copyright (C) 2013 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2010 Brian Aker, Trond Norbye
+ * All rights reserved.
+ *
+ * Use and distribution licensed under the BSD license. See
+ * the COPYING file in the parent directory for full text.
+ *
+ * Summary: Implementation of poll by using select
+ *
+ */
+
+#pragma once
+
+#if defined(WIN32) || defined(__MINGW32__)
+
+#include <winsock2.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct pollfd
+{
+#ifdef WIN32
+ SOCKET fd;
+#else
+ int fd;
+#endif
+ short events;
+ short revents;
+} pollfd_t;
+
+typedef int nfds_t;
+
+#define POLLIN 0x0001
+#define POLLOUT 0x0004
+#define POLLERR 0x0008
+#define POLLHUP 0x010 /* Hung up. */
+#define POLLNVAL 0x020 /* Invalid polling request. */
+
+int poll(struct pollfd fds[], nfds_t nfds, int tmo);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // defined(WIN32) || defined(__MINGW32__)
+++ /dev/null
-# vim:ft=automake
-# included from Top Level Makefile.am
-# All paths should be given relative to the root
-noinst_HEADERS+= poll/poll.h
-
-if BUILD_POLL
-libmemcached_libmemcached_la_SOURCES += poll/poll.c
-endif
+++ /dev/null
-/* LibMemcached
- * Copyright (C) 2010 Brian Aker, Trond Norbye
- * All rights reserved.
- *
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
- *
- * Summary: Implementation of poll by using select
- *
- */
-#include "mem_config.h"
-
-#if defined(WIN32) || defined(__MINGW32__)
-# include <winsock2.h>
-# include <ws2tcpip.h>
-#endif
-
-#include <sys/time.h>
-#include <strings.h>
-
-#include "poll/poll.h"
-
-int poll(struct pollfd fds[], nfds_t nfds, int tmo)
-{
- fd_set readfds, writefds, errorfds;
- FD_ZERO(&readfds);
- FD_ZERO(&writefds);
- FD_ZERO(&errorfds);
-
- int maxfd= 0;
-
- for (nfds_t x= 0; x < nfds; ++x)
- {
- if (fds[x].events & (POLLIN | POLLOUT))
- {
-#ifndef WIN32
- if (fds[x].fd > maxfd)
- {
- maxfd= fds[x].fd;
- }
-#endif
- if (fds[x].events & POLLIN)
- {
- FD_SET(fds[x].fd, &readfds);
- }
- if (fds[x].events & POLLOUT)
- {
- FD_SET(fds[x].fd, &writefds);
- }
- }
- }
-
- struct timeval timeout= { .tv_sec = tmo / 1000,
- .tv_usec= (tmo % 1000) * 1000 };
- struct timeval *tp= &timeout;
- if (tmo == -1)
- {
- tp= NULL;
- }
- int ret= select(maxfd + 1, &readfds, &writefds, &errorfds, tp);
- if (ret <= 0)
- {
- return ret;
- }
-
- /* Iterate through all of them because I need to clear the revent map */
- for (nfds_t x= 0; x < nfds; ++x)
- {
- fds[x].revents= 0;
- if (FD_ISSET(fds[x].fd, &readfds))
- {
- fds[x].revents |= POLLIN;
- }
- if (FD_ISSET(fds[x].fd, &writefds))
- {
- fds[x].revents |= POLLOUT;
- }
- if (FD_ISSET(fds[x].fd, &errorfds))
- {
- fds[x].revents |= POLLERR;
- }
- }
-
- return ret;
-}
+++ /dev/null
-/* LibMemcached
- * Copyright (C) 2010 Brian Aker, Trond Norbye
- * All rights reserved.
- *
- * Use and distribution licensed under the BSD license. See
- * the COPYING file in the parent directory for full text.
- *
- * Summary: Implementation of poll by using select
- *
- */
-#ifndef POLL_POLL_H
-#define POLL_POLL_H 1
-
-#ifdef WIN32
-#include <winsock2.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef struct pollfd
-{
-#ifdef WIN32
- SOCKET fd;
-#else
- int fd;
-#endif
- short events;
- short revents;
-} pollfd_t;
-
-typedef int nfds_t;
-
-#define POLLIN 0x0001
-#define POLLOUT 0x0004
-#define POLLERR 0x0008
-
-int poll(struct pollfd fds[], nfds_t nfds, int tmo);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif