From bb6791da7cf37e326846edc44a7c32b79021f9da Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 1 Jun 2010 16:54:24 -0700 Subject: [PATCH] preliminary support for F_GETPIPE_SZ and F_SETPIPE_SZ One day soon (2.6.35), we'll be able to resize pipes. We may support this independently of the C library since that can take a few months/years to catch up, taking distro release cycles into account, too. --- ext/io_splice/extconf.rb | 2 ++ ext/io_splice/io_splice_ext.c | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/ext/io_splice/extconf.rb b/ext/io_splice/extconf.rb index cbc73ff..7729128 100644 --- a/ext/io_splice/extconf.rb +++ b/ext/io_splice/extconf.rb @@ -4,6 +4,8 @@ $CPPFLAGS << ' -D_GNU_SOURCE=1' have_func('splice', %w(fcntl.h)) or abort 'splice(2) not defined' have_func('tee', %w(fcntl.h)) or abort 'tee(2) not defined' have_func('rb_thread_blocking_region') +have_macro('F_GETPIPE_SZ', %w(fcntl.h)) +have_macro('F_SETPIPE_SZ', %w(fcntl.h)) dir_config('io_splice') create_makefile('io_splice_ext') diff --git a/ext/io_splice/io_splice_ext.c b/ext/io_splice/io_splice_ext.c index fe6405c..9fe5191 100644 --- a/ext/io_splice/io_splice_ext.c +++ b/ext/io_splice/io_splice_ext.c @@ -384,6 +384,15 @@ void Init_io_splice_ext(void) */ rb_define_const(mSplice, "F_GIFT", UINT2NUM(SPLICE_F_GIFT)); +#ifdef F_GETPIPE_SZ + /* :nodoc: */ + rb_define_const(mSplice, "F_GETPIPE_SZ", UINT2NUM(F_GETPIPE_SZ)); +#endif +#ifdef F_SETPIPE_SZ + /* :nodoc: */ + rb_define_const(mSplice, "F_SETPIPE_SZ", UINT2NUM(F_SETPIPE_SZ)); +#endif + /* * The maximum size of an atomic write to a pipe * POSIX requires this to be at least 512 bytes. -- 2.11.4.GIT