if ((openFile.getMode() & OpenFile.WRITABLE) != 0) {
flush();
}
try {
FileStat stat = runtime.getPosix().fstat(
getOpenFileChecked().getMainStreamSafe().getDescriptor().getFileDescriptor());
if (stat == null) {
throw runtime.newErrnoEACCESError(path);
}
return runtime.newFixnum(stat.st_size());
} catch (BadDescriptorException e) {
throw runtime.newErrnoEBADFError();
}
}