xref: /titanic_50/usr/src/man/man9f/adjmsg.9f (revision 0a70879558a701a07771af87e7852a12f3bfd438)
te
Copyright 1989 AT&T
Copyright (c) 2006, 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]
ADJMSG 9F "Jan 16, 2006"
NAME
adjmsg - trim bytes from a message
SYNOPSIS

#include <sys/stream.h>



int adjmsg(mblk_t *mp, ssize_t len);
INTERFACE LEVEL

Architecture independent level 1 (DDI/DKI).

PARAMETERS
mp

Pointer to the message to be trimmed.

len

The number of bytes to be removed.

DESCRIPTION

The adjmsg() function removes bytes from a message. |len| (the absolute value of len) specifies the number of bytes to be removed. The adjmsg() function only trims bytes across message blocks of the same type.

The adjmsg() function finds the maximal leading sequence of message blocks of the same type as that of mp and starts removing bytes either from the head of that sequence or from the tail of that sequence. If len is greater than 0, adjmsg() removes bytes from the start of the first message block in that sequence. If len is less than 0, it removes bytes from the end of the last message block in that sequence.

The adjmsg() function fails if |len| is greater than the number of bytes in the maximal leading sequence it finds.

The adjmsg() function may remove any except the first zero-length message block created during adjusting. It may also remove any zero-length message blocks that occur within the scope of |len|.

RETURN VALUES

The adjmsg() function returns: 1

Successful completion.

0

An error occurred.

CONTEXT

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

SEE ALSO

STREAMS Programming Guide