Accepting request 127019 from Base:System

- Add fix-dir-noatime-tmpfiles.patch: do not modify directory
  atime, which was preventing removing empty directories
  (bnc#751253, rh#810257).
- Add improve-restart-behaviour.patch: prevent deadlock during
  try-restart (bnc#743218).
- Add journal-bugfixes.patch: don't crash when rotating journal
  (bnc#768953) and prevent memleak at rotation time too.
- Add ulimit-support.patch: add support for system wide ulimit
  (bnc#744818).
- Add change-terminal.patch: use vt102 instead of vt100 as terminal
  for non-vc tty.
- Package various .wants directories, which were no longer packaged
  due to plymouth units being removed from systemd package.
- Fix buildrequires for manpages build. (forwarded request 127017 from fcrozat)

OBS-URL: https://build.opensuse.org/request/show/127019
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/systemd?expand=0&rev=103
This commit is contained in:
Stephan Kulow 2012-07-03 19:42:50 +00:00 committed by Git OBS Bridge
commit eee94091b3
7 changed files with 8213 additions and 2 deletions

37
change-terminal.patch Normal file
View File

@ -0,0 +1,37 @@
From 1505a61772a6e697f2aabdbb0e827a88b0d7ee6b Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Sun, 22 Apr 2012 02:45:39 +0200
Subject: [PATCH] default to v102 everywhere, instead of vt100, to synchronize
with agetty
---
src/util.c | 2 +-
units/serial-getty@.service.m4 | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
Index: systemd-44/src/util.c
===================================================================
--- systemd-44.orig/src/util.c
+++ systemd-44/src/util.c
@@ -4425,7 +4425,7 @@ bool tty_is_vc_resolve(const char *tty)
const char *default_term_for_tty(const char *tty) {
assert(tty);
- return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt100";
+ return tty_is_vc_resolve(tty) ? "TERM=linux" : "TERM=vt102";
}
bool dirent_is_file(const struct dirent *de) {
Index: systemd-44/units/serial-getty@.service.m4
===================================================================
--- systemd-44.orig/units/serial-getty@.service.m4
+++ systemd-44/units/serial-getty@.service.m4
@@ -35,7 +35,7 @@ Before=getty.target
IgnoreOnIsolate=yes
[Service]
-Environment=TERM=vt100
+Environment=TERM=vt102
ExecStart=-/sbin/agetty -s %I 115200,38400,9600
Restart=always
RestartSec=0

View File

@ -0,0 +1,41 @@
From de49f6dd99aca059da24c9afc672782f1768abd2 Mon Sep 17 00:00:00 2001
From: Kay Sievers <kay@vrfy.org>
Date: Wed, 11 Apr 2012 21:33:12 +0200
Subject: [PATCH] tmpfiles: open directories with O_NOATIME to preserve
timestamp
Before:
# stat /tmp/pulse-Du5ectm60QYM | grep 'Access: 20'
Access: 2012-04-11 21:32:48.444920237 +0200
# systemd-tmpfiles --clean
# stat /tmp/pulse-Du5ectm60QYM | grep 'Access: 20'
Access: 2012-04-11 21:36:27.628925459 +0200
After:
# stat /tmp/pulse-Du5ectm60QYM | grep 'Access: 20'
Access: 2012-04-11 21:32:48.444920237 +0200
# ./systemd-tmpfiles --clean
# stat /tmp/pulse-Du5ectm60QYM | grep 'Access: 20'
Access: 2012-04-11 21:32:48.444920237 +0200
Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=810257
---
src/tmpfiles.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/tmpfiles.c b/src/tmpfiles.c
index 21bf44d..09eefcf 100644
--- a/src/tmpfiles.c
+++ b/src/tmpfiles.c
@@ -250,7 +250,7 @@ static int dir_cleanup(
DIR *sub_dir;
int q;
- sub_dir = xopendirat(dirfd(d), dent->d_name, O_NOFOLLOW);
+ sub_dir = xopendirat(dirfd(d), dent->d_name, O_NOFOLLOW|O_NOATIME);
if (sub_dir == NULL) {
if (errno != ENOENT) {
log_error("opendir(%s/%s) failed: %m", p, dent->d_name);
--
1.7.7

File diff suppressed because it is too large Load Diff

186
journal-bugfixes.patch Normal file
View File

@ -0,0 +1,186 @@
From 911efc97f9bfe2ad4f4d021f5e76d05c8d5d81ac Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Thu, 12 Apr 2012 12:57:41 +0200
Subject: [PATCH 1/4] journald: add missing flag to open()
---
src/journal/journald.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/journal/journald.c b/src/journal/journald.c
index baad3ab..c8b400a 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -2461,7 +2461,7 @@ static int open_proc_kmsg(Server *s) {
return 0;
- s->proc_kmsg_fd = open("/proc/kmsg", O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
+ s->proc_kmsg_fd = open("/proc/kmsg", O_RDONLY|O_CLOEXEC|O_NONBLOCK|O_NOCTTY);
if (s->proc_kmsg_fd < 0) {
log_warning("Failed to open /proc/kmsg, ignoring: %m");
return 0;
--
1.7.7
From 94b8299358fd743137857bc0f28ab62bcf6eec92 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Fri, 13 Apr 2012 13:58:50 +0200
Subject: [PATCH 2/4] fix a couple of things found with the llvm static
analyzer
---
src/journal/journal-file.c | 2 +-
src/journal/journald.c | 2 +-
src/logs-show.c | 2 +-
src/manager.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 474dd5c..5255c3b 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -1974,7 +1974,7 @@ int journal_directory_vacuum(const char *directory, uint64_t max_use, uint64_t m
size_t q;
struct stat st;
char *p;
- unsigned long long seqnum, realtime;
+ unsigned long long seqnum = 0, realtime;
sd_id128_t seqnum_id;
bool have_seqnum;
diff --git a/src/journal/journald.c b/src/journal/journald.c
index c8b400a..1118b7e 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -1140,7 +1140,7 @@ static void process_native_message(
char *identifier = NULL, *message = NULL;
assert(s);
- assert(buffer || n == 0);
+ assert(buffer || buffer_size == 0);
p = buffer;
remaining = buffer_size;
diff --git a/src/logs-show.c b/src/logs-show.c
index f71c6b0..eb9a902 100644
--- a/src/logs-show.c
+++ b/src/logs-show.c
@@ -541,7 +541,7 @@ int show_journal_by_unit(
bool follow) {
char *m = NULL;
- sd_journal *j;
+ sd_journal *j = NULL;
int r;
int fd;
unsigned line = 0;
diff --git a/src/manager.c b/src/manager.c
index 74bd740..3e592b6 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -2979,7 +2979,7 @@ bool manager_unit_pending_inactive(Manager *m, const char *name) {
void manager_check_finished(Manager *m) {
char userspace[FORMAT_TIMESPAN_MAX], initrd[FORMAT_TIMESPAN_MAX], kernel[FORMAT_TIMESPAN_MAX], sum[FORMAT_TIMESPAN_MAX];
- usec_t kernel_usec = 0, initrd_usec = 0, userspace_usec = 0, total_usec = 0;
+ usec_t kernel_usec, initrd_usec, userspace_usec, total_usec;
assert(m);
--
1.7.7
From f83fa045b967478a80ca55477dfe6a5be5f0b4a8 Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd@luon.net>
Date: Sat, 14 Apr 2012 14:11:08 +0200
Subject: [PATCH 3/4] journal: crash when filesystem is low on space
When space is getting too low on a file system rotating the journal file
will fail after the rotation, as opening the new logfile will fail.
Recognize this when logging the error and don't try to dereference a
NULL JournalFile pointer.
---
src/journal/journald.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/journal/journald.c b/src/journal/journald.c
index 1118b7e..9180656 100644
--- a/src/journal/journald.c
+++ b/src/journal/journald.c
@@ -330,7 +330,10 @@ static void server_rotate(Server *s) {
if (s->runtime_journal) {
r = journal_file_rotate(&s->runtime_journal);
if (r < 0)
- log_error("Failed to rotate %s: %s", s->runtime_journal->path, strerror(-r));
+ if (s->runtime_journal)
+ log_error("Failed to rotate %s: %s", s->runtime_journal->path, strerror(-r));
+ else
+ log_error("Failed to create new runtime journal: %s", strerror(-r));
else
server_fix_perms(s, s->runtime_journal, 0);
}
@@ -338,7 +341,11 @@ static void server_rotate(Server *s) {
if (s->system_journal) {
r = journal_file_rotate(&s->system_journal);
if (r < 0)
- log_error("Failed to rotate %s: %s", s->system_journal->path, strerror(-r));
+ if (s->system_journal)
+ log_error("Failed to rotate %s: %s", s->system_journal->path, strerror(-r));
+ else
+ log_error("Failed to create new system journal: %s", strerror(-r));
+
else
server_fix_perms(s, s->system_journal, 0);
}
@@ -346,7 +353,10 @@ static void server_rotate(Server *s) {
HASHMAP_FOREACH_KEY(f, k, s->user_journals, i) {
r = journal_file_rotate(&f);
if (r < 0)
- log_error("Failed to rotate %s: %s", f->path, strerror(-r));
+ if (f->path)
+ log_error("Failed to rotate %s: %s", f->path, strerror(-r));
+ else
+ log_error("Failed to create user journal: %s", strerror(-r));
else {
hashmap_replace(s->user_journals, k, f);
server_fix_perms(s, s->system_journal, PTR_TO_UINT32(k));
--
1.7.7
From d80e2f5c26aae25c0773042bcd1599d3c583bf6a Mon Sep 17 00:00:00 2001
From: Michal Schmidt <mschmidt@redhat.com>
Date: Tue, 12 Jun 2012 16:45:09 +0200
Subject: [PATCH 4/4] journal-file: fix mmap leak
https://bugzilla.redhat.com/show_bug.cgi?id=831132
---
src/journal/journal-file.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c
index 5255c3b..e242fa2 100644
--- a/src/journal/journal-file.c
+++ b/src/journal/journal-file.c
@@ -67,9 +67,12 @@ void journal_file_close(JournalFile *f) {
assert(f);
- if (f->header && f->writable)
- f->header->state = STATE_OFFLINE;
+ if (f->header) {
+ if (f->writable)
+ f->header->state = STATE_OFFLINE;
+ munmap(f->header, PAGE_ALIGN(sizeof(Header)));
+ }
for (t = 0; t < _WINDOW_MAX; t++)
if (f->windows[t].ptr)
--
1.7.7

View File

@ -1,3 +1,21 @@
-------------------------------------------------------------------
Tue Jul 3 17:58:39 CEST 2012 - fcrozat@suse.com
- Add fix-dir-noatime-tmpfiles.patch: do not modify directory
atime, which was preventing removing empty directories
(bnc#751253, rh#810257).
- Add improve-restart-behaviour.patch: prevent deadlock during
try-restart (bnc#743218).
- Add journal-bugfixes.patch: don't crash when rotating journal
(bnc#768953) and prevent memleak at rotation time too.
- Add ulimit-support.patch: add support for system wide ulimit
(bnc#744818).
- Add change-terminal.patch: use vt102 instead of vt100 as terminal
for non-vc tty.
- Package various .wants directories, which were no longer packaged
due to plymouth units being removed from systemd package.
- Fix buildrequires for manpages build.
-------------------------------------------------------------------
Mon Jul 2 15:44:28 UTC 2012 - fcrozat@suse.com

View File

@ -35,7 +35,7 @@ BuildRequires: intltool
BuildRequires: libacl-devel
BuildRequires: libcap-devel
BuildRequires: libtool
BuildRequires: libxslt1
BuildRequires: libxslt-tools
BuildRequires: pam-devel
BuildRequires: pkg-config
BuildRequires: tcpd-devel
@ -93,6 +93,11 @@ Patch42: fixppc.patch
Patch43: logind-logout.patch
Patch44: fix-getty-isolate.patch
Patch45: fix-swap-priority.patch
Patch46: improve-restart-behaviour.patch
Patch47: fix-dir-noatime-tmpfiles.patch
Patch48: journal-bugfixes.patch
Patch49: ulimit-support.patch
Patch50: change-terminal.patch
%description
Systemd is a system and service manager, compatible with SysV and LSB
@ -148,6 +153,14 @@ Drop-in replacement of System V init tools.
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
#needed by patch49
rm man/systemd.conf.5
%build
autoreconf -fiv
@ -163,6 +176,7 @@ export V=1
--with-pamlibdir=/%{_lib}/security \
--enable-split-usr \
--disable-gtk \
--enable-manpages \
--disable-plymouth \
CFLAGS="%{optflags}"
make %{?_smp_mflags}
@ -178,7 +192,8 @@ chmod 644 %{buildroot}%{_bindir}/systemd-analyze
mkdir -p %{buildroot}%{_sysconfdir}/rpm
install -m644 %{S:4} %{buildroot}%{_sysconfdir}/rpm
find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
mkdir -p %{buildroot}/{sbin,var/lib/systemd/sysv-convert,var/lib/systemd/migrated} %{buildroot}/lib/systemd/{system.preset,user.preset}
mkdir -p %{buildroot}/{sbin,var/lib/systemd/sysv-convert,var/lib/systemd/migrated} %{buildroot}/lib/systemd/{system.preset,user.preset,system/halt.target.wants,system/kexec.target.wants,system/poweroff.target.wants,system/reboot.target.wants}
install -m755 %{S:3} -D %{buildroot}%{_sbindir}/systemd-sysv-convert
# do not install, code has been fixed, might be useful in the future
#install -m755 %{S:5} %{buildroot}/lib/systemd/system-generators

253
ulimit-support.patch Normal file
View File

@ -0,0 +1,253 @@
From 03854532d39613723dc8b85c424737ecf2e46f74 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 16 Apr 2012 18:54:45 +0200
Subject: [PATCH 1/3] util: introduce memdup()
---
src/util.h | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/util.h b/src/util.h
index b1af6db..06c9933 100644
--- a/src/util.h
+++ b/src/util.h
@@ -99,6 +99,8 @@ bool streq_ptr(const char *a, const char *b);
#define new0(t, n) ((t*) calloc((n), sizeof(t)))
+#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n))
+
#define malloc0(n) (calloc((n), 1))
static inline const char* yes_no(bool b) {
--
1.7.7
From f60b5d436f502152415b08758737f200113ce4bc Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Mon, 21 May 2012 16:53:18 +0200
Subject: [PATCH 2/3] util: fix typo in newdup
Conflicts:
src/util.h
---
src/util.h | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/util.h b/src/util.h
index 06c9933..41b4c9f 100644
--- a/src/util.h
+++ b/src/util.h
@@ -99,7 +99,7 @@ bool streq_ptr(const char *a, const char *b);
#define new0(t, n) ((t*) calloc((n), sizeof(t)))
-#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n))
+#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n)))
#define malloc0(n) (calloc((n), 1))
--
1.7.7
From 8e7fa2b3e68b691c522cf2b60ed920452c146c2e Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Wed, 27 Jun 2012 14:12:44 +0200
Subject: [PATCH 3/3] main: allow system wide limits for services
---
man/systemd.conf.xml | 27 +++++++++++++++++++++++++++
src/main.c | 22 ++++++++++++++++++++++
src/manager.c | 22 ++++++++++++++++++++++
src/manager.h | 3 +++
src/service.c | 4 ++++
5 files changed, 78 insertions(+), 0 deletions(-)
diff --git a/man/systemd.conf.xml b/man/systemd.conf.xml
index ba144da..ee461e3 100644
--- a/man/systemd.conf.xml
+++ b/man/systemd.conf.xml
@@ -149,6 +149,33 @@
controllers in separate
hierarchies.</para></listitem>
</varlistentry>
+
+ <varlistentry>
+ <term><varname>DefaultLimitCPU=</varname></term>
+ <term><varname>DefaultLimitFSIZE=</varname></term>
+ <term><varname>DefaultLimitDATA=</varname></term>
+ <term><varname>DefaultLimitSTACK=</varname></term>
+ <term><varname>DefaultLimitCORE=</varname></term>
+ <term><varname>DefaultLimitRSS=</varname></term>
+ <term><varname>DefaultLimitNOFILE=</varname></term>
+ <term><varname>DefaultLimitAS=</varname></term>
+ <term><varname>DefaultLimitNPROC=</varname></term>
+ <term><varname>DefaultLimitMEMLOCK=</varname></term>
+ <term><varname>DefaultLimitLOCKS=</varname></term>
+ <term><varname>DefaultLimitSIGPENDING=</varname></term>
+ <term><varname>DefaultLimitMSGQUEUE=</varname></term>
+ <term><varname>DefaultLimitNICE=</varname></term>
+ <term><varname>DefaultLimitRTPRIO=</varname></term>
+ <term><varname>DefaultLimitRTTIME=</varname></term>
+ <listitem><para>These settings control
+ various default resource limits for units. See
+ <citerefentry><refentrytitle>setrlimit</refentrytitle><manvolnum>2</manvolnum></citerefentry>
+ for details. Use the string
+ <varname>infinity</varname> to
+ configure no limit on a specific
+ resource. They can be overriden in units files
+ using corresponding LimitXXXX parameter.</para></listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/src/main.c b/src/main.c
index ed317b4..3f5f3d7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -79,6 +79,7 @@ static char **arg_default_controllers = NULL;
static char ***arg_join_controllers = NULL;
static ExecOutput arg_default_std_output = EXEC_OUTPUT_JOURNAL;
static ExecOutput arg_default_std_error = EXEC_OUTPUT_INHERIT;
+static struct rlimit *arg_default_rlimit[RLIMIT_NLIMITS] = {};
static FILE* serialization = NULL;
@@ -659,6 +660,22 @@ static int parse_config_file(void) {
{ "Manager", "DefaultStandardOutput", config_parse_output, 0, &arg_default_std_output },
{ "Manager", "DefaultStandardError", config_parse_output, 0, &arg_default_std_error },
{ "Manager", "JoinControllers", config_parse_join_controllers, 0, &arg_join_controllers },
+ { "Manager", "DefaultLimitCPU", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_CPU]},
+ { "Manager", "DefaultLimitFSIZE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_FSIZE]},
+ { "Manager", "DefaultLimitDATA", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_DATA]},
+ { "Manager", "DefaultLimitSTACK", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_STACK]},
+ { "Manager", "DefaultLimitCORE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_CORE]},
+ { "Manager", "DefaultLimitRSS", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_RSS]},
+ { "Manager", "DefaultLimitNOFILE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_NOFILE]},
+ { "Manager", "DefaultLimitAS", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_AS]},
+ { "Manager", "DefaultLimitNPROC", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_NPROC]},
+ { "Manager", "DefaultLimitMEMLOCK", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_MEMLOCK]},
+ { "Manager", "DefaultLimitLOCKS", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_LOCKS]},
+ { "Manager", "DefaultLimitSIGPENDING",config_parse_limit, 0, &arg_default_rlimit[RLIMIT_SIGPENDING]},
+ { "Manager", "DefaultLimitMSGQUEUE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_MSGQUEUE]},
+ { "Manager", "DefaultLimitNICE", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_NICE]},
+ { "Manager", "DefaultLimitRTPRIO", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_RTPRIO]},
+ { "Manager", "DefaultLimitRTTIME", config_parse_limit, 0, &arg_default_rlimit[RLIMIT_RTTIME]},
{ NULL, NULL, NULL, 0, NULL }
};
@@ -1401,6 +1418,8 @@ int main(int argc, char *argv[]) {
m->default_std_output = arg_default_std_output;
m->default_std_error = arg_default_std_error;
+ manager_set_default_rlimits(m, arg_default_rlimit);
+
if (dual_timestamp_is_set(&initrd_timestamp))
m->initrd_timestamp = initrd_timestamp;
@@ -1539,6 +1558,9 @@ finish:
if (m)
manager_free(m);
+ for (j = 0; j < RLIMIT_NLIMITS; j++)
+ free (arg_default_rlimit[j]);
+
free(arg_default_unit);
strv_free(arg_default_controllers);
free_join_controllers();
diff --git a/src/manager.c b/src/manager.c
index 3e592b6..c6cd06c 100644
--- a/src/manager.c
+++ b/src/manager.c
@@ -456,6 +456,7 @@ static void manager_clear_jobs_and_units(Manager *m) {
void manager_free(Manager *m) {
UnitType c;
+ int i;
assert(m);
@@ -501,6 +502,9 @@ void manager_free(Manager *m) {
hashmap_free(m->cgroup_bondings);
set_free_free(m->unit_path_cache);
+ for (i = 0; i < RLIMIT_NLIMITS; i++)
+ free(m->rlimit[i]);
+
free(m);
}
@@ -3137,6 +3141,24 @@ int manager_set_default_controllers(Manager *m, char **controllers) {
return 0;
}
+int manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit) {
+ int i;
+
+ assert(m);
+
+ for (i = 0; i < RLIMIT_NLIMITS; i++) {
+ if (default_rlimit[i]) {
+ m->rlimit[i] = newdup(struct rlimit, default_rlimit[i], 1);
+
+ if (!m->rlimit[i])
+ return -ENOMEM;
+ }
+ }
+
+ return 0;
+}
+
+
void manager_recheck_journal(Manager *m) {
Unit *u;
diff --git a/src/manager.h b/src/manager.h
index a9d08f0..5f5de8e 100644
--- a/src/manager.h
+++ b/src/manager.h
@@ -225,6 +225,8 @@ struct Manager {
ExecOutput default_std_output, default_std_error;
+ struct rlimit *rlimit[RLIMIT_NLIMITS];
+
/* non-zero if we are reloading or reexecuting, */
int n_reloading;
@@ -263,6 +265,7 @@ unsigned manager_dispatch_run_queue(Manager *m);
unsigned manager_dispatch_dbus_queue(Manager *m);
int manager_set_default_controllers(Manager *m, char **controllers);
+int manager_set_default_rlimits(Manager *m, struct rlimit **default_rlimit);
int manager_loop(Manager *m);
diff --git a/src/service.c b/src/service.c
index 8b5c0b0..892392d 100644
--- a/src/service.c
+++ b/src/service.c
@@ -109,6 +109,7 @@ static const UnitActiveState state_translation_table[_SERVICE_STATE_MAX] = {
static void service_init(Unit *u) {
Service *s = SERVICE(u);
+ int i;
assert(u);
assert(u->load_state == UNIT_STUB);
@@ -127,6 +128,9 @@ static void service_init(Unit *u) {
s->guess_main_pid = true;
exec_context_init(&s->exec_context);
+ for (i = 0; i < RLIMIT_NLIMITS; i++)
+ if (UNIT(s)->manager->rlimit[i])
+ s->exec_context.rlimit[i] = newdup(struct rlimit, UNIT(s)->manager->rlimit[i], 1);
RATELIMIT_INIT(s->start_limit, 10*USEC_PER_SEC, 5);
--
1.7.7