diff options
author | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-06-03 11:38:44 +0000 |
---|---|---|
committer | Jerry Jelinek <jerry.jelinek@joyent.com> | 2020-06-03 11:38:44 +0000 |
commit | 1c5ac86169ba0e28b070d8b7f6c787be64bce7e4 (patch) | |
tree | 984f229706437e50b866d25cd3aced33f9358a5f /usr/src/cmd/svc/svcs/explain.c | |
parent | ed13e9ae4cee8abfe808486d0e0d7ee69b8fc256 (diff) | |
parent | d15d17d4231f87f1571fa6d585377206f360f667 (diff) | |
download | illumos-joyent-1c5ac86169ba0e28b070d8b7f6c787be64bce7e4.tar.gz |
[illumos-gate merge]
commit d15d17d4231f87f1571fa6d585377206f360f667
12786 fix CTF pointer overrun
commit 8fff788790878e3c95666decd46960ecc74c1c69
12721 would like svcadm disable -c
commit 87be0d9605ee884229638b6fd168fa7165e109a3
12813 pptadm and libppt are x86 only
commit 069e6b7e31ba5dcbc5441b98af272714d9a5455c
12708 Packages could be linted
12717 Stop ignoring pkgdepend errors
commit 605d010da59abaf92279a7caed83515cbb3218dc
7510 enable highres clock usage for non-privileged users
Conflicts:
usr/src/man/man3c/timer_settime.3c
Diffstat (limited to 'usr/src/cmd/svc/svcs/explain.c')
-rw-r--r-- | usr/src/cmd/svc/svcs/explain.c | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/usr/src/cmd/svc/svcs/explain.c b/usr/src/cmd/svc/svcs/explain.c index 41ba1b3b47..8a8dfa043b 100644 --- a/usr/src/cmd/svc/svcs/explain.c +++ b/usr/src/cmd/svc/svcs/explain.c @@ -22,7 +22,7 @@ /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. - * Copyright (c) 2015, Joyent, Inc. All rights reserved. + * Copyright 2020 Joyent, Inc. */ /* @@ -133,6 +133,8 @@ typedef struct { const char *restarter; uu_list_t *dependencies; /* list of dependency_group's */ + char comment[SCF_COMMENT_MAX_LENGTH]; + int active; /* In use? (cycle detection) */ int restarter_bad; const char *summary; @@ -404,7 +406,7 @@ add_instance(const char *svcname, const char *instname, scf_instance_t *inst) { inst_t *instp; svc_t *svcp; - int have_enabled = 0; + int ovr_set = 0; uint8_t i; uint32_t h; int r; @@ -480,7 +482,10 @@ add_instance(const char *svcname, const char *instname, scf_instance_t *inst) if (scf_instance_get_pg(inst, SCF_PG_GENERAL_OVR, g_pg) == 0) { if (pg_get_single_val(g_pg, SCF_PROPERTY_ENABLED, SCF_TYPE_BOOLEAN, &instp->enabled, 0, 0) == 0) - have_enabled = 1; + ovr_set = 1; + (void) pg_get_single_val(g_pg, SCF_PROPERTY_COMMENT, + SCF_TYPE_ASTRING, instp->comment, + sizeof (instp->comment), EMPTY_OK); } else { switch (scf_error()) { case SCF_ERROR_NOT_FOUND: @@ -509,11 +514,18 @@ add_instance(const char *svcname, const char *instname, scf_instance_t *inst) if (pg_get_single_val(g_pg, SCF_PROPERTY_ENABLED, SCF_TYPE_BOOLEAN, &i, 0, 0) != 0) return; - if (!have_enabled) { + + if (ovr_set) { + instp->temporary = (instp->enabled != i); + } else { instp->enabled = i; instp->temporary = 0; - } else { - instp->temporary = (instp->enabled != i); + } + + if (!instp->temporary) { + (void) pg_get_single_val(g_pg, SCF_PROPERTY_COMMENT, + SCF_TYPE_ASTRING, instp->comment, + sizeof (instp->comment), EMPTY_OK); } if (pg_get_single_val(g_pg, SCF_PROPERTY_RESTARTER, SCF_TYPE_ASTRING, @@ -1737,12 +1749,23 @@ print_reasons(const inst_t *svcp, int verbose) } else if (strcmp(svcp->state, SCF_STATE_STRING_DISABLED) == 0) { if (!svcp->temporary) { - (void) puts(gettext( - "Reason: Disabled by an administrator.")); + if (svcp->comment[0] != '\0') { + (void) printf(gettext("Reason: Disabled by " + "an administrator: %s\n"), svcp->comment); + } else { + (void) printf(gettext("Reason: Disabled by " + "an administrator.\n")); + } dc = DC_DISABLED; } else { - (void) puts(gettext("Reason: " - "Temporarily disabled by an administrator.")); + if (svcp->comment[0] != '\0') { + (void) printf(gettext("Reason: Temporarily " + "disabled by an administrator: %s\n"), + svcp->comment); + } else { + (void) printf(gettext("Reason: Temporarily " + "disabled by an administrator.\n")); + } dc = DC_TEMPDISABLED; } |