1mexchange(9F)            Kernel Functions for Drivers            mexchange(9F)
2
3
4

NAME

6       mexchange - Exchange one message for another
7

SYNOPSIS

9       #include <sys/stream.h>
10       #include <sys/strsun.h>
11
12
13
14       mblk_t *mexchange(queue_t *wq, mblk_t *mp, size_t size,
15            uchar_t type, int32_t primtype);
16
17

INTERFACE LEVEL

19       Solaris DDI specific (Solaris DDI).
20

PARAMETERS

22       wq          Optionally,  write  queue associated with the read queue to
23                   be used on failure (see below).
24
25
26       mp          Optionally, the message to exchange.
27
28
29       size        Size of the returned message.
30
31
32       type        Type of the returned message.
33
34
35       primtype    Optionally, a 4 byte value to store at the beginning of the
36                   returned message.
37
38

DESCRIPTION

40       The  mexchange()  function  exchanges the passed in message for another
41       message of the specified size and type.
42
43
44       If mp is not NULL, is of at least size bytes, and has only  one  refer‐
45       ence  (see dupmsg(9F)), mp is converted to be of the specified size and
46       type. Otherwise, a new message of the specified size and type is  allo‐
47       cated.  If allocation fails, and wq is not NULL, merror(9F) attempts to
48       send an error to the stream head.
49
50
51       Finally, if primtype is not -1 and size is at least 4 bytes, the  first
52       4  bytes  are  assigned  to  be  primtype.  This  is chiefly useful for
53       STREAMS-based protocols such as DLPI and TPI which store  the  protocol
54       message type in the first 4 bytes of each message.
55

RETURN VALUES

57       A  pointer  to  the  requested  message is returned on success. NULL is
58       returned on failure.
59

CONTEXT

61       This function can be called from user, kernel or interrupt context.
62

SEE ALSO

64       dupmsg(9F), merror(9F)
65
66
67       STREAMS Programming Guide
68
69
70
71SunOS 5.11                        9 June 2004                    mexchange(9F)
Impressum