Files
RedBear-OS/recipes/libs/glib/redox.patch
T
vasilito 50b731f1b7 Red Bear OS — microkernel OS in Rust, based on Redox
Derivative of Redox OS (https://www.redox-os.org) adding:
- AMD GPU driver (amdgpu) via LinuxKPI compat layer
- ext4 filesystem support (ext4d scheme daemon)
- ACPI fixes for AMD bare metal (x2APIC, DMAR, IVRS, MCFG)
- Custom branding (hostname, os-release, boot identity)

Build system is full upstream Redox with RBOS overlay in local/.
Patches for kernel, base, and relibc are symlinked from local/patches/
and protected from make clean/distclean. Custom recipes live in
local/recipes/ with symlinks into the recipes/ search path.

Build:  make all CONFIG_NAME=redbear-full
Sync:   ./local/scripts/sync-upstream.sh
2026-04-12 19:05:00 +01:00

276 lines
8.2 KiB
Diff

diff -ruwN glib-2.87.0/fuzzing/fuzz_resolver.c source/fuzzing/fuzz_resolver.c
--- glib-2.87.0/fuzzing/fuzz_resolver.c 2025-11-03 19:42:10.000000000 +0700
+++ source/fuzzing/fuzz_resolver.c 2026-02-19 13:53:45.717898735 +0700
@@ -29,7 +29,7 @@
gint rrtype)
{
/* g_resolver_records_from_res_query() is only available on Unix */
-#ifdef G_OS_UNIX
+#if defined(G_OS_UNIX) && !defined(__redox__)
GList *record_list = NULL;
/* Data too long? */
diff -ruwN glib-2.87.0/gio/gcredentialsprivate.h source/gio/gcredentialsprivate.h
--- glib-2.87.0/gio/gcredentialsprivate.h 2025-11-03 19:42:10.000000000 +0700
+++ source/gio/gcredentialsprivate.h 2026-02-19 13:53:45.717995965 +0700
@@ -104,7 +104,7 @@
*/
#undef G_CREDENTIALS_HAS_PID
-#ifdef __linux__
+#if defined(__linux__) || defined(__redox__)
#define G_CREDENTIALS_SUPPORTED 1
#define G_CREDENTIALS_USE_LINUX_UCRED 1
#define G_CREDENTIALS_NATIVE_TYPE G_CREDENTIALS_TYPE_LINUX_UCRED
diff -ruwN glib-2.87.0/gio/glocalfile.c source/gio/glocalfile.c
--- glib-2.87.0/gio/glocalfile.c 2025-11-03 19:42:10.000000000 +0700
+++ source/gio/glocalfile.c 2026-02-19 13:53:45.718204283 +0700
@@ -47,6 +47,10 @@
#include <sys/mount.h>
#endif
+#if defined(__redox__)
+#undef AT_FDCWD
+#endif
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
diff -ruwN glib-2.87.0/gio/gnetworking.h.in source/gio/gnetworking.h.in
--- glib-2.87.0/gio/gnetworking.h.in 2025-11-03 19:42:10.000000000 +0700
+++ source/gio/gnetworking.h.in 2026-02-19 13:53:45.718380100 +0700
@@ -40,13 +40,17 @@
#include <netdb.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
+#if !defined(__redox__)
#include <resolv.h>
+#endif
#include <sys/socket.h>
#include <sys/un.h>
#include <net/if.h>
#include <arpa/inet.h>
+#if !defined(__redox__)
#include <arpa/nameser.h>
+#endif
@NAMESER_COMPAT_INCLUDE@
#ifndef __GI_SCANNER__
diff -ruwN glib-2.87.0/gio/gsocket.c source/gio/gsocket.c
--- glib-2.87.0/gio/gsocket.c 2025-11-03 19:42:10.000000000 +0700
+++ source/gio/gsocket.c 2026-03-05 11:29:00.807439664 +0700
@@ -3133,7 +3133,8 @@
{
int errsv = get_socket_errno ();
- if (errsv == EINTR)
+ // TODO: uds connect() in redox is blocking
+ if (errsv == EINTR || errsv == EAGAIN)
continue;
#ifndef G_OS_WIN32
diff -ruwN glib-2.87.0/gio/gthreadedresolver.c source/gio/gthreadedresolver.c
--- glib-2.87.0/gio/gthreadedresolver.c 2025-11-03 05:42:10.000000000 -0700
+++ source/gio/gthreadedresolver.c 2026-01-15 18:35:07.059664185 -0700
@@ -698,7 +698,7 @@
}
-#if defined(G_OS_UNIX)
+#if defined(G_OS_UNIX) && !defined(__redox__)
#if defined __BIONIC__ && !defined BIND_4_COMPAT
/* Copy from bionic/libc/private/arpa_nameser_compat.h
@@ -1393,7 +1393,11 @@
{
GList *records;
-#if defined(G_OS_UNIX)
+#if defined(__redox__)
+ g_set_error (error, G_RESOLVER_ERROR, G_RESOLVER_ERROR_INTERNAL,
+ _("No support for resolving “%s” on redox"), rrname);
+ return NULL;
+#elif defined(G_OS_UNIX)
gint len = 512;
gint herr;
GByteArray *answer;
diff -ruwN glib-2.87.0/gio/gunixconnection.c source/gio/gunixconnection.c
--- glib-2.87.0/gio/gunixconnection.c 2025-11-03 05:42:10.000000000 -0700
+++ source/gio/gunixconnection.c 2026-01-15 18:35:07.059895298 -0700
@@ -496,7 +496,7 @@
GSocket *socket;
gint n;
gssize num_bytes_read;
-#ifdef __linux__
+#if defined(__linux__) || defined(__redox__)
gboolean turn_off_so_passcreds;
#endif
@@ -512,7 +512,7 @@
* already. We also need to turn it off when we're done. See
* #617483 for more discussion.
*/
-#ifdef __linux__
+#if defined(__linux__) || defined(__redox__)
{
gint opt_val;
@@ -626,7 +626,7 @@
out:
-#ifdef __linux__
+#if defined(__linux__) || defined(__redox__)
if (turn_off_so_passcreds)
{
if (!g_socket_set_option (socket,
diff -ruwN glib-2.87.0/gio/gunixmounts.c source/gio/gunixmounts.c
--- glib-2.87.0/gio/gunixmounts.c 2025-11-03 05:42:10.000000000 -0700
+++ source/gio/gunixmounts.c 2026-01-15 18:35:07.060167680 -0700
@@ -1114,7 +1114,7 @@
}
/* QNX {{{2 */
-#elif defined (HAVE_QNX)
+#elif defined (HAVE_QNX) || defined(__redox__)
static char *
get_mtab_monitor_file (void)
@@ -1758,6 +1758,28 @@
return NULL;
}
+#elif defined(__redox__)
+
+static GUnixMountPoint **
+_g_unix_mount_points_get_from_file (const char *table_path,
+ uint64_t *time_read_out,
+ size_t *n_points_out)
+{
+ /* Not supported on Redox. */
+ if (time_read_out != NULL)
+ *time_read_out = 0;
+ if (n_points_out != NULL)
+ *n_points_out = 0;
+ return NULL;
+}
+
+static GList *
+_g_get_unix_mount_points (void)
+{
+ /* Not supported on Redox. */
+ return NULL;
+}
+
/* Common code {{{2 */
#else
#error No g_get_mount_table() implementation for system
diff -ruwN glib-2.87.0/gio/meson.build source/gio/meson.build
--- glib-2.87.0/gio/meson.build 2025-11-03 19:42:10.000000000 +0700
+++ source/gio/meson.build 2026-02-19 13:53:45.718994535 +0700
@@ -18,7 +18,7 @@
gnetworking_h_nameser_compat_include = ''
-if host_system not in ['windows', 'android']
+if host_system not in ['windows', 'android', 'redox']
# Don't check for C_IN on Android since it does not define it in public
# headers, we define it ourselves wherever necessary
if not cc.compiles('''#include <sys/types.h>
@@ -39,7 +39,7 @@
network_libs = [ ]
network_args = [ ]
-if host_system != 'windows'
+if host_system not in ['windows', 'redox']
# res_query()
res_query_test = '''#include <resolv.h>
int main (int argc, char ** argv) {
diff -ruwN glib-2.87.0/gio/tests/gdbus-server-auth.c source/gio/tests/gdbus-server-auth.c
--- glib-2.87.0/gio/tests/gdbus-server-auth.c 2025-11-03 19:42:10.000000000 +0700
+++ source/gio/tests/gdbus-server-auth.c 2026-02-19 13:53:45.719091042 +0700
@@ -243,7 +243,7 @@
}
else /* We should prefer EXTERNAL whenever it is allowed. */
{
-#ifdef __linux__
+#if defined(__linux__) || defined(__redox__)
/* We know that both GDBus and libdbus support full credentials-passing
* on Linux. */
g_assert_cmpint (uid, ==, getuid ());
diff -ruwN glib-2.87.0/glib/glib-unix.c source/glib/glib-unix.c
--- glib-2.87.0/glib/glib-unix.c 2025-11-03 19:42:10.000000000 +0700
+++ source/glib/glib-unix.c 2026-02-19 13:53:45.719219012 +0700
@@ -74,6 +74,10 @@
#include <sys/user.h>
#endif /* defined (__FreeBSD__ )*/
+#if defined(__redox__)
+#include <sys/redox.h>
+#endif
+
G_STATIC_ASSERT (sizeof (ssize_t) == GLIB_SIZEOF_SSIZE_T);
G_STATIC_ASSERT (G_ALIGNOF (gssize) == G_ALIGNOF (ssize_t));
G_STATIC_ASSERT (G_SIGNEDNESS_OF (ssize_t) == 1);
@@ -1004,6 +1008,20 @@
g_set_error (error, G_FILE_ERROR, G_FILE_ERROR_NOSYS,
"g_unix_fd_query_path() not supported on HURD");
return NULL;
+#elif defined(__redox__)
+ char file_path[PATH_MAX] = {0};
+
+ if (redox_fpath (fd, file_path, PATH_MAX) < 0)
+ {
+ int errsv = errno;
+
+ g_set_error (error, G_FILE_ERROR, g_file_error_from_errno (errsv),
+ "Error querying file information for FD %d: %s",
+ fd, g_strerror (errsv));
+ return NULL;
+ }
+
+ return g_strdup (file_path);
#else
#error "g_unix_fd_query_path() not supported on this platform"
#endif
diff -ruwN glib-2.87.0/glib/gstrfuncs.c source/glib/gstrfuncs.c
--- glib-2.87.0/glib/gstrfuncs.c 2025-11-03 19:42:10.000000000 +0700
+++ source/glib/gstrfuncs.c 2026-02-19 13:53:45.719384853 +0700
@@ -707,7 +707,7 @@
gchar *fail_pos;
gdouble val;
-#ifndef __BIONIC__
+#if !defined(__BIONIC__) && !defined(__redox__)
struct lconv *locale_data;
#endif
const char *decimal_point;
@@ -720,7 +720,7 @@
fail_pos = NULL;
-#ifndef __BIONIC__
+#if !defined(__BIONIC__) && !defined(__redox__)
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
decimal_point_len = strlen (decimal_point);
@@ -931,7 +931,7 @@
return buffer;
#else
-#ifndef __BIONIC__
+#if !defined(__BIONIC__) && !defined(__redox__)
struct lconv *locale_data;
#endif
const char *decimal_point;
@@ -964,7 +964,7 @@
_g_snprintf (buffer, buf_len, format, d);
-#ifndef __BIONIC__
+#if !defined(__BIONIC__) && !defined(__redox__)
locale_data = localeconv ();
decimal_point = locale_data->decimal_point;
decimal_point_len = strlen (decimal_point);