Checking the return codes from system calls and dealing correctly with all the error cases that can arise is a very difficult task. Very rarely will a program deal with all possible cases correctly.
An unfortunate consequence of this is that programs can fail unexpectedly because some system call fails in a way that had not been anticipated. The consequences of this can range from a nasty “core dump” to a system that performs erratically at the customer location.
Insure++ has a special error class, RETURN_FAILURE
, that can be used to detect these problems. All the system calls known to Insure++ contain special error checking code that detects failures. Normally these errors are suppressed, since it is assumed that the application is handling them itself, but they can be enabled at runtime by unsuppressing RETURN_FAILURE
. Any system call that returns an error code will then print a message indicating the name of the routine, the arguments supplied, and the reason for the error.
This capability detects any error in any known system call. Among the potential benefits are automatic detection of errors in the following situations:
malloc
runs out of memory.Files that do not exist.
Incorrectly set permission flags.
Incorrect use of I/O routines.
Exceeding the limit on open files.
Inter-process communication and shared memory errors.
Unexpected “interrupted system call” errors.