xref: /titanic_51/usr/src/man/man9f/merror.9f (revision 1886f67eb9de99edbcda88765f2c603a30c87fc2)
te
Copyright (c) 2004, Sun Microsystems, Inc. All Rights Reserved
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
MERROR 9F "Jun 9, 2004"
NAME
merror - Send an M_ERROR message upstream
SYNOPSIS

#include <sys/stream.h>
#include <sys/strsun.h>



void merror(queue_t *wq, mblk_t *mp, int error);
INTERFACE LEVEL

Solaris DDI specific (Solaris DDI).

PARAMETERS
wq

Write queue associated with the read queue to send the M_ERROR on.

mp

Optionally, a STREAMS message to convert to an M_ERROR.

error

Error code to include in the M_ERROR message.

DESCRIPTION

The merror() function constructs an M_ERROR message, and sends the resulting message upstream.

If mp is NULL, merror() allocates a one-byte M_ERROR message. If mp is non-NULL, merror() attempts to convert the passed-in message to an M_ERROR. However, if the passed-in message has more than one reference (see dupmsg(9F)), or if it is of zero length, it is freed and a new message is allocated.

If the allocation or conversion fails, merror() silently fails. Otherwise, the resulting one-byte data block is assigned the specified error code and sent upstream.

RETURN VALUES

None.

CONTEXT

This function can be called from user, kernel or interrupt context.

NOTES

Callers must not hold any locks across an merror() that can be acquired as part of put(9E) processing.

SEE ALSO

put(9E), dupmsg(9F)

STREAMS Programming Guide