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.
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.
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]
23 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
26 #include <sys/types.h>
40 #include "manifest_find.h"
41 #include "manifest_hash.h"
46 * mfstscan - service manifest change detection utility
48 * mfstscan walks the given filesystem hierarchies, and reports those manifests
49 * with changed or absent hash entries. Manifests are expected to end with a
50 * .xml suffix--other files will be ignored.
56 (void) fprintf(stderr
, gettext("Usage: %s [-t] path ...\n"),
62 main(int argc
, char *argv
[])
64 manifest_info_t
**entry
;
65 manifest_info_t
**manifests
;
66 scf_handle_t
*hndl
= NULL
;
73 (void) uu_setpname(argv
[0]);
75 while ((i
= getopt(argc
, argv
, "t")) != -1) {
91 if ((hndl
= scf_handle_create(SCF_VERSION
)) == NULL
)
92 uu_die(gettext("Unexpected libscf error: %s. Exiting.\n"),
93 scf_strerror(scf_error()));
95 if (scf_handle_bind(hndl
) != SCF_SUCCESS
)
96 uu_die(gettext("Couldn't bind to svc.configd.\n"));
98 for (i
= optind
; i
< argc
; i
++) {
100 char *pname
= mhash_filename_to_propname(argv
[i
],
106 uu_warn(gettext("cannot resolve pathname "
112 if (stat(argv
[i
], &sb
) == -1) {
113 uu_warn(gettext("cannot stat %s"), argv
[i
]);
117 status
= find_manifests(hndl
, argv
[i
], &manifests
,
120 uu_warn(gettext("file tree walk of %s encountered "
121 "error. %s\n"), argv
[i
], strerror(errno
));
124 if (manifests
!= NULL
) {
125 for (entry
= manifests
;
128 (void) printf("%s\n",
131 free_manifest_array(manifests
);
138 uu_die(gettext("no paths walked\n"));
141 (void) scf_handle_unbind(hndl
);
142 (void) scf_handle_destroy(hndl
);