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
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]
22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
23 /* All Rights Reserved */
27 * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
28 * Use is subject to license terms.
34 #include <sys/types.h>
35 #include <sys/types32.h>
42 * Streams Log Driver Interface Definitions
46 * structure of control portion of log message
48 typedef struct log_ctl
{
51 char level
; /* level of message for tracing */
52 short flags
; /* message disposition */
53 #if defined(_LP64) || defined(_I32LPx)
54 clock32_t ltime
; /* time in machine ticks since boot */
55 time32_t ttime
; /* time in seconds since 1970 */
60 int seq_no
; /* sequence number */
61 int pri
; /* priority = (facility|level) */
65 * Public flags for log messages
67 #define SL_FATAL 0x01 /* indicates fatal error */
68 #define SL_NOTIFY 0x02 /* logger must notify administrator */
69 #define SL_ERROR 0x04 /* include on the error log */
70 #define SL_TRACE 0x08 /* include on the trace log */
71 #define SL_CONSOLE 0x10 /* include on the console log */
72 #define SL_WARN 0x20 /* warning message */
73 #define SL_NOTE 0x40 /* notice message */
76 * Private flags for log messages -- used by internal implementation only
78 #define SL_CONSONLY 0x1000 /* send message only to /dev/console */
79 #define SL_LOGONLY 0x2000 /* send message only to /var/adm/messages */
80 #define SL_USER 0x4000 /* send message to user's terminal */
81 #define SL_PANICMSG 0x8000 /* message was created while panicking */
84 * Structure defining ids and levels desired by the tracer (I_TRCLOG).
86 typedef struct trace_ids
{
93 * Log Driver I_STR ioctl commands
96 #define LOGCTL (('L')<<8)
97 #define I_TRCLOG (LOGCTL|1) /* process is tracer */
98 #define I_ERRLOG (LOGCTL|2) /* process is error logger */
99 #define I_CONSLOG (LOGCTL|3) /* process is console logger */
101 #define STRLOG_MAKE_MSGID(fmt, msgid) \
103 uchar_t *__cp = (uchar_t *)fmt; \
106 while ((__c = *__cp++) != '\0') \
108 __id = (__id >> 5) + (__id << 27) + __c; \
109 msgid = (__id % 899981) + 100000; \
115 #include <sys/va_list.h>
119 extern int strlog(short, short, char, unsigned short, char *, ...)
121 extern int vstrlog(short, short, char, unsigned short, char *, __va_list
)
125 * STRLOG(mid,sid,level,flags,fmt,args) should be used for those trace
126 * calls that are only to be made during debugging.
128 #if defined(DEBUG) || defined(__lint)
129 #define STRLOG strlog
131 #define STRLOG 0 && strlog
132 #endif /* DEBUG || __lint */
140 #endif /* _SYS_STRLOG_H */