Bug 1891 - MIPS: errno variable bugged in ntpl branch
Summary: MIPS: errno variable bugged in ntpl branch
Status: RESOLVED FIXED
Alias: None
Product: uClibc
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: Other Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-01 19:20 UTC by Hendrik Bartusch
Modified: 2010-07-14 17:57 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hendrik Bartusch 2010-06-01 19:20:05 UTC
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.
Comment 1 Hendrik Bartusch 2010-07-14 17:04:28 UTC
Fixed due to:

2010-06-30	mips/syscall-error: Choose the correct version for setting up errno.

tnx