aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2019-04-27 21:23:39 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-04-27 21:24:33 +0200
commita92a9601f89d59597b268e29e7098597a8766778 (patch)
tree2eb97cdd167a1bee6de04dc78c6d0fdb8daf1563 /shell
parenta4d76ea1373a7cf06d3d0a3c8905646638e97a13 (diff)
downloadbusybox-w32-a92a9601f89d59597b268e29e7098597a8766778.tar.gz
busybox-w32-a92a9601f89d59597b268e29e7098597a8766778.tar.bz2
busybox-w32-a92a9601f89d59597b268e29e7098597a8766778.zip
ash,hush: bash compat for ulimit: -w => -x, -p => -u
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/shell_common.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/shell/shell_common.c b/shell/shell_common.c
index 686c18f54..a992682a8 100644
--- a/shell/shell_common.c
+++ b/shell/shell_common.c
@@ -354,22 +354,22 @@ static const struct limits limits_tbl[] = {
354 { RLIMIT_CORE, 9, "core file size (blocks)" }, // -c 354 { RLIMIT_CORE, 9, "core file size (blocks)" }, // -c
355#endif 355#endif
356#ifdef RLIMIT_RSS 356#ifdef RLIMIT_RSS
357 { RLIMIT_RSS, 10, "resident set size (kb)" }, // -m 357 { RLIMIT_RSS, 10, "max memory size (kb)" }, // -m
358#endif 358#endif
359#ifdef RLIMIT_MEMLOCK 359#ifdef RLIMIT_MEMLOCK
360 { RLIMIT_MEMLOCK, 10, "locked memory (kb)" }, // -l 360 { RLIMIT_MEMLOCK, 10, "max locked memory (kb)" }, // -l
361#endif 361#endif
362#ifdef RLIMIT_NPROC 362#ifdef RLIMIT_NPROC
363 { RLIMIT_NPROC, 0, "processes" }, // -p 363 { RLIMIT_NPROC, 0, "max user processes" }, // -u
364#endif 364#endif
365#ifdef RLIMIT_NOFILE 365#ifdef RLIMIT_NOFILE
366 { RLIMIT_NOFILE, 0, "file descriptors" }, // -n 366 { RLIMIT_NOFILE, 0, "open files" }, // -n
367#endif 367#endif
368#ifdef RLIMIT_AS 368#ifdef RLIMIT_AS
369 { RLIMIT_AS, 10, "address space (kb)" }, // -v 369 { RLIMIT_AS, 10, "virtual memory (kb)" }, // -v
370#endif 370#endif
371#ifdef RLIMIT_LOCKS 371#ifdef RLIMIT_LOCKS
372 { RLIMIT_LOCKS, 0, "locks" }, // -w 372 { RLIMIT_LOCKS, 0, "file locks" }, // -x
373#endif 373#endif
374#ifdef RLIMIT_NICE 374#ifdef RLIMIT_NICE
375 { RLIMIT_NICE, 0, "scheduling priority" }, // -e 375 { RLIMIT_NICE, 0, "scheduling priority" }, // -e
@@ -378,6 +378,10 @@ static const struct limits limits_tbl[] = {
378 { RLIMIT_RTPRIO, 0, "real-time priority" }, // -r 378 { RLIMIT_RTPRIO, 0, "real-time priority" }, // -r
379#endif 379#endif
380}; 380};
381// bash also has these:
382//pending signals (-i) 61858 //RLIMIT_SIGPENDING
383//pipe size (512 bytes, -p) 8
384//POSIX message queues (bytes, -q) 819200 //RLIMIT_MSGQUEUE
381 385
382static const char limit_chars[] ALIGN1 = 386static const char limit_chars[] ALIGN1 =
383 "f" 387 "f"
@@ -400,7 +404,7 @@ static const char limit_chars[] ALIGN1 =
400 "l" 404 "l"
401#endif 405#endif
402#ifdef RLIMIT_NPROC 406#ifdef RLIMIT_NPROC
403 "p" 407 "u"
404#endif 408#endif
405#ifdef RLIMIT_NOFILE 409#ifdef RLIMIT_NOFILE
406 "n" 410 "n"
@@ -409,7 +413,7 @@ static const char limit_chars[] ALIGN1 =
409 "v" 413 "v"
410#endif 414#endif
411#ifdef RLIMIT_LOCKS 415#ifdef RLIMIT_LOCKS
412 "w" 416 "x"
413#endif 417#endif
414#ifdef RLIMIT_NICE 418#ifdef RLIMIT_NICE
415 "e" 419 "e"
@@ -441,7 +445,7 @@ static const char ulimit_opt_string[] ALIGN1 = "-HSa"
441 "l::" 445 "l::"
442#endif 446#endif
443#ifdef RLIMIT_NPROC 447#ifdef RLIMIT_NPROC
444 "p::" 448 "u::"
445#endif 449#endif
446#ifdef RLIMIT_NOFILE 450#ifdef RLIMIT_NOFILE
447 "n::" 451 "n::"
@@ -450,7 +454,7 @@ static const char ulimit_opt_string[] ALIGN1 = "-HSa"
450 "v::" 454 "v::"
451#endif 455#endif
452#ifdef RLIMIT_LOCKS 456#ifdef RLIMIT_LOCKS
453 "w::" 457 "x::"
454#endif 458#endif
455#ifdef RLIMIT_NICE 459#ifdef RLIMIT_NICE
456 "e::" 460 "e::"
@@ -571,7 +575,7 @@ shell_builtin_ulimit(char **argv)
571 if (opts & OPT_all) { 575 if (opts & OPT_all) {
572 for (i = 0; i < ARRAY_SIZE(limits_tbl); i++) { 576 for (i = 0; i < ARRAY_SIZE(limits_tbl); i++) {
573 getrlimit(limits_tbl[i].cmd, &limit); 577 getrlimit(limits_tbl[i].cmd, &limit);
574 printf("-%c: %-30s ", limit_chars[i], limits_tbl[i].name); 578 printf("%-32s(-%c) ", limits_tbl[i].name, limit_chars[i]);
575 printlim(opts, &limit, &limits_tbl[i]); 579 printlim(opts, &limit, &limits_tbl[i]);
576 } 580 }
577 return EXIT_SUCCESS; 581 return EXIT_SUCCESS;
@@ -604,7 +608,7 @@ shell_builtin_ulimit(char **argv)
604 getrlimit(limits_tbl[i].cmd, &limit); 608 getrlimit(limits_tbl[i].cmd, &limit);
605 if (!val_str) { 609 if (!val_str) {
606 if (opt_cnt > 1) 610 if (opt_cnt > 1)
607 printf("-%c: %-30s ", limit_chars[i], limits_tbl[i].name); 611 printf("%-32s(-%c) ", limits_tbl[i].name, limit_chars[i]);
608 printlim(opts, &limit, &limits_tbl[i]); 612 printlim(opts, &limit, &limits_tbl[i]);
609 } else { 613 } else {
610 rlim_t val = RLIM_INFINITY; 614 rlim_t val = RLIM_INFINITY;