File-descriptor capabilities, implement libc write()