APIdock / Ruby
/
method

groups

ruby latest stable - Class: Process
groups()
public

Get an Array 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)
{
 VALUE ary, tmp;
 int i, ngroups;
 rb_gid_t *groups;
 ngroups = getgroups(0, NULL);
 if (ngroups == -1)
 rb_sys_fail(0);
 groups = ALLOCV_N(rb_gid_t, tmp, ngroups);
 ngroups = getgroups(ngroups, groups);
 if (ngroups == -1)
 rb_sys_fail(0);
 ary = rb_ary_new();
 for (i = 0; i < ngroups; i++)
 rb_ary_push(ary, GIDT2NUM(groups[i]));
 ALLOCV_END(tmp);
 return ary;
}

AltStyle によって変換されたページ (->オリジナル) /