Merge branch 'feature/qnx-support' into 'master'

Port to QNX

See merge request GNOME/glib!1847
This commit is contained in:
Philip Withnall 2021-01-20 12:28:54 +00:00
commit 86aec50c0a
4 changed files with 46 additions and 1 deletions

View File

@ -4486,6 +4486,15 @@ g_socket_condition_timed_wait (GSocket *socket,
#ifndef G_OS_WIN32
#ifdef HAVE_QNX
/* QNX has this weird upper limit, or at least used to back in the 6.x days.
* This was discovered empirically and doesn't appear to be mentioned in any
* of the official documentation. */
# define G_SOCKET_CONTROL_BUFFER_SIZE_BYTES 2016
#else
# define G_SOCKET_CONTROL_BUFFER_SIZE_BYTES 2048
#endif
/* Unfortunately these have to be macros rather than inline functions due to
* using alloca(). */
#define output_message_to_msghdr(message, prev_message, msg, prev_msg, error) \
@ -4632,7 +4641,7 @@ G_STMT_START { \
} \
else \
{ \
_msg->msg_controllen = 2048; \
_msg->msg_controllen = G_SOCKET_CONTROL_BUFFER_SIZE_BYTES; \
_msg->msg_control = g_alloca (_msg->msg_controllen); \
} \
\

View File

@ -956,6 +956,23 @@ _g_get_unix_mounts (void)
return return_list;
}
/* QNX {{{2 */
#elif defined (HAVE_QNX)
static char *
get_mtab_monitor_file (void)
{
/* TODO: Not implemented */
return NULL;
}
static GList *
_g_get_unix_mounts (void)
{
/* TODO: Not implemented */
return NULL;
}
/* Common code {{{2 */
#else
#error No _g_get_unix_mounts() implementation for system
@ -1479,6 +1496,14 @@ _g_get_unix_mount_points (void)
return _g_get_unix_mounts ();
}
/* QNX {{{2 */
#elif defined (HAVE_QNX)
static GList *
_g_get_unix_mount_points (void)
{
return _g_get_unix_mounts ();
}
/* Common code {{{2 */
#else
#error No g_get_mount_table() implementation for system

View File

@ -50,6 +50,9 @@ if host_system != 'windows'
elif cc.links(res_query_test, args : '-lbind', name : 'res_query() in -lbind')
network_libs += [ cc.find_library('bind') ]
network_args += [ '-lbind' ]
elif cc.links(res_query_test, args : '-lsocket', name : 'res_query() in -lsocket')
network_libs += [ cc.find_library('socket') ]
network_args += [ '-lsocket' ]
else
error('Could not find res_query()')
endif

View File

@ -98,6 +98,10 @@ build_tests = get_option('tests') and (not meson.is_cross_build() or (meson.is_c
add_project_arguments('-D_GNU_SOURCE', language: 'c')
if host_system == 'qnx'
add_project_arguments('-D_QNX_SOURCE', language: 'c')
endif
# Disable strict aliasing;
# see https://bugzilla.gnome.org/show_bug.cgi?id=791622
if cc.has_argument('-fno-strict-aliasing')
@ -773,6 +777,10 @@ if host_system == 'darwin'
add_project_link_arguments(osx_ldflags, language : ['objc', 'c'])
endif
if host_system == 'qnx'
glib_conf.set('HAVE_QNX', 1)
endif
# Check for futex(2)
if cc.links('''#include <linux/futex.h>
#include <sys/syscall.h>