Skip to content

Commit

Permalink
[Truffle] Add File.{rdev,nlinks,blocks}
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed May 2, 2015
1 parent 333fb28 commit 6e2f794
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 12 deletions.
10 changes: 0 additions & 10 deletions spec/truffle/tags/core/file/size_tags.txt
Original file line number Diff line number Diff line change
@@ -1,14 +1,4 @@
fails:File.size? calls #to_io to convert the argument to an IO
fails:File.size? accepts a File argument
fails:File.size calls #to_io to convert the argument to an IO
fails:File.size accepts a File argument
fails:File#size returns the file's size as a Fixnum
fails:File#size returns the file's size in bytes
fails:File#size returns the cached size of the file if subsequently deleted
fails:File#size returns the file's current size even if modified
fails:File#size raises an IOError on a closed file
fails:File#size follows symlinks if necessary
fails:File#size for an empty file returns 0
windows:File.size? returns the size of the file if it exists and is not empty
windows:File.size? returns nil if file_name doesn't exist or has 0 size
windows:File.size? returns nil if file_name is empty
1 change: 0 additions & 1 deletion spec/truffle/tags/core/file/stat/nlink_tags.txt

This file was deleted.

1 change: 0 additions & 1 deletion spec/truffle/tags/core/file/stat/rdev_tags.txt

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,34 @@ public Object mtime(VirtualFrame frame, RubyBasicObject rubyStat) {

}

@RubiniusPrimitive(name = "stat_nlink")
public static abstract class NlinkPrimitiveNode extends StatReadPrimitiveNode {

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

@Specialization
public int nlink(RubyBasicObject rubyStat) {
return getStat(rubyStat).nlink();
}

}

@RubiniusPrimitive(name = "stat_rdev")
public static abstract class RdevPrimitiveNode extends StatReadPrimitiveNode {

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

@Specialization
public long rdev(RubyBasicObject rubyStat) {
return getStat(rubyStat).rdev();
}

}

@RubiniusPrimitive(name = "stat_blksize")
public static abstract class StatBlksizePrimitiveNode extends StatReadPrimitiveNode {

Expand All @@ -84,6 +112,20 @@ public long blksize(RubyBasicObject rubyStat) {

}

@RubiniusPrimitive(name = "stat_blocks")
public static abstract class StatBlocksPrimitiveNode extends StatReadPrimitiveNode {

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

@Specialization
public long blocks(RubyBasicObject rubyStat) {
return getStat(rubyStat).blocks();
}

}

@RubiniusPrimitive(name = "stat_dev")
public static abstract class StatDevPrimitiveNode extends StatReadPrimitiveNode {

Expand Down

0 comments on commit 6e2f794

Please sign in to comment.