xref: /titanic_44/usr/src/man/man9f/ldi_putmsg.9f (revision 1d9cde1dcd9c3d71413dae0f9e9b3845a667cd9c)
te
Copyright (c) 2003, 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]
LDI_PUTMSG 9F "Jun 3, 2003"
NAME
ldi_putmsg, ldi_getmsg - Read/write message blocks from/to a stream
SYNOPSIS

#include <sys/sunldi.h>

int ldi_putmsg(ldi_handle_t lh, mblk_t *smp);

int  ldi_getmsg(ldi_handle_t lh, mblk_t **rmp, timestruc_t *timeo);
PARAMETERS
lh

Layered handle.

smp

Message block to send.

rmp

Message block to receive.

timeo

Optional timeout for data reception.

DESCRIPTION

The ldi_putmsg function allows a caller to send a message block to a streams device specified by the layered handle lh. Once the message (smp) has been passed to ldi_putmsg(), the caller must not free the message even if an error occurs.

The ldi_getmsg() function allows a caller to receive a message block from a streams device specified by the layered handle lh. Callers must free the message received with freemsg(9F).

If a NULL timeout value is specified when the caller receives a message, the caller sleeps until a message is received.

RETURN VALUES

The ldi_putmsg() and ldi_getmsg() functions return 0 upon success. If a failure occurs before the request is passed to the device, the possible return values are shown below. Otherwise any other error number may be returned by the device. EINVAL

Invalid input parameters.

ENOTSUP

Operation is not supported for this device. The ldi_getmsg() function may also return: ETIME

Returned if the timeout timeo expires with no messages received.

CONTEXT

These functions may be called from user or kernel context.