Andreas Beck wrote:
>
> Marcus Sundberg <[EMAIL PROTECTED]> wrote:
> > Seems there was a bug in the kgicon layer, simply passing the
> > return value from the driver on to userspace. The following
> > diff fixes that:
>
> STOP ! One cannot send differentiated return codes with that diff !
> I.e. you only ever get O.K. or EINVAL, no chance to give a better suited
> code.
This was intentional.
> It is correct to give back the KGI subsystem return code. Please reverse
> that patch.
Can't do that until the KGI error codes are fixed, or remapped to
some KGIcon specific error codes (see below). The above patch is
enough for a fully functional KGIcon anyway.
> If the ioctl library call does not behave like it is documented,
> this is a bug in libc, and not in our drivers. For the Linux kernel ioctl
> layer it is the correct behaviour to return negative values to indicate
> errors, which should make libc return -1 and set errno.
No, it's correct to return a value < 0 && >= -4095 for errors, not
any negative value. A comment in libc tells why:
/* Linux uses a negative return value to indicate syscall errors,
unlike most Unices, which use the condition codes' carry flag.
Since version 2.1 the return value of a system call might be
negative even if the call succeeded. E.g., the `lseek' system call
might return a large offset. Therefore we must not anymore test
for < 0, but test for a real error by making sure the value in %eax
is a real error number. Linus said he will make sure the no syscall
returns a value in -1 .. -4095 as a valid result so we can savely
test with -4095. */
//Marcus
--
-------------------------------+------------------------------------
Marcus Sundberg | http://www.stacken.kth.se/~mackan
Royal Institute of Technology | Phone: +46 707 295404
Stockholm, Sweden | E-Mail: [EMAIL PROTECTED]