Skip to content

Commit e34bf1b

Browse files
committed
[Truffle] Add Process.gid=
1 parent acfc717 commit e34bf1b

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

truffle/src/main/java/org/jruby/truffle/nodes/rubinius/PosixNodes.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,20 @@ public int getpriority(int kind, int id) {
351351

352352
}
353353

354+
@CoreMethod(names = "setgid", isModuleFunction = true, required = 1, lowerFixnumParameters = 0)
355+
public abstract static class SetgidNode extends CoreMethodArrayArgumentsNode {
356+
357+
public SetgidNode(RubyContext context, SourceSection sourceSection) {
358+
super(context, sourceSection);
359+
}
360+
361+
@Specialization
362+
public int setgid(int gid) {
363+
return posix().setgid(gid);
364+
}
365+
366+
}
367+
354368
@CoreMethod(names = "setpriority", isModuleFunction = true, required = 3, lowerFixnumParameters = {0, 1, 2})
355369
public abstract static class SetPriorityNode extends CoreMethodArrayArgumentsNode {
356370

truffle/src/main/ruby/core/rubinius/common/process.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ def self.uid=(uid)
130130
uid
131131
end
132132

133+
def self.gid=(gid)
134+
gid = Rubinius::Type.coerce_to gid, Integer, :to_int
135+
Process::Sys.setgid gid
136+
end
137+
133138
def self.euid=(uid)
134139
# the 4 rescue clauses below are needed
135140
# until respond_to? can be used to query the implementation of methods attached via FFI

0 commit comments

Comments
 (0)