[beports] Re: POSIX functions

  • From: Andreas Färber <andreas.faerber@xxxxxx>
  • To: beports@xxxxxxxxxxxxx
  • Date: Sun, 31 Aug 2008 14:56:43 +0200


Am 31.08.2008 um 14:46 schrieb Salvatore Benedetto:

2008/8/29 Andreas Färber <andreas.faerber@xxxxxx>:
I recently encountered some problems with pthread_cond_broadcast (no
ticket yet since I haven't pinpointed it exactly). In a very simple C# Hello
World app Mono checks for the pthread_cond_broadcast return codes and
asserts that they are zero (I assume it runs single-threaded, no Garbage Collector). If I remove Mono's asserts it works as expected. The problematic return code is EINVAL iirc (B_BAD_VALUE), and I traced it to libroot's release_sem_etc, triggered by "if (count <= 0 && (flags & B_RELEASE_ALL) == 0) return B_BAD_VALUE;". Unfortunately it's hard to investigate this on the
Mono side. Does the PosixTestSuite check for such subtleties?

I just ran the posixtestsuit and as far as I can see, there is not such a check. As far as POSIX standard goes, the only possible return value *seems* to be
- zero on success
- EINVAL on error

which means, that B_BAD_VALUE for instance might not be correct, which
is returned
by cond_signal. Same goes for all the other values returned by release_sem_etc.

Thanks for pointing it out.

I was confused by that as well, but B_BAD_VALUE and EINVAL seemed equivalent by value so that part is not wrong per se. I agree, it would be more readable though to use the POSIX error constants in POSIX functions.

Andreas

--
HaikuPorts homepage - http://ports.haiku-files.org
List archives: //www.freelists.org/archives/beports
Administrative contact: brecht@xxxxxxxxxxx

Other related posts: