[haiku-development] Re: POSIX error code

  • From: Andreas Färber <andreas.faerber@xxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Wed, 21 May 2008 10:59:16 +0200


Am 21.05.2008 um 01:42 schrieb Ingo Weinhold:


On 2008-05-21 at 01:05:51 [+0200], kaoutsis <kaoutsis@xxxxxx> wrote:
Ingo Weinhold wrote:
wrote:
Anyway, it certainly doesn't harm to try, but I have little hope that this will have any effect. If the standard maintainers consider the request, they are in a dilemma. Undoing the Issue 6 error codes change means that
all the applications that relied on it would become non-conforming.


I agree.
I had an idea how to tackle the problem, may be good, may be bad:

The main problem is not binary compatibility. The problem is that the Be API
requires that error codes be negative. E.g. create_sem() returns a
non-negative value (the sem_id) when successful, a negative error code
otherwise. A good deal of other functions/methods use the same strategy, and so does third party code. Making our error codes positive will break them all.

Can't you just return -B_ERROR_CODE, with B_ERROR_CODE positive? :-)

An error code is not necessarily equivalent to the return code, and Posix can't possibly dictate return values of non-Posix APIs. I believe I saw some software adding that negation some months ago, possibly QEMU.

Andreas

Other related posts: