X-Git-Url: http://git.linux-vserver.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=util-vserver%2Fsrc%2Fvlimit.c;h=9ff8921330718784489dcefbc18356cd9999dc44;hb=a917f24ef7b003dcef54a3db2644cf9cb4bc2db2;hp=3c99493a91d2a9568b73a7f411f567c4f97f7e8c;hpb=e23eee8b256a13f16396dead5b93a4e3a10f23af;p=util-vserver.git diff --git a/util-vserver/src/vlimit.c b/util-vserver/src/vlimit.c index 3c99493..9ff8921 100644 --- a/util-vserver/src/vlimit.c +++ b/util-vserver/src/vlimit.c @@ -51,8 +51,11 @@ #define ENSC_WRAPPERS_VSERVER 1 #include -#define CMD_DIR 0x8000 -#define CMD_MISSINGOK 0x8001 +#define CMD_HELP 0x1000 +#define CMD_VERSION 0x1001 +#define CMD_XID 0x4000 +#define CMD_DIR 0x8000 +#define CMD_MISSINGOK 0x8001 int wrapper_exit_code = 255; @@ -63,9 +66,10 @@ int wrapper_exit_code = 255; static struct option const CMDLINE_OPTIONS[] = { - { "help", no_argument, 0, 'h' }, - { "version", no_argument, 0, 'v' }, + { "help", no_argument, 0, CMD_HELP }, + { "version", no_argument, 0, CMD_VERSION }, { "all", no_argument, 0, 'a' }, + { "xid", no_argument, 0, CMD_XID }, { "dir", required_argument, 0, CMD_DIR }, { "missingok", no_argument, 0, CMD_MISSINGOK }, NUMLIM( 0), NUMLIM( 1), NUMLIM( 2), NUMLIM( 3), @@ -105,10 +109,11 @@ showHelp(int fd, char const *cmd, int res) WRITE_MSG(fd, "Usage: "); WRITE_STR(fd, cmd); WRITE_MSG(fd, - " [-c ] [-nd] [-a|--all] [[-MSH] --(|) ]*\n" + " [--xid|-c ] [-nd] [-a|--all] [[-MSH] --(|) ]*\n" " [--dir [--missingok]] [--] [ *]\n\n" "Options:\n" - " -c ... operate on context \n" + " -c|--xid \n" + " ... operate on context \n" " -a|--all ... show all available limits\n" " -n ... do not resolve limit-names\n" " -d ... show limits in decimal\n" @@ -158,7 +163,7 @@ appendLimit(char *ptr, bool do_it, vc_limit_t lim) ptr += 2; if (do_it) { if (lim==VC_LIM_INFINITY) { - strcpy(ptr, "INF"); + strcpy(ptr, "inf"); ptr += 3; } else { @@ -253,7 +258,7 @@ readFile(char const *file, char *base, char const *suffix, { int fd; - memcpy(base, suffix, strlen(suffix)+1); + strcpy(base, suffix); fd = open(file, O_RDONLY); if (fd!=-1) { *limit = readValue(fd, file); @@ -336,7 +341,7 @@ int main (int argc, char *argv[]) } while (1) { - int c = getopt_long(argc, argv, "MSHndhvac:", CMDLINE_OPTIONS, 0); + int c = getopt_long(argc, argv, "+MSHndac:", CMDLINE_OPTIONS, 0); if (c==-1) break; if (2048<=c && c<2048+32) { @@ -360,14 +365,15 @@ int main (int argc, char *argv[]) set_mask = 0; } else switch (c) { - case 'h' : showHelp(1, argv[0], 0); - case 'v' : showVersion(); - case 'c' : ctx = atoi(optarg); break; - case 'a' : show_all = true; break; - case 'n' : do_resolve = false; break; + case CMD_HELP : showHelp(1, argv[0], 0); + case CMD_VERSION : showVersion(); + case CMD_XID : + case 'a' : show_all = true; break; + case 'n' : do_resolve = false; break; + case CMD_DIR : dir = optarg; break; + case CMD_MISSINGOK: missing_ok = true; break; + case 'c' : ctx = Evc_xidopt2xid(optarg,true); break; case 'd' : fmt_func = utilvserver_fmt_uint64; break; - case CMD_DIR : dir = optarg; break; - case CMD_MISSINGOK: missing_ok = true; break; case 'M' : case 'S' : case 'H' :