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

30
lib/sp-platform.h Normal file
View File

@ -0,0 +1,30 @@
/* sp-platform.h
*
* Copyright (C) 2016 Christian Hergert <christian@hergert.me>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef SP_PLATFORM_H
#define SP_PLATFORM_H
#include <glib.h>
G_BEGIN_DECLS
int sp_memfd_create (const gchar *desc);
G_END_DECLS
#endif /* SP_PLATFORM_H */