Skip to content

Commit

Permalink
[Truffle] Add File.chown.
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed Apr 30, 2015
1 parent bd3f182 commit 1ddc236
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
4 changes: 0 additions & 4 deletions spec/truffle/tags/core/file/chown_tags.txt

This file was deleted.

Expand Up @@ -42,6 +42,20 @@ public int chmod(RubyString path, int mode) {

}

@CoreMethod(names = "chown", isModuleFunction = true, required = 3)
public abstract static class ChownNode extends CoreMethodArrayArgumentsNode {

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

@Specialization
public int chown(RubyString path, int owner, int group) {
return posix().chown(path.toString(), owner, group);
}

}

@CoreMethod(names = "fchmod", isModuleFunction = true, required = 2)
public abstract static class FchmodNode extends CoreMethodArrayArgumentsNode {

Expand All @@ -56,6 +70,21 @@ public int fchmod(int one, int mode) {

}


@CoreMethod(names = "fchown", isModuleFunction = true, required = 3)
public abstract static class FchownNode extends CoreMethodArrayArgumentsNode {

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

@Specialization
public int fchown(int descriptor, int owner, int group) {
return posix().fchown(descriptor, owner, group);
}

}

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

Expand Down

0 comments on commit 1ddc236

Please sign in to comment.