From bd90dc80f29a09376e04f5f1b6adbe17806a67fa Mon Sep 17 00:00:00 2001 From: kosaki Date: Thu, 10 Mar 2011 16:54:02 +0000 Subject: [PATCH] * process.c (proc_getmaxgroups, proc_setmaxgroups): Process#maxgroups and Process#maxgroups= now raise NotImplementedError if the platform don't support supplementary groups concept. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31090 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ NEWS | 4 ++++ process.c | 12 ++++++++++-- test/ruby/test_process.rb | 1 + 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b80aa2d76f..3d2411f68c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Mar 11 01:40:35 2011 KOSAKI Motohiro + + * process.c (proc_getmaxgroups, proc_setmaxgroups): Process#maxgroups + and Process#maxgroups= now raise NotImplementedError if the + platform don't support supplementary groups concept. + Fri Mar 11 01:25:03 2011 KOSAKI Motohiro * process.c (get_sc_ngroups_max): return -1 if platform don't diff --git a/NEWS b/NEWS index b6a49d3ea9..fca7558321 100644 --- a/NEWS +++ b/NEWS @@ -80,6 +80,10 @@ with all sufficient information, see the ChangeLog file. * extended method: * Time#strftime supports %:z and %::z. + * Process + * Process#maxgroups and Process#maxgroups= now raise NotImplementedError if + the platform don't support supplementary groups concept. + * io/console * new methods: * IO#noecho {|io| } diff --git a/process.c b/process.c index f3138afa80..24e7bf9162 100644 --- a/process.c +++ b/process.c @@ -4524,6 +4524,7 @@ proc_setgid(VALUE obj, VALUE id) #endif +#if defined(HAVE_SETGROUPS) || defined(HAVE_GETGROUPS) /* * Maximum supplementary groups are platform dependent. * FWIW, 65536 is enough big for our supported OSs. @@ -4566,6 +4567,7 @@ static int maxgroups(void) return _maxgroups; } +#endif @@ -4719,7 +4721,7 @@ proc_initgroups(VALUE obj, VALUE uname, VALUE base_grp) #define proc_initgroups rb_f_notimplement #endif - +#if defined(_SC_NGROUPS_MAX) || defined(NGROUPS_MAX) /* * call-seq: * Process.maxgroups -> fixnum @@ -4735,8 +4737,11 @@ proc_getmaxgroups(VALUE obj) { return INT2FIX(maxgroups()); } +#else +#define proc_getmaxgroups rb_f_notimplement +#endif - +#ifdef HAVE_SETGROUPS /* * call-seq: * Process.maxgroups= fixnum -> fixnum @@ -4764,6 +4769,9 @@ proc_setmaxgroups(VALUE obj, VALUE val) return INT2FIX(_maxgroups); } +#else +#define proc_setmaxgroups rb_f_notimplement +#endif #if defined(HAVE_DAEMON) || (defined(HAVE_FORK) && defined(HAVE_SETSID)) #ifndef HAVE_DAEMON diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index f3f3f9eb80..39c8b18966 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -1158,6 +1158,7 @@ class TestProcess < Test::Unit::TestCase def test_maxgroups assert_kind_of(Integer, Process.maxgroups) + rescue NotImplementedError end def test_geteuid