1.\" 2.\" The contents of this file are subject to the terms of the 3.\" Common Development and Distribution License (the "License"). 4.\" You may not use this file except in compliance with the License. 5.\" 6.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 7.\" or http://www.opensolaris.org/os/licensing. 8.\" See the License for the specific language governing permissions 9.\" and limitations under the License. 10.\" 11.\" When distributing Covered Code, include this CDDL HEADER in each 12.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. 13.\" If applicable, add the following below this CDDL HEADER, with the 14.\" fields enclosed by brackets "[]" replaced with your own identifying 15.\" information: Portions Copyright [yyyy] [name of copyright owner] 16.\" 17.\" Copyright (c) 2006, Sun Microsystems, Inc., All Rights Reserved 18.\" Copyright 2026 Oxide Computer Company 19.\" 20.Dd March 23, 2026 21.Dt MSGPULLUP 9F 22.Os 23.Sh NAME 24.Nm msgpullup , 25.Nm msgpullup_pad 26.Nd concatenate bytes in a message 27.Sh SYNOPSIS 28.In sys/stream.h 29.Ft "mblk_t *" 30.Fo msgpullup 31.Fa "mblk_t *mp" 32.Fa "ssize_t len" 33.Fc 34.Ft "mblk_t *" 35.Fo msgpullup_pad 36.Fa "mblk_t *mp" 37.Fa "ssize_t len" 38.Fa "size_t pad" 39.Fc 40.Sh INTERFACE LEVEL 41Architecture independent level 1 (DDI/DKI). 42.Sh PARAMETERS 43.Bl -tag -width Fa 44.It Fa mp 45A pointer to an 46.Xr mblk 9S 47structure whose blocks are to be concatenated. 48.It Fa len 49The number of bytes to concatenate. 50.It Fa pad 51The number of uninitialised bytes which should be inserted before the payload in 52the returned frame. 53.El 54.Sh DESCRIPTION 55The 56.Fn msgpullup 57and 58.Fn msgpullup_pad 59functions concatenate and align the first 60.Fa len 61data bytes of the message pointed to by 62.Fa mp , 63copying the data into a new message. 64.Fn msgpullup_pad 65allows for the insertion of exactly 66.Fa pad 67bytes before this copied segment to set up desired alignment of any internal 68structures. 69.Fn msgpullup 70inserts no such padding. 71Any remaining bytes in the remaining message blocks will be cheaply referenced 72via 73.Xr dupmsg 9F 74and linked onto the new message. 75The original message is unaltered and a new lead 76.Ft mblk_t 77will always be allocated for a successful call, regardless of whether 78.Fa mp 79already has sufficient contiguous data bytes or headroom. 80If 81.Fa len 82equals 83.Sy -1 , 84all data are concatenated. 85.Pp 86Allocation of padding bytes can be useful for modules working with network 87packets. 88If a driver expects that it (or a subsequent module) will insert additional 89headers or encapsulation, this can provide sufficient headroom to keep all 90packet headers within a single 91.Ft mblk_t . 92This padding can be used by adjusting 93.Fa b_rptr 94downwards, where 95.Fa db_base 96.Po 97.Xr datab 9S 98.Pc 99is the lower bound. 100.Pp 101If 102.Fa len 103bytes of the same message type cannot be found, or the requested padding would 104cause an overflow, 105.Fn msgpullup 106and 107.Fn msgpullup_pad 108fail and return 109.Dv NULL . 110.Sh CONTEXT 111The 112.Fn msgpullup 113and 114.Fn msgpullup_pad 115functions can be called from user, interrupt, or kernel context. 116.Sh RETURN VALUES 117Upon successful completion, the 118.Fn msgpullup 119and 120.Fn msgpullup_pad 121functions return a non-NULL pointer to the new message. 122.Dv NULL 123is returned to indicate an illegal set of parameters or an allocation failure. 124.Sh SEE ALSO 125.Xr srv 9E , 126.Xr allocb 9F , 127.Xr dupmsg 9F , 128.Xr pullupmsg 9F , 129.Xr datab 9S , 130.Xr msgb 9S 131.Rs 132.%T Writing Device Drivers 133.Re 134.Rs 135.%T STREAMS Programming Guide 136.Re 137.Sh NOTES 138The 139.Fn msgpullup 140function is a DKI-compliant replacement for the older 141.Xr pullupmsg 9F 142routine. 143Users are strongly encouraged to use 144.Fn msgpullup 145instead of 146.Xr pullupmsg 9F . 147