xref: /titanic_51/usr/src/man/man9f/unlinkb.9f (revision e18306b13ed357bd545696aa96b53617b64db4a3)
te
Copyright (c) 2006, Sun Microsystems, Inc. All Rights Reserved.
Copyright 1989 AT&T
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]
UNLINKB 9F "Jan 16, 2006"
NAME
unlinkb - remove a message block from the head of a message
SYNOPSIS

#include <sys/stream.h>



mblk_t *unlinkb(mblk_t *mp);
INTERFACE LEVEL

Architecture independent level 1 (DDI/DKI).

PARAMETERS
mp

Pointer to the message.

DESCRIPTION

The unlinkb() function removes the first message block from the message pointed to by mp. A new message, minus the removed message block, is returned.

RETURN VALUES

If successful, the unlinkb() function returns a pointer to the message with the first message block removed. If there is only one message block in the message, NULL is returned.

CONTEXT

The unlinkb() function can be called from user, interrupt, or kernel context.

EXAMPLES

Example 1 unlinkb() example

The routine expects to get passed an M_PROTO T_DATA_IND message. It will remove and free the M_PROTO header and return the remaining M_DATA portion of the message.

1 mblk_t *
2 makedata(mp)
3 mblk_t *mp;
4 {
5 mblk_t *nmp;
6
7 nmp = unlinkb(mp);
8 freeb(mp);
9 return(nmp);
10 }
SEE ALSO

linkb(9F)

Writing Device Drivers

STREAMS Programming Guide