Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:michals
ruby2.5
0008-io-move-poll-defines-to-internal-io.h.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0008-io-move-poll-defines-to-internal-io.h.patch of Package ruby2.5
From e34392ad2821dbbc64dc79a66a78091b97b07d69 Mon Sep 17 00:00:00 2001 From: Michal Suchanek <msuchanek@suse.de> Date: Wed, 5 Feb 2020 22:31:42 +0100 Subject: [PATCH 08/19] io: move poll defines to internal/io.h USE_POLL is defined in io.c and thread.c with different semantic. Move to internal/io.h and adjust the #ifdef to #if. Also move POLL*_SETs. Define POLLERR_SET on Linux as well. This genereates a little more code in rb_wait_for_single_fd compated to teh case when it was defined to 0 but should not impact result. We need POLLERR_SET defined for checking errors. Signed-off-by: Michal Suchanek <msuchanek@suse.de> --- internal.h | 21 +++++++++++++++++++++ thread.c | 17 +---------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/internal.h b/internal.h index 2e2fa7ba75c0..21bc37ba7ac4 100644 --- a/internal.h +++ b/internal.h @@ -79,6 +79,27 @@ extern "C" { # define __has_extension __has_feature #endif +/* non-Linux poll may not work on all FDs */ +#if defined(HAVE_POLL) +# if defined(__linux__) +# define USE_POLL 1 +# endif +# if defined(__FreeBSD_version) && __FreeBSD_version >= 1100000 +# define USE_POLL 1 +# endif +#endif + +#ifndef USE_POLL +# define USE_POLL 0 +#endif + +#if USE_POLL +#define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN) +#define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT) +#define POLLEX_SET (POLLPRI) +#define POLLERR_SET (POLLHUP | POLLERR) +#endif + #if GCC_VERSION_SINCE(4, 6, 0) || __has_extension(c_static_assert) # define STATIC_ASSERT(name, expr) _Static_assert(expr, #name ": " #expr) #else diff --git a/thread.c b/thread.c index 0cf48e38c61d..afbddc563cd0 100644 --- a/thread.c +++ b/thread.c @@ -3890,22 +3890,7 @@ rb_thread_fd_select(int max, rb_fdset_t * read, rb_fdset_t * write, rb_fdset_t * return do_select(max, read, write, except, timeout); } -/* - * poll() is supported by many OSes, but so far Linux is the only - * one we know of that supports using poll() in all places select() - * would work. - */ -#if defined(HAVE_POLL) && defined(__linux__) -# define USE_POLL -#endif - -#ifdef USE_POLL - -/* The same with linux kernel. TODO: make platform independent definition. */ -#define POLLIN_SET (POLLRDNORM | POLLRDBAND | POLLIN | POLLHUP | POLLERR) -#define POLLOUT_SET (POLLWRBAND | POLLWRNORM | POLLOUT | POLLERR) -#define POLLEX_SET (POLLPRI) - +#if USE_POLL #ifndef HAVE_PPOLL /* TODO: don't ignore sigmask */ int -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor