gmain: Add G_PID_FORMAT

This will be useful for printing out GPids in printf()-style functions.

https://bugzilla.gnome.org/show_bug.cgi?id=767765
This commit is contained in:
Philip Withnall 2016-06-16 18:28:14 -04:00
parent 8c6d08ab1b
commit 7ea4949cda
4 changed files with 17 additions and 0 deletions

View File

@ -125,6 +125,7 @@ case "$host" in
*-*-mingw*)
glib_native_win32=yes
glib_pid_type='void *'
glib_pid_format='p'
glib_pollfd_format='%#x'
glib_cv_stack_grows=no
# Unfortunately the mingw implementations of C99-style snprintf and vsnprintf
@ -148,6 +149,7 @@ case "$host" in
*)
glib_native_win32=no
glib_pid_type=int
glib_pid_format='i'
glib_pollfd_format='%d'
;;
esac
@ -2884,6 +2886,7 @@ _______EOF
#define G_MODULE_SUFFIX "$g_module_suffix"
typedef $g_pid_type GPid;
#define G_PID_FORMAT $g_pid_format
#define GLIB_SYSDEF_AF_UNIX $g_af_unix
#define GLIB_SYSDEF_AF_INET $g_af_inet
@ -3166,6 +3169,7 @@ g_gcc_atomic_ops="$glib_cv_gcc_has_builtin_atomic_operations"
g_module_suffix="$glib_gmodule_suffix"
g_pid_type="$glib_pid_type"
g_pid_format="\"$glib_pid_format\""
g_pollfd_format="\"$glib_pollfd_format\""
case $host in

View File

@ -571,6 +571,7 @@ g_idle_remove_by_data
<SUBSECTION>
GPid
G_PID_FORMAT
GChildWatchFunc
g_child_watch_source_new
g_child_watch_add

View File

@ -242,6 +242,7 @@ typedef unsigned __int64 guintptr;
* not a process identifier.
*/
typedef void * GPid;
#define G_PID_FORMAT "p"
#define GLIB_SYSDEF_AF_UNIX 1
#define GLIB_SYSDEF_AF_INET 2

View File

@ -140,6 +140,17 @@ typedef struct _GSourceFuncs GSourceFuncs;
* GPid is used in GLib only for descendant processes spawned with
* the g_spawn functions.
*/
/* defined in glibconfig.h */
/**
* G_PID_FORMAT:
*
* A format specifier that can be used in printf()-style format strings
* when printing a #GPid.
*
* Since: 2.50
*/
/* defined in glibconfig.h */
/**
* GSourceFunc: