sleepy_penguin RubyGem user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Eric Wong <normalperson@yhbt.net>
To: sleepy.penguin@librelist.org
Subject: Re: [sleepy.penguin] dropping signalfd() support
Date: Tue, 26 Jul 2011 17:23:56 -0700	[thread overview]
Message-ID: <20110727002356.GA28562@dcvr.yhbt.net> (raw)
In-Reply-To: <20110519234552.GA30264@dcvr.yhbt.net>

Eric Wong <normalperson@yhbt.net> wrote:
> Eric Wong <normalperson@yhbt.net> 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 <normalperson@yhbt.net>
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


      reply	other threads:[~2011-07-27  0:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-15  1:09 [sleepy.penguin] dropping signalfd() support Eric Wong
2011-05-19 23:45 ` Eric Wong
2011-07-27  0:23   ` Eric Wong [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/sleepy_penguin/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110727002356.GA28562@dcvr.yhbt.net \
    --to=normalperson@yhbt.net \
    --cc=sleepy.penguin@librelist.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/sleepy_penguin.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).