9762 Split the custr functions into their own library
[unleashed.git] / usr / src / man / man9f / merror.9f
blobef93fbb4ceb61da41ebcc3c0016c4a7dd6774fcf
1 '\" te
2 .\" Copyright (c) 2004, Sun Microsystems, Inc.  All Rights Reserved
3 .\" 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.
4 .\" 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.
5 .\" 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]
6 .TH MERROR 9F "Jun 9, 2004"
7 .SH NAME
8 merror \- Send an M_ERROR message upstream
9 .SH SYNOPSIS
10 .LP
11 .nf
12 #include <sys/stream.h>
13 #include <sys/strsun.h>
17 \fBvoid\fR \fBmerror\fR(\fBqueue_t *\fR\fIwq\fR, \fBmblk_t *\fR\fImp\fR, \fBint\fR \fIerror\fR);
18 .fi
20 .SH INTERFACE LEVEL
21 .sp
22 .LP
23 Solaris DDI specific (Solaris DDI).
24 .SH PARAMETERS
25 .sp
26 .ne 2
27 .na
28 \fB\fIwq\fR\fR
29 .ad
30 .RS 9n
31 Write queue associated with the read queue to send the M_ERROR on.
32 .RE
34 .sp
35 .ne 2
36 .na
37 \fB\fImp\fR\fR
38 .ad
39 .RS 9n
40 Optionally, a STREAMS message to convert to an M_ERROR.
41 .RE
43 .sp
44 .ne 2
45 .na
46 \fB\fIerror\fR\fR
47 .ad
48 .RS 9n
49 Error code to include in the M_ERROR message.
50 .RE
52 .SH DESCRIPTION
53 .sp
54 .LP
55 The \fBmerror()\fR function constructs an M_ERROR message, and sends the
56 resulting message upstream.
57 .sp
58 .LP
59 If \fImp\fR is NULL, \fBmerror()\fR allocates a one-byte M_ERROR message. If
60 \fImp\fR is non-NULL, \fBmerror()\fR attempts to convert the passed-in message
61 to an M_ERROR. However, if the passed-in message has more than one reference
62 (see \fBdupmsg\fR(9F)), or if it is of zero length, it is freed and a new
63 message is allocated.
64 .sp
65 .LP
66 If the allocation or conversion fails, \fBmerror()\fR silently fails.
67 Otherwise, the resulting one-byte data block is assigned the specified error
68 code and sent upstream.
69 .SH RETURN VALUES
70 .sp
71 .LP
72 None.
73 .SH CONTEXT
74 .sp
75 .LP
76 This function can be called from user, kernel or interrupt context.
77 .SH NOTES
78 .sp
79 .LP
80 Callers must not hold any locks across an \fBmerror()\fR that can be acquired
81 as part of \fBput\fR(9E) processing.
82 .SH SEE ALSO
83 .sp
84 .LP
85 \fBput\fR(9E), \fBdupmsg\fR(9F)
86 .sp
87 .LP
88 \fISTREAMS Programming Guide\fR