From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-2.9 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, T_RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-source-folder: /home/ew/Mail/a.yhbt/2011-10.mbox.gz Return-Path: X-Original-To: normalperson@yhbt.net Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 8179529682E; Wed, 27 Jul 2011 00:24:05 +0000 (UTC) Date: Tue, 26 Jul 2011 17:23:56 -0700 From: Eric Wong To: sleepy.penguin@librelist.org Subject: Re: [sleepy.penguin] dropping signalfd() support Message-ID: <20110727002356.GA28562@dcvr.yhbt.net> References: <20110515010912.GA31986@dcvr.yhbt.net> <20110515010912.GA31986@dcvr.yhbt.net> <20110519234552.GA30264@dcvr.yhbt.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110519234552.GA30264@dcvr.yhbt.net> User-Agent: Mutt/1.5.21 (2010-09-15) List-Id: Eric Wong wrote: > Eric Wong wrote: > > Expect this to be dropped in the next release. > > I'll just keep it in case somebody wants to have fun with it, but it's > not recommended and now documented as so in sleepy_penguin.git Code is still there and trivial to re-enable by editing extconf.rb, but I've disabled it: >From c77c7e4cf7f2850d7163db3fcbed5a0ef829edb9 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 26 Jul 2011 17:11:43 -0700 Subject: [PATCH] disable SignalFD interface It's a waste of memory to have something that has no chance of working reliably with any existing Ruby runtimes. --- README | 2 +- ext/sleepy_penguin/epoll.c | 3 +-- ext/sleepy_penguin/extconf.rb | 7 +++++-- ext/sleepy_penguin/signalfd.c | 5 ++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README b/README index e26b2c6..c32840f 100644 --- a/README +++ b/README @@ -2,7 +2,7 @@ sleepy_penguin provides access to newer, Linux-only system calls to wait on events from traditionally non-I/O sources. Bindings to the eventfd, -timerfd, inotify, signalfd and epoll interfaces are provided. +timerfd, inotify, and epoll interfaces are provided. == Features diff --git a/ext/sleepy_penguin/epoll.c b/ext/sleepy_penguin/epoll.c index 54edc87..fd23594 100644 --- a/ext/sleepy_penguin/epoll.c +++ b/ext/sleepy_penguin/epoll.c @@ -733,7 +733,7 @@ void sleepy_penguin_init_epoll(void) * require "sleepy_penguin" * include SleepyPenguin * - * The SleepyPenguin namespace includes the Epoll, Inotify, SignalFD, + * The SleepyPenguin namespace includes the Epoll, Inotify, * TimerFD, EventFD classes in its top level and no other constants. * * If you are uncomfortable including SleepyPenguin, you may also @@ -746,7 +746,6 @@ void sleepy_penguin_init_epoll(void) * - SP::Epoll * - SP::EventFD * - SP::Inotify - * - SP::SignalFD * - SP::TimerFD */ mSleepyPenguin = rb_define_module("SleepyPenguin"); diff --git a/ext/sleepy_penguin/extconf.rb b/ext/sleepy_penguin/extconf.rb index 724309a..fe8e1ac 100644 --- a/ext/sleepy_penguin/extconf.rb +++ b/ext/sleepy_penguin/extconf.rb @@ -2,10 +2,13 @@ require 'mkmf' have_header('sys/epoll.h') or abort 'sys/epoll.h not found' have_header("pthread.h") or abort 'pthread.h not found' have_header('sys/eventfd.h') -have_header('sys/signalfd.h') + +# it's impossible to use signalfd reliably with Ruby since Ruby currently +# manages # (and overrides) all signal handling +# have_header('sys/signalfd.h') + have_header('sys/timerfd.h') have_header('sys/inotify.h') -have_header('sys/signalfd.h') have_header('ruby/io.h') and have_struct_member('rb_io_t', 'fd', 'ruby/io.h') have_func('epoll_create1', %w(sys/epoll.h)) have_func('rb_thread_blocking_region') diff --git a/ext/sleepy_penguin/signalfd.c b/ext/sleepy_penguin/signalfd.c index b837359..59eb05f 100644 --- a/ext/sleepy_penguin/signalfd.c +++ b/ext/sleepy_penguin/signalfd.c @@ -242,6 +242,9 @@ void sleepy_penguin_init_signalfd(void) * Use of this class is NOT recommended. Ruby itself has a great * signal handling API and its implementation conflicts with this. * + * This class is currently disabled and the documentation is only + * provided to describe what it would look like. + * * A SignalFD is an IO object for accepting signals. It provides * an alternative to Signal.trap that may be monitored using * IO.select or Epoll. @@ -251,7 +254,7 @@ void sleepy_penguin_init_signalfd(void) * decent signal handling interface anyways, this class is less useful * than signalfd() in a C-only environment. * - * It is not supported at all under (Matz) Ruby 1.8. + * It is not supported at all. */ cSignalFD = rb_define_class_under(mSleepyPenguin, "SignalFD", rb_cIO); -- Eric Wong