Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: Thursday, June 13, 2019

putnextctl2 (9F)


putnextctl2 - send a control message with two single-byte parameters to a queue


#include <sys/stream.h>
int putnextctl2(queue_t *q, int type, int p1, int p2);



Queue to which the message is to be sent.


Type of message.


First single-byte parameter.


Second single-byte parameter.

Interface Level

Architecture independent level 1 (DDI/DKI).


The putnextctl2() function, like putctl(9F), tests the type argument to make sure a data type has not been specified, and attempts to allocate a message block. The p1 and p2 parameters can be used, for example, to indicate both read and write error codes when an M_ERROR message is being sent. putnextctl2() fails, if type is M_DATA, M_PROTO, or M_PCPROTO, or if a message block cannot be allocated. If successful, putnextctl2() calls the put(9E) routine of the queue pointed to by q with the newly allocated and initialized message.

Return Values

On success, 1 is returned. 0 is returned if type is a data type, or if a message block cannot be allocated.


The putnextctl2() function can be called from user, interrupt, or kernel context.


Example 1 Using write_err() Routine

The write_err() routine is used to set a write error condition at the STREAM head. Any existing read error condition is unaffected.

  send_ctl(wrq, err)
  queue_t *wrq;
  uchar_t err;
  (void) putnextctl2(wrq, M_ERROR, NOERROR, err);

See Also

put(9E), putnextctl1(9F), allocb(9F), datamsg(9F), putctl1(9F), putnextctl(9F)