STREAMS Programming Guide

Data Structure

SunOS 5 reserves the right to change ptem(7M) internal implementation. This structure should be relevant only to people wanting to change the module.

Each instantiation of ptem(7M) is associated with a local area. These data are held in a structure called ptem that has the following format:

struct ptem
	long cflags;							/* copy of c_flags */
	mblk_t *dack_ptr;							/* pointer to preallocated msg blk
									used to send disconnect */
	queue_t *q_ptr;							/* pointer to ptem's read queue */
	struct winsize wsz;				/*struct to hold windowing info*/
	unsigned short state; /* state of ptem entry */

When ptem(7M) is pushed onto the slave side Stream, a search of the ptem structure is made for a free entry (state is not set to INUSE). The c_cflags of the termio(7I) structure and the windowing variables are stored in cflags and wsz respectively. The dack_ptr is a pointer to a message block used to send a zero-length message whenever a hang-up occurs on the slave side.