Print this page
12721 would like svcadm disable -c

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/svc/startd/libscf.c
          +++ new/usr/src/cmd/svc/startd/libscf.c
↓ open down ↓ 14 lines elided ↑ open up ↑
  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   24   * Copyright 2012 Milan Jurik. All rights reserved.
       25 + * Copyright 2020 Joyent, Inc.
  25   26   */
  26   27  
  27   28  
  28   29  #include <sys/contract/process.h>
  29   30  #include <assert.h>
  30   31  #include <errno.h>
  31   32  #include <libscf.h>
  32   33  #include <libscf_priv.h>
  33   34  #include <poll.h>
  34   35  #include <stdlib.h>
↓ open down ↓ 1639 lines elided ↑ open up ↑
1674 1675   */
1675 1676  int
1676 1677  libscf_set_deathrow(scf_instance_t *inst, int deathrow)
1677 1678  {
1678 1679          return (libscf_inst_set_boolean_prop(inst, SCF_PG_DEATHROW,
1679 1680              SCF_PG_DEATHROW_TYPE, SCF_PG_DEATHROW_FLAGS,
1680 1681              SCF_PROPERTY_DEATHROW, deathrow));
1681 1682  }
1682 1683  
1683 1684  /*
     1685 + * Since we're clearing the over-ridden enabled state for the service, we'll
     1686 + * also take the opportunity to remove any comment.
     1687 + *
1684 1688   * Returns 0, ECONNABORTED, ECANCELED, or EPERM.
1685 1689   */
1686 1690  int
1687 1691  libscf_delete_enable_ovr(scf_instance_t *inst)
1688 1692  {
     1693 +        int r = scf_instance_delete_prop(inst, SCF_PG_GENERAL_OVR,
     1694 +            SCF_PROPERTY_ENABLED);
     1695 +        if (r != 0)
     1696 +                return (r);
1689 1697          return (scf_instance_delete_prop(inst, SCF_PG_GENERAL_OVR,
1690      -            SCF_PROPERTY_ENABLED));
     1698 +            SCF_PROPERTY_COMMENT));
1691 1699  }
1692 1700  
1693 1701  /*
1694 1702   * Fails with
1695 1703   *   ECONNABORTED - repository connection was broken
1696 1704   *   ECANCELED - pg was deleted
1697 1705   *   ENOENT - pg has no milestone property
1698 1706   *   EINVAL - the milestone property is misconfigured
1699 1707   */
1700 1708  static int
↓ open down ↓ 2239 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX