aboutsummaryrefslogtreecommitdiff
path: root/pies/limits.c
diff options
context:
space:
mode:
Diffstat (limited to 'pies/limits.c')
-rw-r--r--pies/limits.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/pies/limits.c b/pies/limits.c
index 6c0d48e..90d6459 100644
--- a/pies/limits.c
+++ b/pies/limits.c
@@ -51,7 +51,7 @@ do_set_limit (int rlimit, rlim_t limit)
struct rlimit rlim;
MU_DEBUG2 (pies_debug, MU_DEBUG_TRACE1,
- "Setting limit %d to %lu", rlimit, (unsigned long) limit);
+ "Setting limit %d to %lu\n", rlimit, (unsigned long) limit);
rlim.rlim_cur = limit;
rlim.rlim_max = limit;
@@ -67,7 +67,7 @@ do_set_limit (int rlimit, rlim_t limit)
static int
set_prio (int prio)
{
- MU_DEBUG1 (pies_debug, MU_DEBUG_TRACE2, "Setting priority to %d", prio);
+ MU_DEBUG1 (pies_debug, MU_DEBUG_TRACE2, "Setting priority to %d\n", prio);
if (setpriority (PRIO_PROCESS, 0, prio))
{
mu_diag_output (MU_DIAG_NOTICE, _("error setting priority: %s"),
@@ -93,7 +93,7 @@ set_limits (const char *name, struct limits_rec *lrec)
if (!lrec)
return 0;
- MU_DEBUG1 (pies_debug, MU_DEBUG_TRACE2, "Setting limits for %s", name);
+ MU_DEBUG1 (pies_debug, MU_DEBUG_TRACE2, "Setting limits for %s\n", name);
#if defined(RLIMIT_AS)
if (lrec->set & SET_LIMIT_AS)
@@ -145,12 +145,20 @@ set_limits (const char *name, struct limits_rec *lrec)
int
getlimit (char **ptr, rlim_t *rlim, int mul)
{
- unsigned long val;
-
- val = strtoul (*ptr, ptr, 10);
- if (val == 0)
- return 1;
- *rlim = val * mul;
+ if (**ptr == '-')
+ {
+ *rlim = RLIM_INFINITY;
+ ++*ptr;
+ }
+ else
+ {
+ unsigned long val;
+
+ val = strtoul (*ptr, ptr, 10);
+ if (val == 0)
+ return 1;
+ *rlim = val * mul;
+ }
return 0;
}
@@ -159,9 +167,10 @@ getlimit (char **ptr, rlim_t *rlim, int mul)
The string consists of _commands_, optionally separated by any amount
of whitespace. A command has the following form:
- [AaCcDdFfMmNnRrSsTtUuLlPp][0-9]+
+ [AaCcDdFfMmNnRrSsTtUuLlPp](-|[0-9]+)
- i.e. a letter followed by number, and is interpreted as follows:
+ i.e. a letter followed by number or a dash. The latters stands for
+ 'unlimited'. Commands are interpreted as follows:
Command ulimit setrlimit() The limit it sets
option arg

Return to:

Send suggestions and report system problems to the System administrator.