wrote code for do_waitpid