More faithful port of strio_read.
Rename "data" to "ptr" to more closely match MRI source.