diff -urN work.orig/configure.ac work/configure.ac
--- work.orig/configure.ac	2018-04-09 03:58:33.000000000 -0400
+++ work/configure.ac	2018-04-09 03:59:23.000000000 -0400
@@ -709,7 +709,7 @@
 AC_CHECK_HEADERS([sys/select.h stdint.h inttypes.h sched.h malloc.h])
 AC_CHECK_HEADERS([sys/vfs.h sys/vmount.h sys/statfs.h sys/statvfs.h sys/filio.h])
 AC_CHECK_HEADERS([mntent.h sys/mnttab.h sys/vfstab.h sys/mntctl.h fstab.h])
-AC_CHECK_HEADERS([linux/magic.h])
+AC_CHECK_HEADERS([linux/magic.h sys/prctl.h])
 AC_CHECK_HEADERS([termios.h])
 
 # Some versions of MSC lack these
diff -urN work.orig/glib/gthread-posix.c work/glib/gthread-posix.c
--- work.orig/glib/gthread-posix.c	2018-04-09 03:58:33.000000000 -0400
+++ work/glib/gthread-posix.c	2018-04-09 03:58:45.000000000 -0400
@@ -60,6 +60,9 @@
 #ifdef HAVE_SCHED_H
 #include <sched.h>
 #endif
+#ifdef HAVE_SYS_PRCTL_H
+#include <sys/prctl.h>
+#endif
 #ifdef G_OS_WIN32
 #include <windows.h>
 #endif
@@ -1225,10 +1228,12 @@
 void
 g_system_thread_set_name (const gchar *name)
 {
-#if defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
-  pthread_setname_np (pthread_self(), name); /* on Linux and Solaris */
+#if defined(HAVE_SYS_PRCTL_H) && defined(PR_SET_NAME)
+  prctl (PR_SET_NAME, name, 0, 0, 0, 0); /* on Linux */
 #elif defined(HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID)
-  pthread_setname_np (name); /* on OS X and iOS */
+  pthread_setname_np(name); /* on OS X and iOS */
+#elif defined(HAVE_PTHREAD_SETNAME_NP_WITH_TID)
+  pthread_setname_np(pthread_self(), name); /* on Solaris */
 #endif
 }
 
diff -urN work.orig/glib/tests/thread.c work/glib/tests/thread.c
--- work.orig/glib/tests/thread.c	2018-04-09 03:58:33.000000000 -0400
+++ work/glib/tests/thread.c	2018-04-09 03:58:45.000000000 -0400
@@ -174,12 +174,14 @@
 static gpointer
 thread6_func (gpointer data)
 {
-#ifdef HAVE_PTHREAD_SETNAME_NP_WITH_TID
-  char name[16];
+#ifdef HAVE_SYS_PRCTL_H
+#ifdef PR_GET_NAME
+  const gchar name[16];
 
-  pthread_getname_np (pthread_self(), name, 16);
+  prctl (PR_GET_NAME, name, 0, 0, 0, 0);
 
-  g_assert_cmpstr (name, ==, data);
+  g_assert_cmpstr (name, ==, (gchar*)data);
+#endif
 #endif
 
   return NULL;
