/* * call-seq: * Process.groups => array * * Get an <code>Array</code> of the gids of groups in the * supplemental group access list for this process. * * Process.groups #=> [27, 6, 10, 11] * */ static VALUE proc_getgroups(VALUE obj) { #ifdef HAVE_GETGROUPS VALUE ary; size_t ngroups; rb_gid_t *groups; int i; groups = ALLOCA_N(rb_gid_t, maxgroups); ngroups = getgroups(maxgroups, groups); if (ngroups == -1) rb_sys_fail(0); ary = rb_ary_new(); for (i = 0; i < ngroups; i++) rb_ary_push(ary, INT2NUM(groups[i])); return ary; #else rb_notimplement(); return Qnil; #endif }