Print this page
12721 would like svcadm disable -c

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/svcs/svcs.c
          +++ new/usr/src/cmd/svc/svcs/svcs.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  
  22   22  /*
  23   23   * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24      - * Copyright 2019 Joyent, Inc.
       24 + * Copyright 2020 Joyent, Inc.
  25   25   * Copyright (c) 2015, 2016 by Delphix. All rights reserved.
  26   26   */
  27   27  
  28   28  /*
  29   29   * svcs - display attributes of service instances
  30   30   *
  31   31   * We have two output formats and six instance selection mechanisms.  The
  32   32   * primary output format is a line of attributes (selected by -o), possibly
  33   33   * followed by process description lines (if -p is specified), for each
  34   34   * instance selected.  The columns available to display are described by the
↓ open down ↓ 45 lines elided ↑ open up ↑
  80   80  #include <time.h>
  81   81  #include <libzonecfg.h>
  82   82  #include <zone.h>
  83   83  
  84   84  #ifndef TEXT_DOMAIN
  85   85  #define TEXT_DOMAIN     "SUNW_OST_OSCMD"
  86   86  #endif /* TEXT_DOMAIN */
  87   87  
  88   88  #define LEGACY_UNKNOWN  "unknown"
  89   89  
  90      -/* Flags for pg_get_single_val() */
  91      -#define EMPTY_OK        0x01
  92      -#define MULTI_OK        0x02
  93      -
  94   90  /*
  95   91   * Per proc(4) when pr_nlwp, pr_nzomb, and pr_lwp.pr_lwpid are all 0,
  96   92   * the process is a zombie.
  97   93   */
  98   94  #define IS_ZOMBIE(_psip) \
  99   95          ((_psip)->pr_nlwp == 0 && (_psip)->pr_nzomb == 0 && \
 100   96          (_psip)->pr_lwp.pr_lwpid == 0)
 101   97  
 102   98  /*
 103   99   * An AVL-storable node for output lines and the keys to sort them by.
↓ open down ↓ 298 lines elided ↑ open up ↑
 402  398                          goto misconfigured;
 403  399  
 404  400                  case SCF_ERROR_PERMISSION_DENIED:
 405  401                  default:
 406  402                          scfdie();
 407  403                  }
 408  404          }
 409  405  
 410  406          switch (ty) {
 411  407          case SCF_TYPE_ASTRING:
 412      -                r = scf_value_get_astring(g_val, vp, sz) > 0 ? SCF_SUCCESS : -1;
      408 +                r = scf_value_get_astring(g_val, vp, sz);
      409 +                if (r == 0 && !(flags & EMPTY_OK)) {
      410 +                        uu_die(gettext("Unexpected empty string for property "
      411 +                            "%s.  Exiting.\n"), propname);
      412 +                }
      413 +                if (r >= 0)
      414 +                        r = SCF_SUCCESS;
 413  415                  break;
 414  416  
 415  417          case SCF_TYPE_BOOLEAN:
 416  418                  r = scf_value_get_boolean(g_val, (uint8_t *)vp);
 417  419                  break;
 418  420  
 419  421          case SCF_TYPE_COUNT:
 420  422                  r = scf_value_get_count(g_val, (uint64_t *)vp);
 421  423                  break;
 422  424  
↓ open down ↓ 2047 lines elided ↑ open up ↑
2470 2472                              temp ? gettext("true") : gettext("false"));
2471 2473                  else
2472 2474                          (void) printf(fmt, DETAILED_WIDTH,
2473 2475                              gettext("enabled"), temp ? gettext("true") :
2474 2476                              gettext("false"));
2475 2477          } else if (perm != -1) {
2476 2478                  (void) printf(fmt, DETAILED_WIDTH, gettext("enabled"),
2477 2479                      perm ? gettext("true") : gettext("false"));
2478 2480          }
2479 2481  
     2482 +        if (temp == 0 || (temp == -1 && perm == 0)) {
     2483 +                char comment[SCF_COMMENT_MAX_LENGTH] = "";
     2484 +                const char *pg = (temp != -1 && temp != perm) ?
     2485 +                    SCF_PG_GENERAL_OVR : SCF_PG_GENERAL;
     2486 +
     2487 +                (void) inst_get_single_val(wip->inst, pg, SCF_PROPERTY_COMMENT,
     2488 +                    SCF_TYPE_ASTRING, &comment, sizeof (comment),
     2489 +                    EMPTY_OK, 0, 0);
     2490 +
     2491 +                if (comment[0] != '\0') {
     2492 +                        printf(fmt, DETAILED_WIDTH, gettext("comment"),
     2493 +                            comment);
     2494 +                }
     2495 +        }
     2496 +
2480 2497          /*
2481 2498           * Property values may be longer than max_scf_fmri_length, but these
2482 2499           * shouldn't be, so we'll just reuse buf.  The user can use svcprop if
2483 2500           * they suspect something fishy.
2484 2501           */
2485 2502          if (scf_instance_get_pg(wip->inst, SCF_PG_RESTARTER, rpg) != 0) {
2486 2503                  if (scf_error() != SCF_ERROR_NOT_FOUND)
2487 2504                          scfdie();
2488 2505  
2489 2506                  scf_pg_destroy(rpg);
↓ open down ↓ 1446 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX