9804 hal-set-property should support --direct option
[unleashed.git] / usr / src / cmd / smserverd / smediad_err.c
blobc8a693c4abc4773528263891f74b92d81a5892f7
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
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.
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]
20 * CDDL HEADER END
23 * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
30 #include <stdio.h>
31 #include <stdlib.h>
32 #include <stdarg.h>
33 #include <unistd.h>
34 #include <time.h>
35 #include <syslog.h>
36 #include <errno.h>
37 #include <string.h>
38 #include <sys/types.h>
39 #include <sys/stat.h>
40 #include <sys/smedia.h>
41 #include "smserver.h"
43 #define DEBUGMSG "Level[%d]: %s"
45 void
46 fatal(const char *fmt, ...)
48 va_list ap;
50 va_start(ap, fmt);
51 (void) vsyslog(LOG_DAEMON|LOG_CRIT, fmt, ap);
52 va_end(ap);
54 exit(-1);
57 void
58 quit(const char *fmt, ...)
60 va_list ap;
62 va_start(ap, fmt);
63 (void) vsyslog(LOG_DAEMON|LOG_ERR, fmt, ap);
64 va_end(ap);
66 exit(0);
70 void
71 noise(const char *fmt, ...)
73 va_list ap;
75 va_start(ap, fmt);
76 (void) vsyslog(LOG_DAEMON|LOG_WARNING, fmt, ap);
77 va_end(ap);
80 void
81 warning(const char *fmt, ...)
83 va_list ap;
85 va_start(ap, fmt);
86 (void) vsyslog(LOG_DAEMON|LOG_WARNING, fmt, ap);
87 va_end(ap);
91 void
92 info(const char *fmt, ...)
94 extern int verbose;
95 va_list ap;
97 if (verbose == 0) {
98 return;
101 va_start(ap, fmt);
102 (void) vsyslog(LOG_DAEMON|LOG_INFO, fmt, ap);
103 va_end(ap);
106 /*PRINTFLIKE2*/
107 void
108 debug(uint_t level, const char *fmt, ...)
110 extern int debug_level;
111 va_list ap;
112 char dbgmsg[BUFSIZ];
114 if (level > debug_level) {
115 return;
118 (void) snprintf(dbgmsg, sizeof (dbgmsg), DEBUGMSG, level, fmt);
119 va_start(ap, fmt);
120 (void) vsyslog(LOG_DAEMON|LOG_DEBUG, dbgmsg, ap);
121 va_end(ap);