core: support IEC suffixes for RLIMIT stuff

Let's make things more user-friendly and support for example

  LimitAS=16G

rather than force users to always use LimitAS=16106127360.

The change is relevant for options:

  [Default]Limit{FSIZE,DATA,STACK,CORE,RSS,AS,MEMLOCK,MSGQUEUE}

The patch introduces config_parse_bytes_limit(), it's the same as
config_parse_limit() but uses parse_size() tu support the suffixes.

Addresses: https://github.com/systemd/systemd/issues/1772
This commit is contained in:
Karel Zak
2015-11-06 11:06:52 +01:00
parent a6bff4a742
commit 412ea7a936
6 changed files with 67 additions and 19 deletions
+3 -1
View File
@@ -568,7 +568,9 @@
of various resources for executed processes. 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.</para></listitem>
configure no limit on a specific resource. The multiplicative suffixes
K (=1024), M (=1024*1024) and so on for G, T, P and E may be used for
resource limits measured in bytes (e.g. LimitAS=16G).</para></listitem>
<table>
<title>Limit directives and their equivalent with ulimit</title>