Error Handling
All system calls return -1 if an error occurs
errno:
- global variable that holds the numeric code of the last system call
perror():
- a subroutine that describes system call errors
Every process has errno initialized to zero at process creation time
When a system call error occurs, errno is set
See /usr/include/sys/errno.h
A successful system call never affects the current value of errno
An unsuccessful system call always overwrites the current value of errno