Print this page
2831 svc.startd and svc.configd waste memory.


   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 #pragma ident   "%Z%%M% %I%     %E% SMI"


  27 
  28 #include <assert.h>
  29 #include <door.h>
  30 #include <errno.h>
  31 #include <fcntl.h>
  32 #include <limits.h>
  33 #include <priv.h>
  34 #include <procfs.h>
  35 #include <pthread.h>
  36 #include <signal.h>
  37 #include <stdarg.h>
  38 #include <stdio.h>
  39 #include <stdio_ext.h>
  40 #include <stdlib.h>
  41 #include <string.h>
  42 #include <syslog.h>
  43 #include <sys/corectl.h>
  44 #include <sys/resource.h>
  45 #include <sys/stat.h>
  46 #include <sys/wait.h>


  92 
  93 static thread_info_t    main_thread_info;
  94 
  95 static int      finished;
  96 
  97 static pid_t    privileged_pid = 0;
  98 static int      privileged_psinfo_fd = -1;
  99 
 100 static int      privileged_user = 0;
 101 
 102 static priv_set_t *privileged_privs;
 103 
 104 static int      log_to_syslog = 0;
 105 
 106 int             is_main_repository = 1;
 107 
 108 int             max_repository_backups = 4;
 109 
 110 #define CONFIGD_MAX_FDS         262144
 111 












 112 /*
 113  * Thanks, Mike
 114  */
 115 void
 116 abort_handler(int sig, siginfo_t *sip, ucontext_t *ucp)
 117 {
 118         struct sigaction act;
 119 
 120         (void) sigemptyset(&act.sa_mask);
 121         act.sa_handler = SIG_DFL;
 122         act.sa_flags = 0;
 123         (void) sigaction(sig, &act, NULL);
 124 
 125         (void) printstack(2);
 126 
 127         if (sip != NULL && SI_FROMUSER(sip))
 128                 (void) pthread_kill(pthread_self(), sig);
 129         (void) sigfillset(&ucp->uc_sigmask);
 130         (void) sigdelset(&ucp->uc_sigmask, sig);
 131         ucp->uc_flags |= UC_SIGMASK;




   6  * You may not use this file except in compliance with the License.
   7  *
   8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9  * or http://www.opensolaris.org/os/licensing.
  10  * See the License for the specific language governing permissions
  11  * and limitations under the License.
  12  *
  13  * When distributing Covered Code, include this CDDL HEADER in each
  14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15  * If applicable, add the following below this CDDL HEADER, with the
  16  * fields enclosed by brackets "[]" replaced with your own identifying
  17  * information: Portions Copyright [yyyy] [name of copyright owner]
  18  *
  19  * CDDL HEADER END
  20  */
  21 /*
  22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  */
  25 
  26 /*
  27  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  28  */
  29 
  30 #include <assert.h>
  31 #include <door.h>
  32 #include <errno.h>
  33 #include <fcntl.h>
  34 #include <limits.h>
  35 #include <priv.h>
  36 #include <procfs.h>
  37 #include <pthread.h>
  38 #include <signal.h>
  39 #include <stdarg.h>
  40 #include <stdio.h>
  41 #include <stdio_ext.h>
  42 #include <stdlib.h>
  43 #include <string.h>
  44 #include <syslog.h>
  45 #include <sys/corectl.h>
  46 #include <sys/resource.h>
  47 #include <sys/stat.h>
  48 #include <sys/wait.h>


  94 
  95 static thread_info_t    main_thread_info;
  96 
  97 static int      finished;
  98 
  99 static pid_t    privileged_pid = 0;
 100 static int      privileged_psinfo_fd = -1;
 101 
 102 static int      privileged_user = 0;
 103 
 104 static priv_set_t *privileged_privs;
 105 
 106 static int      log_to_syslog = 0;
 107 
 108 int             is_main_repository = 1;
 109 
 110 int             max_repository_backups = 4;
 111 
 112 #define CONFIGD_MAX_FDS         262144
 113 
 114 const char *
 115 _umem_options_init(void)
 116 {
 117         /*
 118          * Like svc.startd, we set our UMEM_OPTIONS to indicate that we do not
 119          * wish to have per-CPU magazines to reduce our memory footprint.  And
 120          * as with svc.startd, if svc.configd is so MT-hot that this becomes a
 121          * scalability problem, there are deeper issues...
 122          */
 123         return ("nomagazines");         /* UMEM_OPTIONS setting */
 124 }
 125 
 126 /*
 127  * Thanks, Mike
 128  */
 129 void
 130 abort_handler(int sig, siginfo_t *sip, ucontext_t *ucp)
 131 {
 132         struct sigaction act;
 133 
 134         (void) sigemptyset(&act.sa_mask);
 135         act.sa_handler = SIG_DFL;
 136         act.sa_flags = 0;
 137         (void) sigaction(sig, &act, NULL);
 138 
 139         (void) printstack(2);
 140 
 141         if (sip != NULL && SI_FROMUSER(sip))
 142                 (void) pthread_kill(pthread_self(), sig);
 143         (void) sigfillset(&ucp->uc_sigmask);
 144         (void) sigdelset(&ucp->uc_sigmask, sig);
 145         ucp->uc_flags |= UC_SIGMASK;