Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: July 2017
 
 

unlinkb(9F)

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 for Oracle Solaris 11.3

STREAMS Programming Guide