memfd: add workaround for systems without memfd

Just a quick workaround to use a tmpfile if memfd is not available. We
should try to ensure that we get something on tmpfs, but this is probably
good enough for a fallback.
This commit is contained in:
Christian Hergert
2016-04-16 15:48:29 -07:00
parent 15370ecc42
commit de572f4ed6
4 changed files with 97 additions and 2 deletions

View File

@ -19,10 +19,10 @@
#include <glib.h>
#include <glib/gstdio.h>
#include <errno.h>
#include <sys/syscall.h>
#include <unistd.h>
#include "sp-local-profiler.h"
#include "sp-platform.h"
typedef struct
{
@ -467,7 +467,7 @@ sp_local_profiler_start (SpProfiler *profiler)
SpCaptureWriter *writer;
int fd;
if ((-1 == (fd = syscall (__NR_memfd_create, "[sysprof]", 0))) ||
if ((-1 == (fd = sp_memfd_create ("[sysprof]"))) ||
(NULL == (writer = sp_capture_writer_new_from_fd (fd, 0))))
{
const GError error = {