Skip to main content

Practice · 1 of 4

Decode the Exit Status

CHALLENGE
Difficulty: advanced+25 XP

POSIX. run_exit_status(code) (given) forks a child that exits with code and returns the raw waitpid status word. Implement int decode_exit(int status) returning the child's exit code if it exited normally, or -1 if it did not exit normally. Remember: exit codes are the low 8 bits.

Back to lesson: Practice: Process Machinery Drills