> >> What is the reason to the change of return -EIO (etc) to return > >> RETERROR(EIO)? > >> > > > > I already explained it I think, we have error codes defined as > > negative > > values, as BeOS did. > > see http://dev.haiku-os.org/browser/haiku/trunk/headers/os/support/Errors.h > > > > > I see. This approach was also used by Minix. For this reason OSS used
Aw, I didn't know it did that... oh that's actually just in the kernel: https://gforge.cs.vu.nl/plugins/scmsvn/viewcvs.php/trunk/src/include/errno.h?rev=3075&root=minix&view=markup Quite weird (and dangerous) IMO. > such macro from the very first version. However it was replaced by > return -Exxx recently. There were some nasty errors caused by use of > the > macro. I don't see what can possibly be wrong with it, as long as it's used correctly (ie to compare a returned value with if (ret == RETERROR(EFOO))). > Might it be possible that the Haiku port doesn't include <errno.h> > but > "oss_haiku_errno.h" that defines the few errno codes used by OSS as > positive numbers. This should be safe since the errno codes used by > Haiku will probably never change. In this way the drivers don't need > to > be changed. This is definitely not an option, I recall we tried this way with ffmpeg and it was very bad. Defining the same thing to different things in different places is just too dangerous. Besides errno itself would have to be redefined too, as it does hold EINVAL directly, and so as negative numbers. This is just too ugly. Defining project-specific error codes usually doesn't work either, they don't get used. The macro can be defined conditionally on __HAIKU__ || __BEOS__ || MINIX instead of (EINVAL > 0) in case one is afraid EINVAL isn't evaluable by cpp on all platforms (it was actually the case on BeOS and I didn't notice, so the sign of the check matters). Really, I've used this way in several other projects, and it works just fine. François. _______________________________________________ oss-devel mailing list oss-devel@mailman.opensound.com http://mailman.opensound.com/mailman/listinfo/oss-devel