3 ms·
Imho, this is an area where the limitations of C shine through. Some kernels return error status as a CPU flag or otherwise separately from the returned value.
by toast0 1y ago
Imho, this is an area where the limitations of C shine through.
Some kernels return error status as a CPU flag or otherwise separately from the returned value. But that's very hard to use in C, so the typical convention for a syscall wrapper is to return a non-negative number for success and -error for failure, but if negative numbers are valid as the return, you've got to do something else.
- JdeBP 1y agoHard‽ Small POD structures returned in register pairs has been a feature of C compiler calling conventions for over 3 decades, and was around in C compilers in the 16-bit era. * https://jdebp.uk/FGA/function-calling-conventions.html#Watcall16R https://jdebp.uk/FGA/function-calling-conventions.html#Watca...