boolean locked = fptr.lock();
try {
fptr.checkWritable(context);
if (fptr.io_fflush(context) < 0)
throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
fptr.setNonblock(runtime);
try {
ByteList strByteList = ((RubyString) str).getByteList();
n = fptr.posix.write(fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), strByteList.getRealSize(), true);