1PUTMSG(3P) POSIX Programmer's Manual PUTMSG(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
11
13 putmsg, putpmsg — send a message on a STREAM (STREAMS)
14
16 #include <stropts.h>
17
18 int putmsg(int fildes, const struct strbuf *ctlptr,
19 const struct strbuf *dataptr, int flags);
20 int putpmsg(int fildes, const struct strbuf *ctlptr,
21 const struct strbuf *dataptr, int band, int flags);
22
24 The putmsg() function shall create a message from a process buffer(s)
25 and send the message to a STREAMS file. The message may contain either
26 a data part, a control part, or both. The data and control parts are
27 distinguished by placement in separate buffers, as described below. The
28 semantics of each part are defined by the STREAMS module that receives
29 the message.
30
31 The putpmsg() function is equivalent to putmsg(), except that the
32 process can send messages in different priority bands. Except where
33 noted, all requirements on putmsg() also pertain to putpmsg().
34
35 The fildes argument specifies a file descriptor referencing an open
36 STREAM. The ctlptr and dataptr arguments each point to a strbuf struc‐
37 ture.
38
39 The ctlptr argument points to the structure describing the control
40 part, if any, to be included in the message. The buf member in the str‐
41 buf structure points to the buffer where the control information
42 resides, and the len member indicates the number of bytes to be sent.
43 The maxlen member is not used by putmsg(). In a similar manner, the
44 argument dataptr specifies the data, if any, to be included in the mes‐
45 sage. The flags argument indicates what type of message should be sent
46 and is described further below.
47
48 To send the data part of a message, the application shall ensure that
49 dataptr is not a null pointer and the len member of dataptr is 0 or
50 greater. To send the control part of a message, the application shall
51 ensure that the corresponding values are set for ctlptr. No data (con‐
52 trol) part shall be sent if either dataptr(ctlptr) is a null pointer or
53 the len member of dataptr(ctlptr) is set to −1.
54
55 For putmsg(), if a control part is specified and flags is set to
56 RS_HIPRI, a high priority message shall be sent. If no control part is
57 specified, and flags is set to RS_HIPRI, putmsg() shall fail and set
58 errno to [EINVAL]. If flags is set to 0, a normal message (priority
59 band equal to 0) shall be sent. If a control part and data part are
60 not specified and flags is set to 0, no message shall be sent and 0
61 shall be returned.
62
63 For putpmsg(), the flags are different. The flags argument is a bitmask
64 with the following mutually-exclusive flags defined: MSG_HIPRI and
65 MSG_BAND. If flags is set to 0, putpmsg() shall fail and set errno to
66 [EINVAL]. If a control part is specified and flags is set to MSG_HIPRI
67 and band is set to 0, a high-priority message shall be sent. If