this is a bit broken... ret is not updated with the return value from the system call...