I'm developing software for an embedded mips based platform using uClibc ntpl-svn 00891d9cf07efd992023f255164bba93d657ece4 compiled with gcc-4.4.3 (although gcc versions doesn't seem to matter). Reading the debug output of the pppd i found some nonsense error messages. Adding some extra lines to the code, i noticed errno was always holding the value of the requested filedescriptor using normal read/write operations. In order to isolate the bug i wrote the following testframe: int main(int argh, char **argv){ unsigned char buf[32]; int ter, sz; while (1) { puts("trying to read from non existing descriptor."); sz = read(666, buf, 16); ter = errno; puts("done."); if (sz < 0) { puts("read failed."); printf("errno holds a value of %d.\n", ter); } else puts("erg... read succeded?"); puts("---"); } return 0; } It showed up that errno really was set to 666 instead of EBADF (Bad file descriptor). I already added the patch labeled 'MIPS: restore INLINE_SYSCALL macro' hoping this would fix the issue, but it didn't. I have been digging through the change logs and I think this hasn't been fixed yet.
Fixed due to: 2010-06-30 mips/syscall-error: Choose the correct version for setting up errno. tnx