#include <sys/mman.h>
#include <sys/prctl.h>
+#ifdef HAVE_LINUX_MEMFD_H
+# include <linux/memfd.h>
+#endif
+
#include "util.h"
#include "bus-label.h"
-#include "missing.h"
#include "memfd.h"
#include "utf8.h"
+#include "missing.h"
int memfd_new(const char *name) {
-
_cleanup_free_ char *g = NULL;
int fd;
- if (name) {
- g = utf8_escape_invalid(name);
- if (!g)
- return -ENOMEM;
-
- name = g;
- } else {
+ if (!name) {
char pr[17] = {};
/* If no name is specified we generate one. We include
return -errno;
*sz = stat.st_size;
- return r;
+ return 0;
}
int memfd_set_size(int fd, uint64_t sz) {
if (r < 0)
return -errno;
- return r;
+ return 0;
}
int memfd_new_and_map(const char *name, size_t sz, void **p) {