Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:michals
ruby2.7
0001-io-move-poll-defines-to-internal-io.h.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-io-move-poll-defines-to-internal-io.h.patch of Package ruby2.7
From a84e3be93338584bd507716ba4e78fcdf13148fe Mon Sep 17 00:00:00 2001 From: Michal Suchanek <msuchanek@suse.de> Date: Wed, 5 Feb 2020 22:31:42 +0100 Subject: [PATCH 01/12] 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 | 27 +-------------------------- 2 files changed, 22 insertions(+), 26 deletions(-) diff --git a/internal.h b/internal.h index d5f1b93b39dd..fff0a7a0d03d 100644 --- a/internal.h +++ b/internal.h @@ -123,6 +123,27 @@ extern "C" { # define __msan_unpoison_string(x) ((void)(x)) #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 + /*! * This function asserts that a (continuous) memory region from ptr to size * being "poisoned". Both read / write access to such memory region are diff --git a/thread.c b/thread.c index 708aaa471d99..914e5d4dac56 100644 --- a/thread.c +++ b/thread.c @@ -221,22 +221,6 @@ vm_living_thread_num(const rb_vm_t *vm) return vm->living_thread_num; } -/* - * 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) -# if defined(__linux__) -# define USE_POLL -# endif -# if defined(__FreeBSD_version) && __FreeBSD_version >= 1100000 -# define USE_POLL - /* FreeBSD does not set POLLOUT when POLLHUP happens */ -# define POLLERR_SET (POLLHUP | POLLERR) -# endif -#endif - static void timeout_prepare(rb_hrtime_t **to, rb_hrtime_t *rel, rb_hrtime_t *end, const struct timeval *timeout) @@ -4115,16 +4099,7 @@ rb_thread_fd_select(int max, rb_fdset_t * read, rb_fdset_t * write, rb_fdset_t * return (int)rb_ensure(do_select, (VALUE)&set, select_set_free, (VALUE)&set); } -#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) - -#ifndef POLLERR_SET /* defined for FreeBSD for now */ -# define POLLERR_SET (0) -#endif +#if USE_POLL /* * returns a mask of events -- 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