Skip to content

Commit

Permalink
[Truffle] Add Process.getpgrp
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed May 27, 2015
1 parent 7c1f6e5 commit 8004916
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
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 = "getpgrp", isModuleFunction = true)
public abstract static class GetpgrpNode extends CoreMethodArrayArgumentsNode {

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

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

}

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

Expand Down
6 changes: 6 additions & 0 deletions truffle/src/main/ruby/core/rubinius/common/process.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ def maxgroups=(m)
end
end

def self.getpgrp
ret = FFI::Platform::POSIX.getpgrp
Errno.handle if ret == -1
ret
end

def self.uid
ret = FFI::Platform::POSIX.getuid
Errno.handle if ret == -1
Expand Down

0 comments on commit 8004916

Please sign in to comment.