[prev] 17 [next]

Failed System Calls

System calls attempt to perform actions, but may fail

User programs can detect this in several ways

  • check return value of sys call function  (-1 typically flags an error)
  • check global variable errno  (contains specific error)
C programs need to check and handle errors themselves
  • unlike other languages, C provides no exception handling
Note: successful system calls generally return 0
  • unless the system call has a result value  (e.g. #bytes read)