Complete implementation of sys_writev