Print this page
3830 SIGQUEUE_MAX's limit of 32 is too low
Reviewed by: Cedric Blancher <cedric.blancher@gmail.com>
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: Irek Szczesniak <iszczesniak@gmail.com>

@@ -21,19 +21,19 @@
 /*
  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
-#pragma ident   "%Z%%M% %I%     %E% SMI"
-
 #include <sys/types.h>
 #include <sys/cmn_err.h>
 #include <sys/sysmacros.h>
 #include <sys/proc.h>
 #include <sys/rctl.h>
 #include <sys/rctl_impl.h>
 #include <sys/port_kernel.h>
+#include <sys/signal.h>
+#include <sys/var.h>
 
 #include <sys/vmparam.h>
 #include <sys/machparam.h>
 
 /*

@@ -63,10 +63,11 @@
 rctl_hndl_t rc_process_msgmnb;
 rctl_hndl_t rc_process_msgtql;
 rctl_hndl_t rc_process_semmsl;
 rctl_hndl_t rc_process_semopm;
 rctl_hndl_t rc_process_portev;
+rctl_hndl_t rc_process_sigqueue;
 
 /*
  * process.max-cpu-time / RLIMIT_CPU
  */
 /*ARGSUSED*/

@@ -286,11 +287,11 @@
  *   Register the various resource controls associated with process entities.
  *   The historical rlim_infinity_map and rlim_infinity32_map are now encoded
  *   here as the native and ILP32 infinite values for each resource control.
  */
 void
-rctlproc_init()
+rctlproc_init(void)
 {
         rctl_set_t *set;
         rctl_alloc_gp_t *gp;
         rctl_entity_p_t e;
 

@@ -367,10 +368,24 @@
             PORT_MAX_EVENTS, PORT_MAX_EVENTS, &rctl_absolute_ops);
         rctl_add_default_limit("process.max-port-events", PORT_DEFAULT_EVENTS,
             RCPRIV_PRIVILEGED, RCTL_LOCAL_DENY);
 
         /*
+         * We set the upper limit to the maximum number of processes per user
+         * to make it theoretical possible to deliver all SIGCHILD signals on
+         * child termination, but at least to 8k.
+         */
+        rc_process_sigqueue = rctl_register("process.max-sigqueue-size",
+            RCENTITY_PROCESS, RCTL_GLOBAL_LOWERABLE | RCTL_GLOBAL_DENY_ALWAYS |
+            RCTL_GLOBAL_COUNT, MAX(v.v_maxup, 8192), MAX(v.v_maxup, 8192),
+            &rctl_absolute_ops);
+        rctl_add_default_limit("process.max-sigqueue-size",
+            _SIGQUEUE_SIZE_BASIC, RCPRIV_BASIC, RCTL_LOCAL_DENY);
+        rctl_add_default_limit("process.max-sigqueue-size",
+            _SIGQUEUE_SIZE_PRIVILEGED, RCPRIV_PRIVILEGED, RCTL_LOCAL_DENY);
+
+        /*
          * Place minimal set of controls on "sched" process for inheritance by
          * processes created via newproc().
          */
         set = rctl_set_create();
         gp = rctl_set_init_prealloc(RCENTITY_PROCESS);