ash,hush: ulimit: add -i RLIMIT_SIGPENDING, -q RLIMIT_MSGQUEUE
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 28 Apr 2019 09:25:11 +0000 (11:25 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 28 Apr 2019 09:25:11 +0000 (11:25 +0200)
function                                             old     new   delta
limits_tbl                                           104     120     +16
ulimit_opt_string                                     44      50      +6
limit_chars                                           14      16      +2
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/0 up/down: 24/0)               Total: 24 bytes
   text    data     bss     dec     hex filename
 981996     485    7296  989777   f1a51 busybox_old
 982065     485    7296  989846   f1a96 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/shell_common.c

index cc518d54b4642fadaf18ce6cf904f47113a361a5..da3165329ec6653de63c904d22d777cd8ce6538f 100644 (file)
@@ -344,6 +344,9 @@ static const struct limits limits_tbl[] = {
        { RLIMIT_NICE,          0,      "scheduling priority" },     // -e
        { RLIMIT_FSIZE,         9,      "file size (blocks)" },      // -f
 #define LIMIT_F_IDX     3
+#ifdef RLIMIT_SIGPENDING
+       { RLIMIT_SIGPENDING,    0,      "pending signals" },         // -i
+#endif
 #ifdef RLIMIT_MEMLOCK
        { RLIMIT_MEMLOCK,       10,     "max locked memory (kb)" },  // -l
 #endif
@@ -353,6 +356,9 @@ static const struct limits limits_tbl[] = {
 #ifdef RLIMIT_NOFILE
        { RLIMIT_NOFILE,        0,      "open files" },              // -n
 #endif
+#ifdef RLIMIT_MSGQUEUE
+       { RLIMIT_MSGQUEUE,      0,      "POSIX message queues (bytes)" }, // -q
+#endif
 #ifdef RLIMIT_RTPRIO
        { RLIMIT_RTPRIO,        0,      "real-time priority" },      // -r
 #endif
@@ -372,16 +378,17 @@ static const struct limits limits_tbl[] = {
        { RLIMIT_LOCKS,         0,      "file locks" },              // -x
 #endif
 };
-// bash also has these:
-//pending signals                 (-i) 61858   //RLIMIT_SIGPENDING
+// bash also shows:
 //pipe size            (512 bytes, -p) 8
-//POSIX message queues     (bytes, -q) 819200  //RLIMIT_MSGQUEUE
 
 static const char limit_chars[] ALIGN1 =
                        "c"
                        "d"
                        "e"
                        "f"
+#ifdef RLIMIT_SIGPENDING
+                       "i"
+#endif
 #ifdef RLIMIT_MEMLOCK
                        "l"
 #endif
@@ -391,6 +398,9 @@ static const char limit_chars[] ALIGN1 =
 #ifdef RLIMIT_NOFILE
                        "n"
 #endif
+#ifdef RLIMIT_MSGQUEUE
+                       "q"
+#endif
 #ifdef RLIMIT_RTPRIO
                        "r"
 #endif
@@ -417,6 +427,9 @@ static const char ulimit_opt_string[] ALIGN1 = "-HSa"
                        "d::"
                        "e::"
                        "f::"
+#ifdef RLIMIT_SIGPENDING
+                       "i::"
+#endif
 #ifdef RLIMIT_MEMLOCK
                        "l::"
 #endif
@@ -426,6 +439,9 @@ static const char ulimit_opt_string[] ALIGN1 = "-HSa"
 #ifdef RLIMIT_NOFILE
                        "n::"
 #endif
+#ifdef RLIMIT_MSGQUEUE
+                       "q::"
+#endif
 #ifdef RLIMIT_RTPRIO
                        "r::"
 #endif