Skip to content

Commit

Permalink
[Truffle] Add File.flock
Browse files Browse the repository at this point in the history
  • Loading branch information
bjfish committed May 2, 2015
1 parent 6e2f794 commit 2f35b40
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/file/flock_tags.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
fails:File#flock exclusively locks a file
fails:File#flock non-exclusively locks a file
fails:File#flock returns false if trying to lock an exclusively locked file
fails:File#flock blocks if trying to lock an exclusively locked file
fails:File#flock returns 0 if trying to lock a non-exclusively locked file
fails:File#flock fails with EBADF acquiring exclusive lock on read-only File
Expand Down
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/file/grpowned_tags.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
fails:File.grpowned? takes non primary groups into account
fails(windows):File.grpowned? returns false if the file exist
fails:File.grpowned? returns true if the file exist
fails:File.grpowned? accepts an object that has a #to_path method
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/file/lstat_tags.txt

This file was deleted.

3 changes: 0 additions & 3 deletions spec/truffle/tags/core/file/open_tags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ fails:File.open raises a SystemCallError if passed an invalid Integer type
fails:File.open with a block does not raise error when file is closed inside the block
fails:File.open with a block does not propagate StandardErrors produced by close
fails:File.open on a FIFO opens it as a normal file
fails:File.open when passed a file descriptor opens a file
fails:File.open when passed a file descriptor opens a file when passed a block
fails:File.open opens directories
fails:File.open opens a file with a file descriptor d and a block
fails:File.open with a block propagates StandardErrors produced by close
3 changes: 0 additions & 3 deletions spec/truffle/tags/core/file/realdirpath_tags.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
fails:File.realdirpath returns '/' when passed '/'
fails:File.realdirpath returns the real (absolute) pathname not containing symlinks
fails:File.realdirpath uses base directory for interpreting relative pathname
fails:File.realdirpath uses current directory for interpreting relative pathname
fails:File.realdirpath uses link directory for expanding relative links
fails:File.realdirpath raises an Errno::ELOOP if the symlink points to itself
fails:File.realdirpath returns the real (absolute) pathname if the file is absent
fails:File.realdirpath raises Errno::ENOENT if the directory is absent
fails:File.realdirpath returns the real (absolute) pathname if the symlink points to an absent file
fails:File.realdirpath raises Errno::ENOENT if the symlink points to an absent directory
2 changes: 0 additions & 2 deletions spec/truffle/tags/core/filetest/grpowned_tags.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
fails:FileTest.grpowned? takes non primary groups into account
fails:FileTest.grpowned? returns true if the file exist
fails:FileTest.grpowned? accepts an object that has a #to_path method
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,20 @@ public int chdir(RubyString path) {

}

@CoreMethod(names = "flock", isModuleFunction = true, required = 2, lowerFixnumParameters = {0, 1})
public abstract static class FlockNode extends PointerPrimitiveNodes.ReadAddressPrimitiveNode {

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

@Specialization
public int flock(int fd, int constant) {
return posix().flock(fd, constant);
}

}

@CoreMethod(names = "rmdir", isModuleFunction = true, required = 1)
public abstract static class RmdirNode extends PointerPrimitiveNodes.ReadAddressPrimitiveNode {

Expand Down

0 comments on commit 2f35b40

Please sign in to comment.