sd-memfd.c revision ddeb424198649c3993a54efc81652325b6e3bfa5
337eebb936be1da1215535e866965ce54c82d755Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
652e737517bbbae692923246aeb687e2d1f314efZbigniew Jędrzejewski-Szmek This file is part of systemd.
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering Copyright 2013 Lennart Poettering
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering systemd is free software; you can redistribute it and/or modify it
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering under the terms of the GNU Lesser General Public License as published by
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering (at your option) any later version.
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering systemd is distributed in the hope that it will be useful, but
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering Lesser General Public License for more details.
0e0320e04500d1e68630b3973714f14cfb7b3450Lennart Poettering You should have received a copy of the GNU Lesser General Public License
652e737517bbbae692923246aeb687e2d1f314efZbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
7c9a6f906308a6474f1ebb98058c4a33a02c33f1Lennart Poettering kdbus = open("/dev/kdbus/control", O_RDWR|O_NOCTTY|O_CLOEXEC);
0e0320e04500d1e68630b3973714f14cfb7b3450Lennart Poettering if (ioctl(kdbus, KDBUS_CMD_MEMFD_NEW, &fd) < 0)
return -ENOTTY;
return -ENOMEM;
fclose(m->f);
free(m);
return -EINVAL;
return m->fd;
return -EINVAL;
return -EINVAL;
if (!m->fd) {
return -errno;
int fd;
return -EINVAL;
if (fd < 0)
return -errno;
return fd;
int sealed;
return -EINVAL;
if (size <= 0)
return -EINVAL;
return -EINVAL;
if (sealed < 0)
return sealed;
if (q == MAP_FAILED)
return -errno;
return -EINVAL;
return -errno;
return -EINVAL;
return -errno;
return -EINVAL;
if (!sz)
return -EINVAL;
return -errno;
return -EINVAL;
return -errno;