glib-unix: Assert that our portable types correspond to ssize_t and pid_t

If this fails to compile on some particularly bizarre Unix platform,
we can relax these assertions; but our expectation is that gssize is
POSIX ssize_t, and that on Unix, GPid is POSIX pid_t.

Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
Simon McVittie 2020-10-02 15:07:32 +01:00
parent bd1e2a984e
commit fca9824978

View File

@ -33,6 +33,12 @@
#include <sys/types.h>
#include <pwd.h>
G_STATIC_ASSERT (sizeof (ssize_t) == GLIB_SIZEOF_SSIZE_T);
G_STATIC_ASSERT (G_ALIGNOF (gssize) == G_ALIGNOF (ssize_t));
G_STATIC_ASSERT (sizeof (GPid) == sizeof (pid_t));
G_STATIC_ASSERT (G_ALIGNOF (GPid) == G_ALIGNOF (pid_t));
/**
* SECTION:gunix
* @title: UNIX-specific utilities and integration