dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
c2dfb7
From 0528a880ddf797a42b2de274e5c7bd2d9896c991 Mon Sep 17 00:00:00 2001
c2dfb7
From: Lennart Poettering <lennart@poettering.net>
c2dfb7
Date: Thu, 11 Oct 2018 18:31:11 +0200
c2dfb7
Subject: [PATCH] main: introduce a define HIGH_RLIMIT_MEMLOCK similar to
c2dfb7
 HIGH_RLIMIT_NOFILE
c2dfb7
c2dfb7
(cherry picked from commit c8884aceefc85245b9bdfb626e2daf27521259bd)
c2dfb7
Related: #1789930
c2dfb7
---
c2dfb7
 src/basic/def.h | 3 +++
c2dfb7
 src/core/main.c | 2 +-
c2dfb7
 2 files changed, 4 insertions(+), 1 deletion(-)
c2dfb7
c2dfb7
diff --git a/src/basic/def.h b/src/basic/def.h
c2dfb7
index 4d515c11b6..65ad659999 100644
c2dfb7
--- a/src/basic/def.h
c2dfb7
+++ b/src/basic/def.h
c2dfb7
@@ -75,3 +75,6 @@
c2dfb7
                 _CONF_PATHS_SPLIT_USR(n))
c2dfb7
 
c2dfb7
 #define LONG_LINE_MAX (1U*1024U*1024U)
c2dfb7
+
c2dfb7
+#define HIGH_RLIMIT_NOFILE (256*1024)
c2dfb7
+#define HIGH_RLIMIT_MEMLOCK (1024ULL*1024ULL*64ULL)
c2dfb7
diff --git a/src/core/main.c b/src/core/main.c
c2dfb7
index b8c1e567ad..d6550ea161 100644
c2dfb7
--- a/src/core/main.c
c2dfb7
+++ b/src/core/main.c
c2dfb7
@@ -1168,7 +1168,7 @@ static int bump_rlimit_memlock(struct rlimit *saved_rlimit) {
c2dfb7
          * should normally disable such checks. We need them to implement IPAccessAllow= and IPAccessDeny=, hence let's
c2dfb7
          * bump the value high enough for the root user. */
c2dfb7
 
c2dfb7
-        r = setrlimit_closest(RLIMIT_MEMLOCK, &RLIMIT_MAKE_CONST(1024ULL*1024ULL*16ULL));
c2dfb7
+        r = setrlimit_closest(RLIMIT_MEMLOCK, &RLIMIT_MAKE_CONST(HIGH_RLIMIT_MEMLOCK));
c2dfb7
         if (r < 0)
c2dfb7
                 return log_warning_errno(r, "Setting RLIMIT_MEMLOCK failed, ignoring: %m");
c2dfb7