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 #pragma ident "%Z%%M% %I% %E% SMI"
36 #include <sys/types.h>
37 #include <sys/types32.h>
44 * Streams Log Driver Interface Definitions
48 * structure of control portion of log message
50 typedef struct log_ctl
{
53 char level
; /* level of message for tracing */
54 short flags
; /* message disposition */
55 #if defined(_LP64) || defined(_I32LPx)
56 clock32_t ltime
; /* time in machine ticks since boot */
57 time32_t ttime
; /* time in seconds since 1970 */
62 int seq_no
; /* sequence number */
63 int pri
; /* priority = (facility|level) */
67 * Public flags for log messages
69 #define SL_FATAL 0x01 /* indicates fatal error */
70 #define SL_NOTIFY 0x02 /* logger must notify administrator */
71 #define SL_ERROR 0x04 /* include on the error log */
72 #define SL_TRACE 0x08 /* include on the trace log */
73 #define SL_CONSOLE 0x10 /* include on the console log */
74 #define SL_WARN 0x20 /* warning message */
75 #define SL_NOTE 0x40 /* notice message */
78 * Private flags for log messages -- used by internal implementation only
80 #define SL_CONSONLY 0x1000 /* send message only to /dev/console */
81 #define SL_LOGONLY 0x2000 /* send message only to /var/adm/messages */
82 #define SL_USER 0x4000 /* send message to user's terminal */
83 #define SL_PANICMSG 0x8000 /* message was created while panicking */
86 * Structure defining ids and levels desired by the tracer (I_TRCLOG).
88 typedef struct trace_ids
{
95 * Log Driver I_STR ioctl commands
98 #define LOGCTL (('L')<<8)
99 #define I_TRCLOG (LOGCTL|1) /* process is tracer */
100 #define I_ERRLOG (LOGCTL|2) /* process is error logger */
101 #define I_CONSLOG (LOGCTL|3) /* process is console logger */
103 #define STRLOG_MAKE_MSGID(fmt, msgid) \
105 uchar_t *__cp = (uchar_t *)fmt; \
108 while ((__c = *__cp++) != '\0') \
110 __id = (__id >> 5) + (__id << 27) + __c; \
111 msgid = (__id % 899981) + 100000; \
117 #include <sys/va_list.h>
121 extern int strlog(short, short, char, unsigned short, char *, ...)
123 extern int vstrlog(short, short, char, unsigned short, char *, __va_list
)
127 * STRLOG(mid,sid,level,flags,fmt,args) should be used for those trace
128 * calls that are only to be made during debugging.
130 #if defined(DEBUG) || defined(__lint)
131 #define STRLOG strlog
133 #define STRLOG 0 && strlog
134 #endif /* DEBUG || __lint */
142 #endif /* _SYS_STRLOG_H */