Skip to content

Commit

Permalink
[Truffle] Add Process.getpgid
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed May 27, 2015
1 parent 47dc1aa commit d0c1512
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 3 deletions.
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/process/getpgid_tags.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,20 @@ public int fcntl(int fd, int fcntl, int arg) {

}

@CoreMethod(names = "getpgid", isModuleFunction = true, required = 1)
public abstract static class GetpgidNode extends CoreMethodArrayArgumentsNode {

public GetpgidNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@Specialization
public int getpgid(int pid) {
return posix().getpgid(pid);
}

}

@CoreMethod(names = "getpgrp", isModuleFunction = true)
public abstract static class GetpgrpNode extends CoreMethodArrayArgumentsNode {

Expand Down
8 changes: 8 additions & 0 deletions truffle/src/main/ruby/core/rubinius/common/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,14 @@ def self.times
Struct::Tms.new(*cpu_times)
end

def self.getpgid(pid)
pid = Rubinius::Type.coerce_to pid, Integer, :to_int

ret = FFI::Platform::POSIX.getpgid(pid)
Errno.handle if ret == -1
ret
end

@maxgroups = 32
class << self
attr_reader :maxgroups
Expand Down

0 comments on commit d0c1512

Please sign in to comment.