From: Brian Aker Date: Tue, 12 Jun 2012 21:58:09 +0000 (+0100) Subject: Simple "print the state of poll" function. X-Git-Tag: 1.0.9~24 X-Git-Url: https://git.m6w6.name/?p=m6w6%2Flibmemcached;a=commitdiff_plain;h=40d1c3bac1391e8872151c1088b3f655b510db07 Simple "print the state of poll" function. --- diff --git a/libtest/include.am b/libtest/include.am index ecec6aab..8d2694bc 100644 --- a/libtest/include.am +++ b/libtest/include.am @@ -70,6 +70,7 @@ noinst_HEADERS+= libtest/is_local.hpp noinst_HEADERS+= libtest/killpid.h noinst_HEADERS+= libtest/libtool.hpp noinst_HEADERS+= libtest/memcached.h +noinst_HEADERS+= libtest/poll_error.hpp noinst_HEADERS+= libtest/port.h noinst_HEADERS+= libtest/runner.h noinst_HEADERS+= libtest/server.h diff --git a/libtest/poll_error.hpp b/libtest/poll_error.hpp new file mode 100644 index 00000000..b75066f9 --- /dev/null +++ b/libtest/poll_error.hpp @@ -0,0 +1,100 @@ +/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab: + * + * Data Differential YATL (i.e. libtest) library + * + * Copyright (C) 2012 Data Differential, http://datadifferential.com/ + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * + * * The names of its contributors may not be used to endorse or + * promote products derived from this software without specific prior + * written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +/* + Structures for generic tests. +*/ + +#include +#include + +void print_poll(pollfd& fds) +{ + if (fds.revents & POLLERR) + { + fprintf(stderr, "\tPOLLERR\n"); + } + + if (fds.revents & POLLHUP) + { + fprintf(stderr, "\tPOLLHUP\n"); + } + + if (fds.revents & POLLIN) + { + fprintf(stderr, "\tPOLLIN\n"); + } + + if (fds.revents & POLLIN) + { + fprintf(stderr, "\tPOLLIN\n"); + } + + if (fds.revents & POLLNVAL) + { + fprintf(stderr, "\tPOLLNVAL\n"); + } + + if (fds.revents & POLLOUT) + { + fprintf(stderr, "\tPOLLOUT\n"); + } + + if (fds.revents & POLLPRI) + { + fprintf(stderr, "\tPOLLPRI\n"); + } + + if (fds.revents & POLLRDBAND) + { + fprintf(stderr, "\tPOLLPRI\n"); + } + + if (fds.revents & POLLRDNORM) + { + fprintf(stderr, "\tPOLLRDNORM\n"); + } + + if (fds.revents & POLLWRBAND) + { + fprintf(stderr, "\tPOLLWRBAND\n"); + } + + if (fds.revents & POLLWRNORM) + { + fprintf(stderr, "\tPOLLWRNORM\n"); + } +}