log.h revision 068ccd7a3ca82dd23e4f5d606c56438d503cc60b
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * CDDL HEADER START
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * The contents of this file are subject to the terms of the
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * Common Development and Distribution License, Version 1.0 only
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * (the "License"). You may not use this file except in compliance
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * with the License.
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * See the License for the specific language governing permissions
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * and limitations under the License.
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * When distributing Covered Code, include this CDDL HEADER in each
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * If applicable, add the following below this CDDL HEADER, with the
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * fields enclosed by brackets "[]" replaced with your own identifying
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * information: Portions Copyright [yyyy] [name of copyright owner]
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * CDDL HEADER END
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * Use is subject to license terms.
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao/* All Rights Reserved */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#pragma ident "%Z%%M% %I% %E% SMI"
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_BACKLOG LOG_LOGMIN /* console backlog queue */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_LOGMINIDX 0 /* index of smallest /dev/log clone */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_LOGMAXIDX 15 /* up to 16 /dev/log clones */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_NUMCLONES (LOG_LOGMAXIDX - LOG_LOGMINIDX + 1)
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_LOWAT 2048 /* threshold for backenable */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_HIWAT 1048576 /* threshold for tossing messages */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_MAGIC 0xf00d4109U /* "food for log" - unsent msg magic */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_RECENTSIZE 8192 /* queue of most recent messages */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_MINFREE 4096 /* message cache low water mark */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao#define LOG_MAXFREE 8192 /* message cache high water mark */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaotypedef int (log_filter_t)(log_t *, log_ctl_t *);
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao uint16_t log_flags; /* message type (e.g. SL_CONSOLE) */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao short log_inuse; /* is this log device open? */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao int log_overflow; /* messages lost due to QFULL */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao minor_t log_minor; /* minor number of associated device */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao/* Array of /dev/log minor devices */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaotypedef struct log_zone {
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao uint16_t lz_active; /* active types (OR of all log_flags fields) */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaotypedef struct log_dump {
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao uint32_t ld_msum; /* checksum32(message text) */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao * log_ctl and message text follow here -- see dump_messages()
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiao/* global zone variables */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaoextern queue_t *log_consq; /* primary console reader queue */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaoextern queue_t *log_backlogq; /* console backlog queue */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaoextern queue_t *log_intrq; /* pending high-level interrupt message queue */
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaoextern void log_init(void);
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaoextern void log_enter(void);
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaoextern void log_exit(void);
dd3988293c1bf1c272110c5f9ff36639cdc564aaSizhang Xiaoextern void log_update(log_t *, queue_t *, short, log_filter_t);
#ifdef __cplusplus