Print this page
7711 SMF: Finish implementing support for degraded state


   5  * Common Development and Distribution License (the "License").
   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 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  * Copyright 2011 Nexenta Systems. All rights reserved.

  25  */
  26 
  27 /*
  28  * log.c - debugging and logging functions
  29  *
  30  * Logging destinations
  31  *   svc.startd(1M) supports three logging destinations:  the system log, a
  32  *   daemon-specific log (in the /var/svc/log hierarchy by default), and to the
  33  *   standard output (redirected to the /var/svc/log/svc.startd.log file by
  34  *   default).  Any or all of these destinations may be used to
  35  *   communicate a specific message; the audiences for each destination differ.
  36  *
  37  *   Generic messages associated with svc.startd(1M) are made by the
  38  *   log_framework() and log_error() functions.  For these messages, svc.startd
  39  *   logs under its own name and under the LOG_DAEMON facility when issuing
  40  *   events to the system log.  By design, severities below LOG_NOTICE are never
  41  *   issued to the system log.
  42  *
  43  *   Messages associated with a specific service instance are logged using the
  44  *   log_instance() or log_instance_fmri() functions.  These messages are always


 458                         return;
 459 
 460                 if (inst->ri_start_index > 1)
 461                         return;
 462 
 463                 if (cname)
 464                         (void) snprintf(omessage, sizeof (omessage), " (%s)",
 465                             cname);
 466                 else
 467                         *omessage = '\0';
 468 
 469                 action = gettext("starting");
 470 
 471                 message = uu_msprintf("[ %s %s%s ]\n",
 472                     inst->ri_i.i_fmri + strlen("svc:/"), action,
 473                     omessage);
 474 
 475                 severity = LOG_INFO;
 476         } else {
 477                 switch (outcome) {




 478                 case MAINT_REQUESTED:
 479                         action = gettext("transitioned to maintenance by "
 480                             "request (see 'svcs -xv' for details)");
 481                         break;
 482                 case START_FAILED_REPEATEDLY:
 483                         action = gettext("failed repeatedly: transitioned to "
 484                             "maintenance (see 'svcs -xv' for details)");
 485                         break;
 486                 case START_FAILED_CONFIGURATION:
 487                         action = gettext("misconfigured: transitioned to "
 488                             "maintenance (see 'svcs -xv' for details)");
 489                         break;
 490                 case START_FAILED_FATAL:
 491                         action = gettext("failed fatally: transitioned to "
 492                             "maintenance (see 'svcs -xv' for details)");
 493                         break;
 494                 case START_FAILED_TIMEOUT_FATAL:
 495                         action = gettext("timed out: transitioned to "
 496                             "maintenance (see 'svcs -xv' for details)");
 497                         break;




   5  * Common Development and Distribution License (the "License").
   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 2010 Sun Microsystems, Inc.  All rights reserved.
  23  * Use is subject to license terms.
  24  * Copyright 2011 Nexenta Systems. All rights reserved.
  25  * Copyright 2017 RackTop Systems.
  26  */
  27 
  28 /*
  29  * log.c - debugging and logging functions
  30  *
  31  * Logging destinations
  32  *   svc.startd(1M) supports three logging destinations:  the system log, a
  33  *   daemon-specific log (in the /var/svc/log hierarchy by default), and to the
  34  *   standard output (redirected to the /var/svc/log/svc.startd.log file by
  35  *   default).  Any or all of these destinations may be used to
  36  *   communicate a specific message; the audiences for each destination differ.
  37  *
  38  *   Generic messages associated with svc.startd(1M) are made by the
  39  *   log_framework() and log_error() functions.  For these messages, svc.startd
  40  *   logs under its own name and under the LOG_DAEMON facility when issuing
  41  *   events to the system log.  By design, severities below LOG_NOTICE are never
  42  *   issued to the system log.
  43  *
  44  *   Messages associated with a specific service instance are logged using the
  45  *   log_instance() or log_instance_fmri() functions.  These messages are always


 459                         return;
 460 
 461                 if (inst->ri_start_index > 1)
 462                         return;
 463 
 464                 if (cname)
 465                         (void) snprintf(omessage, sizeof (omessage), " (%s)",
 466                             cname);
 467                 else
 468                         *omessage = '\0';
 469 
 470                 action = gettext("starting");
 471 
 472                 message = uu_msprintf("[ %s %s%s ]\n",
 473                     inst->ri_i.i_fmri + strlen("svc:/"), action,
 474                     omessage);
 475 
 476                 severity = LOG_INFO;
 477         } else {
 478                 switch (outcome) {
 479                 case DEGRADE_REQUESTED:
 480                         action = gettext("transitioned to degraded by "
 481                             "request (see 'svcs -xv' for details)");
 482                         break;
 483                 case MAINT_REQUESTED:
 484                         action = gettext("transitioned to maintenance by "
 485                             "request (see 'svcs -xv' for details)");
 486                         break;
 487                 case START_FAILED_REPEATEDLY:
 488                         action = gettext("failed repeatedly: transitioned to "
 489                             "maintenance (see 'svcs -xv' for details)");
 490                         break;
 491                 case START_FAILED_CONFIGURATION:
 492                         action = gettext("misconfigured: transitioned to "
 493                             "maintenance (see 'svcs -xv' for details)");
 494                         break;
 495                 case START_FAILED_FATAL:
 496                         action = gettext("failed fatally: transitioned to "
 497                             "maintenance (see 'svcs -xv' for details)");
 498                         break;
 499                 case START_FAILED_TIMEOUT_FATAL:
 500                         action = gettext("timed out: transitioned to "
 501                             "maintenance (see 'svcs -xv' for details)");
 502                         break;