7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #pragma ident "%Z%%M% %I% %E% SMI"
28
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <unistd.h>
32 #include <strings.h>
33 #include <string.h>
34 #include <errno.h>
35 #include <sys/param.h>
36 #include <sys/systeminfo.h>
37 #include <sys/sysevent/eventdefs.h>
38 #include <sys/sysevent/dr.h>
39 #include <syslog.h>
40 #include <libnvpair.h>
41 #include <stdarg.h>
42 #include <assert.h>
43 #include <sys/stat.h>
44 #include <dlfcn.h>
45 #include <signal.h>
46 #include <pcidr.h>
47
48 /*
238
239 rv = nvadd(attrlistp, name, value, type);
240 if (rv != 0) {
241 dprint(DDEBUG, "%s: nvadd() failed: attribute \"%s\", "
242 "value = %s, type = %d, rv = %d\n",
243 fn, name, value, (int)type, rv);
244 goto ERR;
245 }
246 *eqp = '=';
247 }
248
249 *argip = i;
250 return (attrlistp);
251
252 /*NOTREACHED*/
253 ERR_ARG:
254 if (eqp != NULL)
255 *eqp = '=';
256 dprint(DDEBUG, "%s: bad attribute argv[%d]: \"%s\"\n", fn, i, argv[i]);
257 ERR:
258 if (attrlistp != NULL)
259 nvlist_free(attrlistp);
260 return (NULL);
261 }
262
263
264 static struct {
265 int cmd;
266 char *name;
267 } si_cmd_nametab[] = {
268 SI_PLATFORM, "SI_PLATFORM",
269 SI_MACHINE, "SI_MACHINE",
270 };
271 static int si_cmd_nametab_len =
272 sizeof (si_cmd_nametab) / sizeof (si_cmd_nametab[0]);
273
274 static int
275 si_name2cmd(char *name)
276 {
277 int i;
278
|
7 * with the License.
8 *
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
13 *
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
19 *
20 * CDDL HEADER END
21 */
22 /*
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
25 */
26
27 #include <stdio.h>
28 #include <stdlib.h>
29 #include <unistd.h>
30 #include <strings.h>
31 #include <string.h>
32 #include <errno.h>
33 #include <sys/param.h>
34 #include <sys/systeminfo.h>
35 #include <sys/sysevent/eventdefs.h>
36 #include <sys/sysevent/dr.h>
37 #include <syslog.h>
38 #include <libnvpair.h>
39 #include <stdarg.h>
40 #include <assert.h>
41 #include <sys/stat.h>
42 #include <dlfcn.h>
43 #include <signal.h>
44 #include <pcidr.h>
45
46 /*
236
237 rv = nvadd(attrlistp, name, value, type);
238 if (rv != 0) {
239 dprint(DDEBUG, "%s: nvadd() failed: attribute \"%s\", "
240 "value = %s, type = %d, rv = %d\n",
241 fn, name, value, (int)type, rv);
242 goto ERR;
243 }
244 *eqp = '=';
245 }
246
247 *argip = i;
248 return (attrlistp);
249
250 /*NOTREACHED*/
251 ERR_ARG:
252 if (eqp != NULL)
253 *eqp = '=';
254 dprint(DDEBUG, "%s: bad attribute argv[%d]: \"%s\"\n", fn, i, argv[i]);
255 ERR:
256 nvlist_free(attrlistp);
257 return (NULL);
258 }
259
260
261 static struct {
262 int cmd;
263 char *name;
264 } si_cmd_nametab[] = {
265 SI_PLATFORM, "SI_PLATFORM",
266 SI_MACHINE, "SI_MACHINE",
267 };
268 static int si_cmd_nametab_len =
269 sizeof (si_cmd_nametab) / sizeof (si_cmd_nametab[0]);
270
271 static int
272 si_name2cmd(char *name)
273 {
274 int i;
275
|