Print this page
12721 would like svcadm disable -c


   4  * The contents of this file are subject to the terms of the
   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 /*
  23  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2019 Joyent, Inc.
  25  * Copyright 2012 Milan Jurik. All rights reserved.
  26  * Copyright 2017 RackTop Systems.
  27  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
  28  */
  29 
  30 
  31 #include <alloca.h>
  32 #include <assert.h>
  33 #include <ctype.h>
  34 #include <door.h>
  35 #include <errno.h>
  36 #include <fcntl.h>
  37 #include <fnmatch.h>
  38 #include <inttypes.h>
  39 #include <libintl.h>
  40 #include <libnvpair.h>
  41 #include <libscf.h>
  42 #include <libscf_priv.h>
  43 #include <libtecla.h>
  44 #include <libuutil.h>


10505             prop_get_val(exp_prop, exp_val) == 0) {
10506                 if (scf_value_get_boolean(exp_val, &enabled) != SCF_SUCCESS)
10507                         scfdie();
10508         } else {
10509                 enabled = 0;
10510         }
10511 
10512         safe_setprop(inode, enabled_attr, enabled ? true : false);
10513 
10514         if (scf_iter_pg_properties(exp_prop_iter, pg) != SCF_SUCCESS)
10515                 scfdie();
10516 
10517         (void) memset(&pgelts, 0, sizeof (pgelts));
10518 
10519         while ((ret = scf_iter_next_property(exp_prop_iter, exp_prop)) == 1) {
10520                 if (scf_property_get_name(exp_prop, exp_str, exp_str_sz) < 0)
10521                         scfdie();
10522 
10523                 if (strcmp(exp_str, scf_property_enabled) == 0) {
10524                         continue;


10525                 } else if (strcmp(exp_str, SCF_PROPERTY_RESTARTER) == 0) {
10526                         xmlNodePtr rnode, sfnode;
10527 
10528                         rnode = xmlNewNode(NULL, (xmlChar *)"restarter");
10529                         if (rnode == NULL)
10530                                 uu_die(emsg_create_xml);
10531 
10532                         sfnode = xmlNewChild(rnode, NULL,
10533                             (xmlChar *)"service_fmri", NULL);
10534                         if (sfnode == NULL)
10535                                 uu_die(emsg_create_xml);
10536 
10537                         if (set_attr_from_prop(exp_prop, sfnode,
10538                             value_attr) == 0) {
10539                                 elts->restarter = rnode;
10540                                 continue;
10541                         }
10542 
10543                         xmlFreeNode(rnode);
10544                 }




   4  * The contents of this file are subject to the terms of the
   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 /*
  23  * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
  24  * Copyright 2020 Joyent, Inc.
  25  * Copyright 2012 Milan Jurik. All rights reserved.
  26  * Copyright 2017 RackTop Systems.
  27  * Copyright 2018 OmniOS Community Edition (OmniOSce) Association.
  28  */
  29 
  30 
  31 #include <alloca.h>
  32 #include <assert.h>
  33 #include <ctype.h>
  34 #include <door.h>
  35 #include <errno.h>
  36 #include <fcntl.h>
  37 #include <fnmatch.h>
  38 #include <inttypes.h>
  39 #include <libintl.h>
  40 #include <libnvpair.h>
  41 #include <libscf.h>
  42 #include <libscf_priv.h>
  43 #include <libtecla.h>
  44 #include <libuutil.h>


10505             prop_get_val(exp_prop, exp_val) == 0) {
10506                 if (scf_value_get_boolean(exp_val, &enabled) != SCF_SUCCESS)
10507                         scfdie();
10508         } else {
10509                 enabled = 0;
10510         }
10511 
10512         safe_setprop(inode, enabled_attr, enabled ? true : false);
10513 
10514         if (scf_iter_pg_properties(exp_prop_iter, pg) != SCF_SUCCESS)
10515                 scfdie();
10516 
10517         (void) memset(&pgelts, 0, sizeof (pgelts));
10518 
10519         while ((ret = scf_iter_next_property(exp_prop_iter, exp_prop)) == 1) {
10520                 if (scf_property_get_name(exp_prop, exp_str, exp_str_sz) < 0)
10521                         scfdie();
10522 
10523                 if (strcmp(exp_str, scf_property_enabled) == 0) {
10524                         continue;
10525                 } else if (strcmp(exp_str, SCF_PROPERTY_COMMENT) == 0) {
10526                         continue;
10527                 } else if (strcmp(exp_str, SCF_PROPERTY_RESTARTER) == 0) {
10528                         xmlNodePtr rnode, sfnode;
10529 
10530                         rnode = xmlNewNode(NULL, (xmlChar *)"restarter");
10531                         if (rnode == NULL)
10532                                 uu_die(emsg_create_xml);
10533 
10534                         sfnode = xmlNewChild(rnode, NULL,
10535                             (xmlChar *)"service_fmri", NULL);
10536                         if (sfnode == NULL)
10537                                 uu_die(emsg_create_xml);
10538 
10539                         if (set_attr_from_prop(exp_prop, sfnode,
10540                             value_attr) == 0) {
10541                                 elts->restarter = rnode;
10542                                 continue;
10543                         }
10544 
10545                         xmlFreeNode(rnode);
10546                 }