Print this page
12721 would like svcadm disable -c

@@ -19,11 +19,11 @@
  * CDDL HEADER END
  */
 
 /*
  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2019 Joyent, Inc.
+ * Copyright 2020 Joyent, Inc.
  * Copyright (c) 2015, 2016 by Delphix. All rights reserved.
  */
 
 /*
  * svcs - display attributes of service instances

@@ -85,14 +85,10 @@
 #define TEXT_DOMAIN     "SUNW_OST_OSCMD"
 #endif /* TEXT_DOMAIN */
 
 #define LEGACY_UNKNOWN  "unknown"
 
-/* Flags for pg_get_single_val() */
-#define EMPTY_OK        0x01
-#define MULTI_OK        0x02
-
 /*
  * Per proc(4) when pr_nlwp, pr_nzomb, and pr_lwp.pr_lwpid are all 0,
  * the process is a zombie.
  */
 #define IS_ZOMBIE(_psip) \

@@ -407,11 +403,17 @@
                 }
         }
 
         switch (ty) {
         case SCF_TYPE_ASTRING:
-                r = scf_value_get_astring(g_val, vp, sz) > 0 ? SCF_SUCCESS : -1;
+                r = scf_value_get_astring(g_val, vp, sz);
+                if (r == 0 && !(flags & EMPTY_OK)) {
+                        uu_die(gettext("Unexpected empty string for property "
+                            "%s.  Exiting.\n"), propname);
+                }
+                if (r >= 0)
+                        r = SCF_SUCCESS;
                 break;
 
         case SCF_TYPE_BOOLEAN:
                 r = scf_value_get_boolean(g_val, (uint8_t *)vp);
                 break;

@@ -2475,10 +2477,25 @@
         } else if (perm != -1) {
                 (void) printf(fmt, DETAILED_WIDTH, gettext("enabled"),
                     perm ? gettext("true") : gettext("false"));
         }
 
+        if (temp == 0 || (temp == -1 && perm == 0)) {
+                char comment[SCF_COMMENT_MAX_LENGTH] = "";
+                const char *pg = (temp != -1 && temp != perm) ?
+                    SCF_PG_GENERAL_OVR : SCF_PG_GENERAL;
+
+                (void) inst_get_single_val(wip->inst, pg, SCF_PROPERTY_COMMENT,
+                    SCF_TYPE_ASTRING, &comment, sizeof (comment),
+                    EMPTY_OK, 0, 0);
+
+                if (comment[0] != '\0') {
+                        printf(fmt, DETAILED_WIDTH, gettext("comment"),
+                            comment);
+                }
+        }
+
         /*
          * Property values may be longer than max_scf_fmri_length, but these
          * shouldn't be, so we'll just reuse buf.  The user can use svcprop if
          * they suspect something fishy.
          */