Name: Anonymous 2015-01-12 0:41
http://man7.org/linux/man-pages/man2/syscalls.2.html
So the system calls quite sensibly return a negative number to indicate an error, but then someone added code to be executed every single time a syscall is made just to check its return value and store that in a separate variable, turning all errors into -1? Now every time you use a syscall you have to check for errors and then pull the correct error number back out of
Note: system calls indicate a failure by returning a negative error number to the caller; when this happens, the wrapper function negates the returned error number (to make it positive), copies it to errno
, and returns -1 to the caller of the wrapper.
So the system calls quite sensibly return a negative number to indicate an error, but then someone added code to be executed every single time a syscall is made just to check its return value and store that in a separate variable, turning all errors into -1? Now every time you use a syscall you have to check for errors and then pull the correct error number back out of
errno
instead of straightforwardly passing the error value through as the return value? Which brain-damaged idiot thought this was a good idea!?