git://git.onelab.eu
/
util-vserver.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
util-vserver-0.30
[util-vserver.git]
/
src
/
vlimit.c
diff --git
a/src/vlimit.c
b/src/vlimit.c
index
18a28b2
..
44fe511
100644
(file)
--- a/
src/vlimit.c
+++ b/
src/vlimit.c
@@
-1,4
+1,4
@@
-// $Id: vlimit.c,v 1.1.2.
2 2003/12/30 13:47:08
ensc Exp $
+// $Id: vlimit.c,v 1.1.2.
3 2004/02/20 19:35:50
ensc Exp $
// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
//
// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
//
@@
-74,7
+74,7
@@
showHelp(int fd, char const *cmd, int res)
WRITE_MSG(fd, "Usage: ");
WRITE_STR(fd, cmd);
WRITE_MSG(fd,
WRITE_MSG(fd, "Usage: ");
WRITE_STR(fd, cmd);
WRITE_MSG(fd,
- "
[-c|--ctx <ctx>]
[-a|--all] [-MSH --<nr> <value>]*\n"
+ "
-c <xid>
[-a|--all] [-MSH --<nr> <value>]*\n"
"Please report bugs to " PACKAGE_BUGREPORT "\n");
exit(res);
}
"Please report bugs to " PACKAGE_BUGREPORT "\n");
exit(res);
}
@@
-123,9
+123,9
@@
showAll(int ctx)
struct vc_rlimit_mask mask;
size_t i;
struct vc_rlimit_mask mask;
size_t i;
- if (vc_get_rlimit_mask(
-2
, &mask)==-1) {
+ if (vc_get_rlimit_mask(
ctx
, &mask)==-1) {
perror("vc_get_rlimit_mask()");
perror("vc_get_rlimit_mask()");
-
//
exit(1);
+ exit(1);
}
for (i=0; i<32; ++i) {
}
for (i=0; i<32; ++i) {
@@
-133,6
+133,7
@@
showAll(int ctx)
struct vc_rlimit limit;
char buf[100], *ptr=buf;
struct vc_rlimit limit;
char buf[100], *ptr=buf;
+ if (((mask.min|mask.soft|mask.hard) & bitmask)==0) continue;
if (vc_get_rlimit(ctx, i, &limit)==-1) {
perror("vc_get_rlimit()");
//continue;
if (vc_get_rlimit(ctx, i, &limit)==-1) {
perror("vc_get_rlimit()");
//continue;
@@
-157,7
+158,7
@@
static void
size_t i;
for (i=0; i<32; ++i) {
if ((mask & (1<<i))==0) continue;
size_t i;
for (i=0; i<32; ++i) {
if ((mask & (1<<i))==0) continue;
- if (vc_set_rlimit(
-2
, i, limits+i)) {
+ if (vc_set_rlimit(
ctx
, i, limits+i)) {
perror("vc_set_rlimit()");
}
}
perror("vc_set_rlimit()");
}
}
@@
-170,7
+171,7
@@
int main (int argc, char *argv[])
int set_mask = 0;
struct vc_rlimit limits[32];
bool show_all = false;
int set_mask = 0;
struct vc_rlimit limits[32];
bool show_all = false;
- xid_t ctx = VC_
SAME
CTX;
+ xid_t ctx = VC_
NO
CTX;
{
size_t i;
{
size_t i;
@@
-224,6
+225,11
@@
int main (int argc, char *argv[])
}
}
}
}
+ if (ctx==VC_NOCTX) {
+ WRITE_MSG(2, "No context specified; try '--help' for more information\n");
+ return EXIT_FAILURE;
+ }
+
setLimits(ctx, limits, lim_mask);
if (show_all) showAll(ctx);
setLimits(ctx, limits, lim_mask);
if (show_all) showAll(ctx);