From 86dcedfba01bd2404b00f9b0745e3da72c3b9e33 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Thu, 13 Feb 2020 14:30:16 -0800 Subject: [PATCH] libsysprof-capture: add sysprof_getpagesize() This is a helper to get the page size on various platforms so that calling code does not need to duplicate that effort. --- src/libsysprof-capture/sysprof-platform.c | 16 ++++++++++++++++ src/libsysprof-capture/sysprof-platform.h | 4 +++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-capture/sysprof-platform.c b/src/libsysprof-capture/sysprof-platform.c index a81d2ae3..99c9a55c 100644 --- a/src/libsysprof-capture/sysprof-platform.c +++ b/src/libsysprof-capture/sysprof-platform.c @@ -63,6 +63,7 @@ #include #include +#include "sysprof-capture-util-private.h" #include "sysprof-platform.h" /** @@ -105,3 +106,18 @@ sysprof_memfd_create (const gchar *name) return fd; #endif } + +/** + * sysprof_getpagesize: + * + * Gets the page size using platform specific APIs. + * + * Returns: the system page size + * + * Since: 3.36 + */ +gsize +sysprof_getpagesize (void) +{ + return _sysprof_getpagesize (); +} diff --git a/src/libsysprof-capture/sysprof-platform.h b/src/libsysprof-capture/sysprof-platform.h index 6cb67079..6dbe4ff2 100644 --- a/src/libsysprof-capture/sysprof-platform.h +++ b/src/libsysprof-capture/sysprof-platform.h @@ -61,6 +61,8 @@ G_BEGIN_DECLS SYSPROF_AVAILABLE_IN_ALL -int sysprof_memfd_create (const gchar *desc); +int sysprof_memfd_create (const gchar *desc); +SYSPROF_AVAILABLE_IN_3_36 +gsize sysprof_getpagesize (void); G_END_DECLS