aboutsummaryrefslogtreecommitdiff
path: root/pies/limits.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2008-11-11 15:13:54 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2008-11-11 15:13:54 +0000
commit0af7127c5084ffc3550de8d98e00582975eb6113 (patch)
tree025df4a8afae34e999cb61d6255f4eb757e65687 /pies/limits.c
parent58073638e695a34728794daf83c63b740419daa4 (diff)
downloadpies-0af7127c5084ffc3550de8d98e00582975eb6113.tar.gz
pies-0af7127c5084ffc3550de8d98e00582975eb6113.tar.bz2
Bugfixes
* pies/pies.c (component_cfg_param, pies_cfg_param): New keyword: allgroups. (pies_add_allgroups): New function. * pies/limits.c: Fix debug statements. * pies/progman.c (build_depmap): Rename to progman_build_depmap. Make extern, for future use. All callers updated. * pies/pies.h (progman_build_depmap): New proto.
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.