Skip to content

Commit da64697

Browse files
timfelcosminbasca
authored andcommitted
empty stub for os.fsync
1 parent 3d5211c commit da64697

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/PosixModuleBuiltins.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,4 +2042,18 @@ PNone killFallback(VirtualFrame frame, Object pid, Object signal,
20422042
return kill(frame, castInt.execute(pid), castInt.execute(signal), readSignalNode, isNode);
20432043
}
20442044
}
2045+
2046+
@Builtin(name = "fsync", minNumOfPositionalArgs = 1)
2047+
@GenerateNodeFactory
2048+
abstract static class FSyncNode extends PythonUnaryBuiltinNode {
2049+
@Specialization
2050+
PNone fsync(VirtualFrame frame, int fd) {
2051+
try {
2052+
getContext().getResources().fsync(fd);
2053+
} catch (ArrayIndexOutOfBoundsException e) {
2054+
throw raiseOSError(frame, OSErrorEnum.ENOENT.getNumber());
2055+
}
2056+
return PNone.NONE;
2057+
}
2058+
}
20452059
}

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/runtime/PosixResources.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,10 @@ public int dup(int fd) {
209209
return dupFd;
210210
}
211211

212+
public void fsync(int fd) throws ArrayIndexOutOfBoundsException {
213+
files.get(fd); // for the side-effect
214+
}
215+
212216
@TruffleBoundary(allowInlining = true)
213217
public int[] pipe() throws IOException {
214218
Pipe pipe = Pipe.open();

0 commit comments

Comments
 (0)