ByteList strByteList = ((RubyString) str).getByteList();
n = OpenFile.writeInternal(context, fptr, fptr.fd(), strByteList.unsafeBytes(), strByteList.begin(), strByteList.getRealSize());
if (n == -1) throw runtime.newErrnoFromErrno(fptr.errno(), fptr.getPath());
} finally {
if (locked) fptr.unlock();
}
return runtime.newFixnum(n);
}