* proclib: Adapted Andreas' code to the refactored proclib.
Allocates ahead of time.
* threads: pthread_setschedparam is semantically different on Haiku,
because it returns positive numbers on success. Handle this
difference.
With these changes, Mono can now get to the point Roslyn runs, and
fails immediately due to lack of stack walking.
}
res = pthread_setschedparam (tid, policy, ¶m);
+#if defined(__HAIKU__)
+ /* On Haiku, pthread_setschedparam returns a positive number on success,
+ which is the priority, or a negative number, which is the errno. */
+ if (res < 0) {
+#else
if (res != 0) {
+#endif
if (res == EPERM) {
g_warning ("%s: pthread_setschedparam failed, error: \"%s\" (%d)", __func__, g_strerror (res), res);
return;
#endif
#include <sys/resource.h>
#endif
+#if defined(__HAIKU__)
+#include <os/kernel/OS.h>
+#endif
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
#include <sys/proc.h>
#if defined(__APPLE__)
*size = res;
return buf;
#elif defined(__HAIKU__)
- /* FIXME: Add back the code from 9185fcc305e43428d0f40f3ee37c8a405d41c9ae */
- g_assert_not_reached ();
- return NULL;
+ int32 cookie = 0;
+ int32 i = 0;
+ team_info ti;
+ system_info si;
+
+ get_system_info(&si);
+ void **buf = g_calloc(si.used_teams, sizeof(void*));
+
+ while (get_next_team_info(&cookie, &ti) == B_OK && i < si.used_teams) {
+ buf[i++] = GINT_TO_POINTER (ti.team);
+ }
+ *size = i;
+
+ return buf;
#else
const char *name;
void **buf = NULL;