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.
This commit is contained in:
Christian Hergert
2020-02-13 14:30:16 -08:00
parent 19e077736b
commit 86dcedfba0
2 changed files with 19 additions and 1 deletions

View File

@ -63,6 +63,7 @@
#include <sys/syscall.h> #include <sys/syscall.h>
#include <unistd.h> #include <unistd.h>
#include "sysprof-capture-util-private.h"
#include "sysprof-platform.h" #include "sysprof-platform.h"
/** /**
@ -105,3 +106,18 @@ sysprof_memfd_create (const gchar *name)
return fd; return fd;
#endif #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 ();
}

View File

@ -61,6 +61,8 @@
G_BEGIN_DECLS G_BEGIN_DECLS
SYSPROF_AVAILABLE_IN_ALL 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 G_END_DECLS