зеркало из https://github.com/github/ruby.git
* process.c (get_sc_ngroups_max): define to wrap sysconf(3).
this also supports Windows which doesn't have sysconf(3). * process.c (maxgroups): use get_sc_ngroups_max. * process.c (proc_setmaxgroups): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31055 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
436d5dc6eb
Коммит
c57118f757
|
@ -1,3 +1,12 @@
|
|||
Tue Mar 8 01:43:11 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* process.c (get_sc_ngroups_max): define to wrap sysconf(3).
|
||||
this also supports Windows which doesn't have sysconf(3).
|
||||
|
||||
* process.c (maxgroups): use get_sc_ngroups_max.
|
||||
|
||||
* process.c (proc_setmaxgroups): ditto.
|
||||
|
||||
Tue Mar 8 01:16:49 2011 NARUSE, Yui <naruse@ruby-lang.org>
|
||||
|
||||
* gc.c (rb_objspace): an initializer must be a constant.
|
||||
|
|
12
process.c
12
process.c
|
@ -4542,10 +4542,18 @@ proc_setgid(VALUE obj, VALUE id)
|
|||
*/
|
||||
#define RB_MAX_GROUPS (65536)
|
||||
static int _maxgroups = -1;
|
||||
static int get_sc_ngroups_max(void)
|
||||
{
|
||||
#ifdef _SC_NGROUPS_MAX
|
||||
return (int)sysconf(_SC_NGROUPS_MAX);
|
||||
#else
|
||||
return 32;
|
||||
#endif
|
||||
}
|
||||
static int maxgroups(void)
|
||||
{
|
||||
if (_maxgroups < 0) {
|
||||
_maxgroups = (int)sysconf(_SC_NGROUPS_MAX);
|
||||
_maxgroups = get_sc_ngroups_max();
|
||||
if (_maxgroups < 0)
|
||||
_maxgroups = RB_MAX_GROUPS;
|
||||
}
|
||||
|
@ -4729,7 +4737,7 @@ static VALUE
|
|||
proc_setmaxgroups(VALUE obj, VALUE val)
|
||||
{
|
||||
int ngroups = FIX2INT(val);
|
||||
int ngroups_max = (int)sysconf(_SC_NGROUPS_MAX);
|
||||
int ngroups_max = get_sc_ngroups_max();
|
||||
|
||||
if (ngroups <= 0)
|
||||
rb_raise(rb_eArgError, "maxgroups %d shold be positive", ngroups);
|
||||
|
|
Загрузка…
Ссылка в новой задаче