Print this page
12721 would like svcadm disable -c
*** 20,30 ****
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
! * Copyright (c) 2015, Joyent, Inc. All rights reserved.
*/
/*
* Service state explanation. For select services, display a description, the
* state, and possibly why the service is in that state, what's causing it to
--- 20,30 ----
*/
/*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
! * Copyright 2020 Joyent, Inc.
*/
/*
* Service state explanation. For select services, display a description, the
* state, and possibly why the service is in that state, what's causing it to
*** 131,140 ****
--- 131,142 ----
uint8_t enabled;
int temporary;
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;
uu_list_t *baddeps; /* list of dependency's */
uu_list_t *causes; /* list of svcptrs */
*** 401,411 ****
static void
add_instance(const char *svcname, const char *instname, scf_instance_t *inst)
{
inst_t *instp;
svc_t *svcp;
! int have_enabled = 0;
uint8_t i;
uint32_t h;
int r;
h = hash_name(svcname) & SVC_HASH_MASK;
--- 403,413 ----
static void
add_instance(const char *svcname, const char *instname, scf_instance_t *inst)
{
inst_t *instp;
svc_t *svcp;
! int ovr_set = 0;
uint8_t i;
uint32_t h;
int r;
h = hash_name(svcname) & SVC_HASH_MASK;
*** 477,487 ****
instp->aux_fmri = safe_strdup(g_fmri);
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;
} else {
switch (scf_error()) {
case SCF_ERROR_NOT_FOUND:
break;
--- 479,492 ----
instp->aux_fmri = safe_strdup(g_fmri);
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)
! 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:
break;
*** 506,522 ****
}
if (pg_get_single_val(g_pg, SCF_PROPERTY_ENABLED, SCF_TYPE_BOOLEAN,
&i, 0, 0) != 0)
return;
! if (!have_enabled) {
instp->enabled = i;
instp->temporary = 0;
- } else {
- instp->temporary = (instp->enabled != i);
}
if (pg_get_single_val(g_pg, SCF_PROPERTY_RESTARTER, SCF_TYPE_ASTRING,
g_fmri, g_fmri_sz, 0) == 0)
instp->restarter = safe_strdup(g_fmri);
else
instp->restarter = SCF_SERVICE_STARTD;
--- 511,534 ----
}
if (pg_get_single_val(g_pg, SCF_PROPERTY_ENABLED, SCF_TYPE_BOOLEAN,
&i, 0, 0) != 0)
return;
!
! if (ovr_set) {
! instp->temporary = (instp->enabled != i);
! } else {
instp->enabled = i;
instp->temporary = 0;
}
+ 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,
g_fmri, g_fmri_sz, 0) == 0)
instp->restarter = safe_strdup(g_fmri);
else
instp->restarter = SCF_SERVICE_STARTD;
*** 1734,1749 ****
dc = DC_RSTRDEAD;
}
} else if (strcmp(svcp->state, SCF_STATE_STRING_DISABLED) == 0) {
if (!svcp->temporary) {
! (void) puts(gettext(
! "Reason: Disabled by an administrator."));
dc = DC_DISABLED;
} else {
! (void) puts(gettext("Reason: "
! "Temporarily disabled by an administrator."));
dc = DC_TEMPDISABLED;
}
} else if (strcmp(svcp->state, SCF_STATE_STRING_MAINT) == 0) {
if (strcmp(svcp->aux_state, "administrative_request") == 0) {
--- 1746,1772 ----
dc = DC_RSTRDEAD;
}
} else if (strcmp(svcp->state, SCF_STATE_STRING_DISABLED) == 0) {
if (!svcp->temporary) {
! 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 {
! 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;
}
} else if (strcmp(svcp->state, SCF_STATE_STRING_MAINT) == 0) {
if (strcmp(svcp->aux_state, "administrative_request") == 0) {