summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2013-05-17 02:32:32 +0200
committerLennart Poettering <lennart@poettering.net>2013-05-17 04:26:27 +0200
commit63edf05ed9c1d4cb5cf9364e734b2a96f84622d0 (patch)
tree12c3bb838f87046c52f11b4b248642937e5daa83 /src
parentf54514f3542db9b1f1a6f7546472718ce0d02aae (diff)
bus: actually unmap kdbus pool after use
Diffstat (limited to 'src')
-rw-r--r--src/libsystemd-bus/bus-kernel.c2
-rw-r--r--src/libsystemd-bus/bus-kernel.h4
-rw-r--r--src/libsystemd-bus/sd-bus.c4
3 files changed, 8 insertions, 2 deletions
diff --git a/src/libsystemd-bus/bus-kernel.c b/src/libsystemd-bus/bus-kernel.c
index 8ef5752b31..ede78d7bef 100644
--- a/src/libsystemd-bus/bus-kernel.c
+++ b/src/libsystemd-bus/bus-kernel.c
@@ -45,8 +45,6 @@
#define KDBUS_ITEM_HEADER_SIZE offsetof(struct kdbus_item, data)
#define KDBUS_ITEM_SIZE(s) ALIGN8((s) + KDBUS_ITEM_HEADER_SIZE)
-#define KDBUS_POOL_SIZE (4*1024*1024)
-
static int parse_unique_name(const char *s, uint64_t *id) {
int r;
diff --git a/src/libsystemd-bus/bus-kernel.h b/src/libsystemd-bus/bus-kernel.h
index 1651c1e41d..8cf153ab41 100644
--- a/src/libsystemd-bus/bus-kernel.h
+++ b/src/libsystemd-bus/bus-kernel.h
@@ -33,6 +33,10 @@
* sending vectors */
#define MEMFD_MIN_SIZE (32*1024)
+/* The size of the per-connection memory pool that we set up and where
+ * the kernel places our incoming messages */
+#define KDBUS_POOL_SIZE (16*1024*1024)
+
struct memfd_cache {
int fd;
void *address;
diff --git a/src/libsystemd-bus/sd-bus.c b/src/libsystemd-bus/sd-bus.c
index 08ab202baf..b0730d4954 100644
--- a/src/libsystemd-bus/sd-bus.c
+++ b/src/libsystemd-bus/sd-bus.c
@@ -26,6 +26,7 @@
#include <netdb.h>
#include <sys/poll.h>
#include <byteswap.h>
+#include <sys/mman.h>
#include "util.h"
#include "macro.h"
@@ -64,6 +65,9 @@ static void bus_free(sd_bus *b) {
bus_close_fds(b);
+ if (b->kdbus_buffer)
+ munmap(b->kdbus_buffer, KDBUS_POOL_SIZE);
+
free(b->rbuffer);
free(b->unique_name);
free(b->auth_buffer);