UNIX Network Programming Volume 1, Third Edition [Electronic resources] : The Sockets Networking API

Addison Wesley

نسخه متنی -صفحه : 450/ 391
نمايش فراداده

31.4 getpmsg and putpmsg Functions

When support for different priority bands was added to STREAMS with SVR4, the following two variants of getmsg and putmsg were added:

#include <stropts.h>

int getpmsg(int

fd , struct strbuf *

ctlptr , struct strbuf *

dataptr , int *

bandp , int *

flagsp ) ;

int putpmsg(int

fd , const struct strbuf *

ctlptr , const struct strbuf *

dataptr , int

band , int

flags ) ;

Both return: non-negative value if OK, 1 on error

The

band argument to putpmsg must be between 0 and 255, inclusive. If the

flags argument is MSG_BAND, then a message is generated in the specified priority band. Setting

flags to MSG_BAND and specifying a band of 0 is equivalent to calling putmsg. If

flags is MSG_HIPRI,

band must be 0, and a high-priority message is generated. (Note that this flag is named differently from the RS_HIPRI flag for putmsg.)

The two integers pointed to by

bandp and

flagsp are value-result arguments for getpmsg. The integer pointed to by

flagsp for getpmsg can be MSG_HIPRI (to read a high-priority message), MSG_BAND (to read a message whose priority band is at least equal to the integer pointed to by

bandp ), or MSG_ANY (to read any message). On return, the integer pointed to by

bandp contains the band of the message that was read and the integer pointed to by

flagsp contains MSG_HIPRI (if a high-priority message was read) or MSG_BAND (if some other message was read).