2013-04-11 23:09:29 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/***
|
|
|
|
This file is part of systemd.
|
|
|
|
|
|
|
|
Copyright 2013 Lennart Poettering
|
|
|
|
|
|
|
|
systemd is free software; you can redistribute it and/or modify it
|
|
|
|
under the terms of the GNU Lesser General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2.1 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
systemd 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
|
|
|
|
Lesser General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with systemd; If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
***/
|
|
|
|
|
|
|
|
#include "sd-bus.h"
|
|
|
|
|
2013-05-14 22:24:26 +02:00
|
|
|
#define MEMFD_CACHE_MAX 32
|
2013-05-16 16:26:35 +02:00
|
|
|
|
|
|
|
/* When we cache a memfd block for reuse, we will truncate blocks
|
|
|
|
* longer than this in order not to keep too much data around. */
|
2013-05-29 09:59:10 +02:00
|
|
|
#define MEMFD_CACHE_ITEM_SIZE_MAX (128*1024)
|
2013-05-16 16:26:35 +02:00
|
|
|
|
|
|
|
/* This determines at which minimum size we prefer sending memfds over
|
|
|
|
* sending vectors */
|
2014-01-24 21:15:34 +01:00
|
|
|
#define MEMFD_MIN_SIZE (512*1024)
|
2013-05-14 22:24:26 +02:00
|
|
|
|
|
|
|
struct memfd_cache {
|
|
|
|
int fd;
|
|
|
|
void *address;
|
2013-12-18 18:46:23 +01:00
|
|
|
size_t mapped;
|
|
|
|
size_t allocated;
|
2013-05-14 22:24:26 +02:00
|
|
|
};
|
|
|
|
|
2017-07-23 17:45:57 +02:00
|
|
|
void close_and_munmap(int fd, void *address, size_t size);
|
|
|
|
void bus_flush_memfd(sd_bus *bus);
|
2013-05-14 22:24:26 +02:00
|
|
|
|
2014-11-26 02:20:28 +01:00
|
|
|
uint64_t attach_flags_to_kdbus(uint64_t sd_bus_flags);
|