Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ putctl(D3DK) — Motorola System V 88k Release 4 Version 4.3

Media Vault

Software Library

Restoration Projects

Artifacts Sought

putctl(D3DK)  —  

.IX \f4putctl\fP(D3DK)

NAME

putctl − send a control message to a queue

SYNOPSIS

#include <sys/stream.h>
int putctl(queue_t ∗q, int type);

ARGUMENTS

qPointer to the queue to which the message is to be sent. 

typeMessage type (must be control). 

DESCRIPTION

putctl tests the type argument to make sure a data type has not been specified, and then attempts to allocate a message block.  putctl fails if type is M_DATA, M_PROTO, or M_PCPROTO, or if a message block cannot be allocated.  If successful, putctl calls the put(D2DK) routine of the queue pointed to by q, passing it the allocated message. 

RETURN VALUE

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

LEVEL

Base or Interrupt. 

NOTES

Does not sleep. 

Driver-defined basic locks, read/write locks, and sleep locks may not be held across calls to this function. 

The q argument to putctl and putnextctl(D3DK) may not reference q_next (e.g. an argument of q->q_next is erroneous on a multiprocessor and is disallowed by the DDI/DKI).  putnextctl(q, type) is provided as a multiprocessor-safe equivalent to the common call putctl(q->q_next, type), which is no longer allowed. 

SEE ALSO

put(D2DK), put(D3DK), putctl1(D3DK), putnextctl(D3DK), putnextctl1(D3DK)

EXAMPLE

The pass_ctl routine is used to pass control messages to one’s own queue.  M_BREAK messages are handled with putctl (line 9).  putctl1 (line 11) is used for M_DELAY messages, so that param can be used to specify the length of the delay.  If an invalid message type is detected, pass_ctl returns 0, indicating failure (line 13). 

 1  int
 2  pass_ctl(wrq, type, param)
 3queue_t ∗wrq;
 4uchar_t type;
 5uchar_t param;
 6  {
  7switch (type) {
 8case M_BREAK:
 9return(putctl(wrq, M_BREAK));
 10case M_DELAY:
11return(putctl1(wrq, M_DELAY, param));
 12default:
13return(0);
14}
15  }

.IX \f4putctl\fP(D3DK), example
.IX \f4putctl1\fP(D3DK), example

DDI/DKI  —  STREAMS

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026