mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-21 11:10:07 +02:00
* glib2, bump to 2.81.0, bootstrap gobject-introspection * Update dev-libs/glib/patches/glib2-2.81.0.patchset Co-authored-by: Máximo Castañeda <antiswen@yahoo.es> --------- Co-authored-by: Máximo Castañeda <antiswen@yahoo.es>
552 lines
16 KiB
Plaintext
552 lines
16 KiB
Plaintext
From 1e0575efd53fe256b99407dc2cc73f218f2745af Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Sat, 29 Jul 2017 12:13:00 +0200
|
|
Subject: g_dbus_message_print: use B_PRIiDEV on Haiku
|
|
|
|
because Haiku doesn't define major() and minor()
|
|
|
|
diff --git a/gio/gdbusmessage.c b/gio/gdbusmessage.c
|
|
index c88268b..e43c8bf 100644
|
|
--- a/gio/gdbusmessage.c
|
|
+++ b/gio/gdbusmessage.c
|
|
@@ -37,8 +37,12 @@
|
|
#elif MAJOR_IN_TYPES
|
|
#include <sys/types.h>
|
|
#else
|
|
+#ifdef __HAIKU__
|
|
+#include <SupportDefs.h>
|
|
+#else
|
|
#define MAJOR_MINOR_NOT_FOUND 1
|
|
#endif
|
|
+#endif
|
|
|
|
#include "gdbusutils.h"
|
|
#include "gdbusmessage.h"
|
|
@@ -3873,8 +3877,14 @@ g_dbus_message_print (GDBusMessage *message,
|
|
if (fstat (fds[n], &statbuf) == 0)
|
|
{
|
|
#ifndef MAJOR_MINOR_NOT_FOUND
|
|
+#ifdef __HAIKU__
|
|
+ g_string_append_printf (fs, "%s" "dev=%" B_PRIiDEV, fs->len > 0 ? "," : "",
|
|
+ statbuf.st_dev);
|
|
+#else
|
|
+
|
|
g_string_append_printf (fs, "%s" "dev=%d:%d", fs->len > 0 ? "," : "",
|
|
(gint) major (statbuf.st_dev), (gint) minor (statbuf.st_dev));
|
|
+#endif
|
|
#endif
|
|
g_string_append_printf (fs, "%s" "mode=0%o", fs->len > 0 ? "," : "",
|
|
(guint) statbuf.st_mode);
|
|
@@ -3885,9 +3895,14 @@ g_dbus_message_print (GDBusMessage *message,
|
|
g_string_append_printf (fs, "%s" "gid=%u", fs->len > 0 ? "," : "",
|
|
(guint) statbuf.st_gid);
|
|
#ifndef MAJOR_MINOR_NOT_FOUND
|
|
+#ifdef __HAIKU__
|
|
+ g_string_append_printf (fs, "%s" "rdev=%" B_PRIiDEV, fs->len > 0 ? "," : "",
|
|
+ statbuf.st_rdev);
|
|
+#else
|
|
g_string_append_printf (fs, "%s" "rdev=%d:%d", fs->len > 0 ? "," : "",
|
|
(gint) major (statbuf.st_rdev), (gint) minor (statbuf.st_rdev));
|
|
#endif
|
|
+#endif
|
|
g_string_append_printf (fs, "%s" "size=%" G_GUINT64_FORMAT, fs->len > 0 ? "," : "",
|
|
(guint64) statbuf.st_size);
|
|
g_string_append_printf (fs, "%s" "atime=%" G_GUINT64_FORMAT, fs->len > 0 ? "," : "",
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 4366eba592928ebee8c038e80d94016206c627f4 Mon Sep 17 00:00:00 2001
|
|
From: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
|
|
Date: Mon, 23 Aug 2021 19:31:38 +0000
|
|
Subject: gunixmounts.c: Add Haiku support
|
|
|
|
|
|
diff --git a/gio/gunixmounts.c b/gio/gunixmounts.c
|
|
index 27185c8..a038cb0 100644
|
|
--- a/gio/gunixmounts.c
|
|
+++ b/gio/gunixmounts.c
|
|
@@ -69,6 +69,9 @@ extern char* hasmntopt(const struct mntent* mnt, const char* opt);
|
|
#endif
|
|
#include <sys/mount.h>
|
|
#endif
|
|
+#ifdef __HAIKU__
|
|
+#include <kernel/fs_info.h>
|
|
+#endif
|
|
|
|
#ifndef O_BINARY
|
|
#define O_BINARY 0
|
|
@@ -962,6 +965,49 @@ _g_get_unix_mounts (void)
|
|
return return_list;
|
|
}
|
|
|
|
+/* Haiku {{{2 */
|
|
+#elif defined(__HAIKU__)
|
|
+
|
|
+static const char *
|
|
+get_mtab_monitor_file (void)
|
|
+{
|
|
+ return NULL;
|
|
+}
|
|
+
|
|
+static GList *
|
|
+_g_get_unix_mounts (void)
|
|
+{
|
|
+ int32 pos = 0;
|
|
+ GList* return_list = NULL;
|
|
+ struct fs_info info;
|
|
+ GUnixMountEntry* mount_entry;
|
|
+
|
|
+ while (1)
|
|
+ {
|
|
+ dev_t dev = next_dev (&pos);
|
|
+ if (dev < 0)
|
|
+ break;
|
|
+
|
|
+ if (fs_stat_dev (dev, &info) < 0)
|
|
+ continue;
|
|
+
|
|
+ mount_entry = g_new0 (GUnixMountEntry, 1);
|
|
+
|
|
+ mount_entry->mount_path = g_strdup (info.volume_name);
|
|
+ mount_entry->device_path = g_strdup (info.device_name);
|
|
+ mount_entry->filesystem_type = g_strdup (info.fsh_name);
|
|
+
|
|
+ mount_entry->is_read_only = (info.flags & B_FS_IS_READONLY) ? TRUE : FALSE;
|
|
+ mount_entry->is_system_internal = (info.flags & B_FS_IS_REMOVABLE) ? FALSE : TRUE;
|
|
+
|
|
+ return_list = g_list_prepend (return_list, mount_entry);
|
|
+ }
|
|
+
|
|
+ return_list = g_list_reverse (return_list);
|
|
+
|
|
+ return return_list;
|
|
+}
|
|
+
|
|
/* QNX {{{2 */
|
|
#elif defined (HAVE_QNX)
|
|
|
|
@@ -1495,16 +1541,8 @@ _g_get_unix_mount_points (void)
|
|
|
|
return g_list_reverse (return_list);
|
|
}
|
|
-/* Interix {{{2 */
|
|
-#elif defined(__INTERIX)
|
|
-static GList *
|
|
-_g_get_unix_mount_points (void)
|
|
-{
|
|
- return _g_get_unix_mounts ();
|
|
-}
|
|
-
|
|
-/* QNX {{{2 */
|
|
-#elif defined (HAVE_QNX)
|
|
+/* Interix, QNX, Haiku {{{2 */
|
|
+#elif defined (__INTERIX) || defined (HAVE_QNX) || defined (__HAIKU__)
|
|
static GList *
|
|
_g_get_unix_mount_points (void)
|
|
{
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 7fe453f3c7029e271da45200dfdf2e1e9b2f6fcc Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Sat, 29 Jul 2017 12:32:14 +0200
|
|
Subject: glib/gutils.c: on Haiku define load_user_special_dirs()
|
|
|
|
use find_directory() from SupportDefs.h
|
|
|
|
diff --git a/glib/gutils.c b/glib/gutils.c
|
|
index 057e2bc..61345be 100644
|
|
--- a/glib/gutils.c
|
|
+++ b/glib/gutils.c
|
|
@@ -78,6 +78,10 @@
|
|
#include "gwin32.h"
|
|
#endif
|
|
|
|
+#if defined(__HAIKU__)
|
|
+#include <FindDirectory.h>
|
|
+#include <fs_info.h>
|
|
+#endif
|
|
|
|
#ifdef G_PLATFORM_WIN32
|
|
# include <windows.h>
|
|
@@ -1871,6 +1875,13 @@ g_build_user_data_dir (void)
|
|
#ifdef G_OS_WIN32
|
|
else
|
|
data_dir = get_special_folder (&FOLDERID_LocalAppData);
|
|
+#elif defined(__HAIKU__)
|
|
+ else {
|
|
+ char path[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+ dev_t volume = dev_for_path("/boot");
|
|
+ if (find_directory(B_USER_NONPACKAGED_DATA_DIRECTORY, volume, false, path, sizeof(path)) == B_OK)
|
|
+ data_dir = g_strdup(path);
|
|
+ }
|
|
#endif
|
|
if (!data_dir || !data_dir[0])
|
|
{
|
|
@@ -1936,6 +1947,13 @@ g_build_user_config_dir (void)
|
|
#ifdef G_OS_WIN32
|
|
else
|
|
config_dir = get_special_folder (&FOLDERID_LocalAppData);
|
|
+#elif defined(__HAIKU__)
|
|
+ else {
|
|
+ char path[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+ dev_t volume = dev_for_path("/boot");
|
|
+ if (find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, path, sizeof(path)) == B_OK)
|
|
+ config_dir = g_strdup(path);
|
|
+ }
|
|
#endif
|
|
if (!config_dir || !config_dir[0])
|
|
{
|
|
@@ -2200,6 +2218,35 @@ load_user_special_dirs (void)
|
|
load_user_special_dirs_macos (g_user_special_dirs);
|
|
}
|
|
|
|
+#elif defined(__HAIKU__)
|
|
+static void
|
|
+load_user_special_dirs (void)
|
|
+{
|
|
+ char path[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+
|
|
+ dev_t volume = dev_for_path("/boot");
|
|
+ if (find_directory(B_DESKTOP_DIRECTORY, volume, false, path, sizeof(path))
|
|
+ == B_OK) {
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = g_strdup(path);
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = g_strdup(path);
|
|
+ } else {
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = NULL;
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_DESKTOP] = NULL;
|
|
+ }
|
|
+
|
|
+ if (find_directory(B_USER_DIRECTORY, volume, false, path, sizeof(path))
|
|
+ == B_OK) {
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_DOCUMENTS] = g_strdup(path);
|
|
+ } else
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_DOWNLOAD] = NULL;
|
|
+
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_MUSIC] = NULL;
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_PICTURES] = NULL;
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_PUBLIC_SHARE] = NULL;
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_TEMPLATES] = NULL;
|
|
+ g_user_special_dirs[G_USER_DIRECTORY_VIDEOS] = NULL;
|
|
+}
|
|
+
|
|
#elif defined(G_OS_WIN32)
|
|
|
|
static void
|
|
@@ -2695,7 +2742,16 @@ g_build_system_data_dirs (void)
|
|
*/
|
|
#ifndef G_OS_WIN32
|
|
if (!data_dirs || !data_dirs[0])
|
|
+#if defined(__HAIKU__)
|
|
+ {
|
|
+ char path[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+ dev_t volume = dev_for_path("/boot");
|
|
+ if (find_directory(B_SYSTEM_DATA_DIRECTORY, volume, false, path, sizeof(path)) == B_OK)
|
|
+ data_dirs = g_strdup(path);
|
|
+ }
|
|
+#else
|
|
data_dirs = "/usr/local/share/:/usr/share/";
|
|
+#endif
|
|
|
|
data_dir_vector = g_strsplit (data_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
|
|
#else
|
|
@@ -2790,6 +2846,20 @@ g_build_system_config_dirs (void)
|
|
|
|
g_free (special_conf_dirs);
|
|
}
|
|
+#elif defined(__HAIKU__)
|
|
+ if (conf_dirs)
|
|
+ {
|
|
+ conf_dir_vector = g_strsplit (conf_dirs, G_SEARCHPATH_SEPARATOR_S, 0);
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ char path[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+ dev_t volume = dev_for_path("/boot");
|
|
+ if (find_directory(B_SYSTEM_SETTINGS_DIRECTORY, volume, false, path, sizeof(path)) == B_OK)
|
|
+ conf_dir_vector = g_strsplit (path, G_SEARCHPATH_SEPARATOR_S, 0);
|
|
+ else
|
|
+ conf_dir_vector = g_strsplit ("", G_SEARCHPATH_SEPARATOR_S, 0);
|
|
+ }
|
|
#else
|
|
if (!conf_dirs || !conf_dirs[0])
|
|
conf_dirs = "/etc/xdg";
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 504a8d87c2e0fb573b41227bab27725c3afccead Mon Sep 17 00:00:00 2001
|
|
From: Jerome Duval <jerome.duval@gmail.com>
|
|
Date: Sat, 23 Nov 2019 20:10:10 +0100
|
|
Subject: Haiku patch for x86
|
|
|
|
|
|
diff --git a/glib/tests/mapping.c b/glib/tests/mapping.c
|
|
index bbd4de8..5b89b65 100644
|
|
--- a/glib/tests/mapping.c
|
|
+++ b/glib/tests/mapping.c
|
|
@@ -193,6 +193,10 @@ test_private (void)
|
|
g_remove ("maptest");
|
|
}
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include <SupportDefs.h>
|
|
+#endif
|
|
+
|
|
static void
|
|
test_child_private (void)
|
|
{
|
|
@@ -228,7 +232,11 @@ test_child_private (void)
|
|
spawn_flags |= G_SPAWN_DO_NOT_REAP_CHILD;
|
|
#endif
|
|
|
|
+#ifdef __HAIKU__
|
|
+ g_snprintf (pid, sizeof(pid), B_PRId32, getpid ());
|
|
+#else
|
|
g_snprintf (pid, sizeof(pid), "%d", getpid ());
|
|
+#endif
|
|
child_argv[0] = local_argv[0];
|
|
child_argv[1] = "mapchild";
|
|
child_argv[2] = pid;
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 427acb7475389c6a5fba201d08ac68f1967df78b Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Tue, 17 Aug 2021 08:29:48 +0000
|
|
Subject: Fix network detection
|
|
|
|
|
|
diff --git a/gio/meson.build b/gio/meson.build
|
|
index 59c2b0f..ebd5b1f 100644
|
|
--- a/gio/meson.build
|
|
+++ b/gio/meson.build
|
|
@@ -26,6 +26,7 @@ if host_system not in ['windows', 'android']
|
|
int qclass = C_IN;''',
|
|
name : 'C_IN in public headers (no arpa/nameser_compat.h needed)')
|
|
if cc.compiles('''#include <sys/types.h>
|
|
+ #include <stdint.h>
|
|
#include <arpa/nameser.h>
|
|
#include <arpa/nameser_compat.h>
|
|
int qclass = C_IN;''',
|
|
@@ -46,6 +47,7 @@ if host_system != 'windows'
|
|
return res_query("test", 0, 0, (void *)0, 0);
|
|
}'''
|
|
res_query_test_full = '''#include <sys/types.h>
|
|
+ #include <stdint.h>
|
|
#include <netinet/in.h>
|
|
#include <arpa/nameser.h>
|
|
''' + res_query_test
|
|
@@ -59,6 +61,9 @@ if host_system != 'windows'
|
|
elif cc.links(res_query_test, args : '-lsocket', name : 'res_query() in -lsocket')
|
|
network_libs += [ cc.find_library('socket') ]
|
|
network_args += [ '-lsocket' ]
|
|
+ elif cc.links(res_query_test, args : '-lnetwork', name : 'res_query() in -lnetwork')
|
|
+ network_libs += [ cc.find_library('network') ]
|
|
+ network_args += [ '-lnetwork' ]
|
|
else
|
|
error('Could not find res_query()')
|
|
endif
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 2eea7cde0ad7113b888cf69b7a894cb839aeb240 Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Thu, 5 Jan 2023 18:31:01 +1000
|
|
Subject: Use find_directory for xdgmime
|
|
|
|
|
|
diff --git a/gio/xdgmime/xdgmime.c b/gio/xdgmime/xdgmime.c
|
|
index 0909581..338c49c 100644
|
|
--- a/gio/xdgmime/xdgmime.c
|
|
+++ b/gio/xdgmime/xdgmime.c
|
|
@@ -29,6 +29,11 @@
|
|
#include <unistd.h>
|
|
#include <assert.h>
|
|
|
|
+#if defined(__HAIKU__)
|
|
+#include <FindDirectory.h>
|
|
+#include <fs_info.h>
|
|
+#endif
|
|
+
|
|
#ifndef S_ISREG
|
|
#define S_ISREG(m) (((m) & _S_IFMT) == _S_IFREG)
|
|
#endif
|
|
@@ -223,6 +228,23 @@ xdg_init_dirs (void)
|
|
|
|
assert (xdg_dirs == NULL);
|
|
|
|
+#ifdef __HAIKU__
|
|
+ current_dir = 0;
|
|
+ xdg_dirs = calloc (2, sizeof (char *));
|
|
+
|
|
+ char path[B_PATH_NAME_LENGTH + B_FILE_NAME_LENGTH];
|
|
+ dev_t volume = dev_for_path("/boot");
|
|
+ if (find_directory(B_SYSTEM_DATA_DIRECTORY, volume, false, path, sizeof(path)) == B_OK)
|
|
+ {
|
|
+ xdg_data_dirs = strdup(path);
|
|
+ strcat (xdg_data_dirs, "/mime/");
|
|
+ }
|
|
+ else
|
|
+ {
|
|
+ xdg_data_dirs = strdup("/system/data/mime/");
|
|
+ }
|
|
+ xdg_dirs[current_dir++] = xdg_data_dirs;
|
|
+#else
|
|
xdg_data_home = getenv ("XDG_DATA_HOME");
|
|
home = getenv ("HOME");
|
|
xdg_data_dirs = getenv ("XDG_DATA_DIRS");
|
|
@@ -295,7 +317,7 @@ xdg_init_dirs (void)
|
|
|
|
ptr = end_ptr;
|
|
}
|
|
-
|
|
+#endif
|
|
/* NULL terminator */
|
|
xdg_dirs[current_dir] = NULL;
|
|
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From 050067d49363fdfcc8901c1dd8725cc0f724a114 Mon Sep 17 00:00:00 2001
|
|
From: Alexander von Gluck <alex@terarocket.io>
|
|
Date: Tue, 26 Aug 2025 10:38:29 -0500
|
|
Subject: glib: Disable kqueue on Haiku
|
|
|
|
|
|
diff --git a/meson.build b/meson.build
|
|
index de82c00..78206f7 100644
|
|
--- a/meson.build
|
|
+++ b/meson.build
|
|
@@ -699,7 +699,6 @@ functions = [
|
|
'inotify_init1',
|
|
'issetugid',
|
|
'kevent',
|
|
- 'kqueue',
|
|
'lchmod',
|
|
'lchown',
|
|
'link',
|
|
@@ -744,6 +743,13 @@ if host_system == 'darwin'
|
|
functions += ['_NSGetEnviron']
|
|
endif
|
|
|
|
+# Haiku's kqueue implementation is not yet compatible
|
|
+if host_system != 'haiku'
|
|
+ functions += ['kqueue']
|
|
+else
|
|
+ have_func_kqueue = false
|
|
+endif
|
|
+
|
|
if glib_conf.has('HAVE_SYS_STATVFS_H')
|
|
functions += ['statvfs']
|
|
else
|
|
--
|
|
2.51.0
|
|
|
|
|
|
From d967388bc5e06cd3c6746e1c15faa9327742a038 Mon Sep 17 00:00:00 2001
|
|
From: Luc Schrijvers <begasus@gmail.com>
|
|
Date: Mon, 13 Oct 2025 21:40:42 +0200
|
|
Subject: Fixes for mismatching CPU_ZERO, CPU_ISSET and CPU_SET
|
|
|
|
|
|
diff --git a/glib/gthread.c b/glib/gthread.c
|
|
index a264353..923d529 100644
|
|
--- a/glib/gthread.c
|
|
+++ b/glib/gthread.c
|
|
@@ -66,6 +66,10 @@
|
|
#include "glib_trace.h"
|
|
#include "gtrace-private.h"
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include "haiku_sched.h"
|
|
+#endif
|
|
+
|
|
/* G_LOCK Documentation {{{1 ---------------------------------------------- */
|
|
|
|
/**
|
|
diff --git a/glib/haiku_sched.h b/glib/haiku_sched.h
|
|
new file mode 100644
|
|
index 0000000..79c2192
|
|
--- /dev/null
|
|
+++ b/glib/haiku_sched.h
|
|
@@ -0,0 +1,55 @@
|
|
+/* GLIB - Library of useful routines for C programming
|
|
+ * Copyright (C) 1995-1997 Peter Mattis, Spencer Kimball and Josh MacDonald
|
|
+ *
|
|
+ * SPDX-License-Identifier: LGPL-2.1-or-later
|
|
+ *
|
|
+ * This library is free software; you can redistribute it and/or
|
|
+ * modify it under the terms of the GNU Lesser General Public
|
|
+ * License as published by the Free Software Foundation; either
|
|
+ * version 2.1 of the License, or (at your option) any later version.
|
|
+ *
|
|
+ * This library is distributed in the hope that it will be useful,
|
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
+ * Lesser General Public License for more details.
|
|
+ *
|
|
+ * You should have received a copy of the GNU Lesser General Public
|
|
+ * License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
+ */
|
|
+
|
|
+/*
|
|
+ * Modified by the GLib Team and others 1997-2000. See the AUTHORS
|
|
+ * file for a list of people on the GLib Team. See the ChangeLog
|
|
+ * files for a list of changes. These files are distributed with
|
|
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
|
|
+ */
|
|
+
|
|
+#ifdef __HAIKU__
|
|
+#ifndef CPU_COUNT
|
|
+#define cpu_set_t cpuset_t
|
|
+#define CPU_ZERO CPUSET_ZERO
|
|
+#define CPU_ISSET CPUSET_ISSET
|
|
+#define CPU_SET CPUSET_SET
|
|
+static inline unsigned int
|
|
+__cpu_count(cpuset_t *set)
|
|
+{
|
|
+ unsigned int count = 0;
|
|
+ unsigned int i;
|
|
+ for (i = 0; i < _howmany(CPU_SETSIZE, NCPUSETBITS); i++) {
|
|
+ cpuset_mask mask = set->bits[i];
|
|
+#if __GNUC__ > 2
|
|
+ count += __builtin_popcount(mask);
|
|
+#else
|
|
+ while (mask > 0) {
|
|
+ if ((mask & 1) == 1)
|
|
+ count++;
|
|
+ mask >>= 1;
|
|
+ }
|
|
+#endif
|
|
+ }
|
|
+ return count;
|
|
+}
|
|
+
|
|
+#define CPU_COUNT(set) __cpu_count(set)
|
|
+#endif
|
|
+#endif
|
|
diff --git a/glib/tests/thread.c b/glib/tests/thread.c
|
|
index 6e87796..2483e2b 100644
|
|
--- a/glib/tests/thread.c
|
|
+++ b/glib/tests/thread.c
|
|
@@ -37,6 +37,10 @@
|
|
|
|
#include "glib/glib-private.h"
|
|
|
|
+#ifdef __HAIKU__
|
|
+#include "glib/haiku_sched.h"
|
|
+#endif
|
|
+
|
|
#ifdef G_OS_UNIX
|
|
#include <unistd.h>
|
|
#include <sys/resource.h>
|
|
--
|
|
2.51.0
|
|
|