818 free_manifest_array(manifest_sets[i]);
819 }
820 free(manifest_sets);
821 }
822 return (rc);
823 }
824
825 /*
826 * Walk each service and get its manifest file.
827 *
828 * If the file exists check instance support, and cleanup any
829 * stale instances.
830 *
831 * If the file doesn't exist tear down the service and/or instances
832 * that are no longer supported by files.
833 */
834 int
835 engine_cleanup(int flags)
836 {
837 boolean_t activity = B_TRUE;
838 int r = -1;
839
840 lscf_prep_hndl();
841
842 if (flags == 1) {
843 activity = B_FALSE;
844 }
845
846 if (scf_walk_fmri(g_hndl, 0, NULL, SCF_WALK_SERVICE|SCF_WALK_NOINSTANCE,
847 lscf_service_cleanup, (void *)activity, NULL,
848 uu_warn) == SCF_SUCCESS)
849 r = 0;
850
851 (void) lscf_hash_cleanup();
852
853 return (r);
854 }
855
856 static int
857 apply_profile(manifest_info_t *info, int apply_changes)
858 {
859 bundle_t *b = internal_bundle_new();
860
861 if (lxml_get_bundle_file(b, info->mi_path, SVCCFG_OP_APPLY) != 0) {
862 internal_bundle_free(b);
863 return (-1);
864 }
865
866 if (!apply_changes) { /* we don't want to apply, just test */
867 internal_bundle_free(b);
868 return (0);
869 }
|
818 free_manifest_array(manifest_sets[i]);
819 }
820 free(manifest_sets);
821 }
822 return (rc);
823 }
824
825 /*
826 * Walk each service and get its manifest file.
827 *
828 * If the file exists check instance support, and cleanup any
829 * stale instances.
830 *
831 * If the file doesn't exist tear down the service and/or instances
832 * that are no longer supported by files.
833 */
834 int
835 engine_cleanup(int flags)
836 {
837 boolean_t activity = B_TRUE;
838 int dont_exit;
839 int r = -1;
840
841 lscf_prep_hndl();
842
843 if (flags == 1) {
844 activity = B_FALSE;
845 }
846
847 dont_exit = est->sc_cmd_flags & SC_CMD_DONT_EXIT;
848 est->sc_cmd_flags |= SC_CMD_DONT_EXIT;
849
850 if (scf_walk_fmri(g_hndl, 0, NULL, SCF_WALK_SERVICE|SCF_WALK_NOINSTANCE,
851 lscf_service_cleanup, (void *)activity, NULL,
852 uu_warn) == SCF_SUCCESS)
853 r = 0;
854
855 if (dont_exit == 0)
856 est->sc_cmd_flags &= ~SC_CMD_DONT_EXIT;
857
858 (void) lscf_hash_cleanup();
859
860 return (r);
861 }
862
863 static int
864 apply_profile(manifest_info_t *info, int apply_changes)
865 {
866 bundle_t *b = internal_bundle_new();
867
868 if (lxml_get_bundle_file(b, info->mi_path, SVCCFG_OP_APPLY) != 0) {
869 internal_bundle_free(b);
870 return (-1);
871 }
872
873 if (!apply_changes) { /* we don't want to apply, just test */
874 internal_bundle_free(b);
875 return (0);
876 }
|