X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=src%2Flibmemcached%2Fpoll.h;h=8c0ad1ff25eb17af58bac306d8acc87ef712a692;hb=aeac01630eed825d8a624e7fd7c107d47bb2e40c;hp=46636c402e1d32b12d22a8f7abe2c94db59f54c9;hpb=5e760300d15ef4c5b7eed3fb9f37920ebca2f6ec;p=awesomized%2Flibmemcached diff --git a/src/libmemcached/poll.h b/src/libmemcached/poll.h index 46636c40..8c0ad1ff 100644 --- a/src/libmemcached/poll.h +++ b/src/libmemcached/poll.h @@ -1,48 +1,56 @@ -/* 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 - * - */ +/* + +--------------------------------------------------------------------+ + | libmemcached - C/C++ Client Library for memcached | + +--------------------------------------------------------------------+ + | Redistribution and use in source and binary forms, with or without | + | modification, are permitted under the terms of the BSD license. | + | You should have received a copy of the license in a bundled file | + | named LICENSE; in case you did not receive a copy you can review | + | the terms online at: https://opensource.org/licenses/BSD-3-Clause | + +--------------------------------------------------------------------+ + | Copyright (c) 2006-2014 Brian Aker https://datadifferential.com/ | + | Copyright (c) 2020 Michael Wallner | + +--------------------------------------------------------------------+ +*/ #pragma once -#if defined(_WIN32) - -#include +#if defined HAVE_SYS_POLL_H +# include +#elif defined HAVE_POLL_H +# include +#elif defined _WIN32 +# include "windows.hpp" +# define poll WSAPoll +typedef int nfds_t; +#elif !defined _MSC_VER -#ifdef __cplusplus +# ifdef __cplusplus extern "C" { -#endif +# endif -typedef struct pollfd -{ -#if defined(_WIN32) +typedef struct pollfd { +# if defined(_WIN32) SOCKET fd; -#else +# else int fd; -#endif +# 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. */ +# 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 +# ifdef __cplusplus } -#endif +# endif #endif // defined(_WIN32)