summaryrefslogtreecommitdiff
path: root/shared/nm-glib-aux/nm-glib.h
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-09-03 16:41:59 +0200
committerThomas Haller <thaller@redhat.com>2019-09-26 08:18:58 +0200
commitb6acec0fbc2397c60a00e5503c0630aba0496be4 (patch)
tree1c20230802d16af7e538a792a61135ce106556c9 /shared/nm-glib-aux/nm-glib.h
parente28460819c0fb1022a153ab8336841f4aae913dd (diff)
shared: add compat macro for G_PID_FORMAT
Having G_PID_FORMAT macro is useful, but it's only available in recent glib versions. Add a compat implementation and a test that our assumptions hold.
Diffstat (limited to 'shared/nm-glib-aux/nm-glib.h')
-rw-r--r--shared/nm-glib-aux/nm-glib.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/shared/nm-glib-aux/nm-glib.h b/shared/nm-glib-aux/nm-glib.h
index 9b5f1627bc..98b778f995 100644
--- a/shared/nm-glib-aux/nm-glib.h
+++ b/shared/nm-glib-aux/nm-glib.h
@@ -556,6 +556,17 @@ _nm_g_value_unset (GValue *value)
#define g_value_unset _nm_g_value_unset
#endif
+/* G_PID_FORMAT was added only in 2.53.5. Define it ourself.
+ *
+ * If this was about "pid_t", we would check SIZEOF_PID_T, and set
+ * PRIi32/PRIi16, like systemd does. But it's actually about
+ * GPid, which glib typedefs as an "int".
+ *
+ * There is a test_gpid() that check that GPid is really a typedef
+ * for int. */
+#undef G_PID_FORMAT
+#define G_PID_FORMAT "i"
+
/*****************************************************************************/
#endif /* __NM_GLIB_H__ */