|
|
1.1 ! root 1: .TH MESGLD 4 ! 2: .CT 2 comm_mach ! 3: .SH NAME ! 4: mesg_ld, rmesg_ld \- message line discipline modules ! 5: .SH SYNOPSIS ! 6: .B #include <sys/types.h> ! 7: .br ! 8: .B #include <sys/stream.h> ! 9: .SH DESCRIPTION ! 10: .I Mesg_ld ! 11: and ! 12: .I rmesg_ld ! 13: turn internal stream messages ! 14: into ordinary data and vice versa. ! 15: They supply a way to splice a stream connection together ! 16: through a process or across a network connection. ! 17: The messages represent ordinary data ! 18: and various control operations. ! 19: .PP ! 20: After ! 21: .IR mesg_ld ! 22: has been pushed on a stream, ! 23: .IR read (2) ! 24: on the stream returns encoded messages; ! 25: .I write ! 26: is expected to supply messages in the same coding. ! 27: An encoded message consists of a header ! 28: followed by zero or more bytes of associated data. ! 29: The header, ! 30: as defined in ! 31: .BR <sys/stream.h> , ! 32: is of the form ! 33: .IP ! 34: .EX ! 35: struct mesg { ! 36: char type; ! 37: unsigned char magic; ! 38: unsigned char losize, hisize; ! 39: }; ! 40: #define MSGMAGIC 0345 ! 41: #define MSGHLEN 4 /* true length of struct mesg in bytes */ ! 42: .EE ! 43: .LP ! 44: The header is ! 45: .B MSGHLEN ! 46: bytes long; ! 47: beware that this is not always the same as ! 48: .LR "sizeof(struct mesg)" . ! 49: The ! 50: .B magic ! 51: field contains the constant ! 52: .BR MSGMAGIC , ! 53: to help prevent interpreting bad data as a message header. ! 54: There are ! 55: .B "losize+(hisize<<8)" ! 56: bytes of associated data. ! 57: .PP ! 58: Messages may be written in pieces, ! 59: or several messages may be written at once. ! 60: At most one message will be read at a time. ! 61: If an impossible message is written, ! 62: the stream may be shut down. ! 63: .PP ! 64: .IR Rmesg_ld ! 65: is exactly the opposite of ! 66: .IR mesg_ld . ! 67: It is intended for use with devices ! 68: that generate data containing encoded messages. ! 69: Here is a list of message types, ! 70: defined in ! 71: .BR <sys/stream.h> : ! 72: .TF M_HANGUP ! 73: .TP ! 74: .B M_DATA ! 75: (0) ! 76: Ordinary data. ! 77: .TP ! 78: .B M_BREAK ! 79: (01) ! 80: A line break on an RS232-style asynchronous connection. ! 81: No associated data. ! 82: .TP ! 83: .B M_HANGUP ! 84: (02) ! 85: When received, indicates that the other side has gone away. ! 86: Thereafter the stream is useless. ! 87: No associated data. ! 88: .TP ! 89: .B M_DELIM ! 90: (03) ! 91: A delimiter that introduces a record boundary in the data. ! 92: No associated data. ! 93: .TP ! 94: .B M_IOCTL ! 95: (06) ! 96: An ! 97: .IR ioctl (2) ! 98: request. ! 99: The associated data is a four-byte integer ! 100: containing the ! 101: function code, ! 102: least significant byte first, ! 103: followed by some amount of associated data. ! 104: An ! 105: .B M_IOCACK ! 106: or ! 107: .BR M_IOCNAK ! 108: reply is expected. ! 109: .TP ! 110: .B M_DELAY ! 111: (07) ! 112: A real-time delay. ! 113: One byte of data, giving the number of clock ticks of ! 114: delay time. ! 115: .TP ! 116: .B M_CTL ! 117: (010) ! 118: Device-specific control message. ! 119: .TP ! 120: .B M_SIGNAL ! 121: (0101) ! 122: Generate signal number given in the one-byte message. ! 123: .TP ! 124: .B M_FLUSH ! 125: (0102) ! 126: Flush input and output queue if possible. ! 127: .TP ! 128: .B M_STOP ! 129: (0103) ! 130: Stop transmission immediately. ! 131: .TP ! 132: .B M_START ! 133: (0104) ! 134: Restart transmission after ! 135: .BR M_STOP . ! 136: .TP ! 137: .B M_IOCACK ! 138: (0105) ! 139: Successful reply to ! 140: .BR M_IOCTL . ! 141: Associated data is to be written back to the caller. ! 142: .TP ! 143: .B M_IOCNAK ! 144: (0106) ! 145: Failed reply to ! 146: .BR M_IOCTL . ! 147: A single-byte message, ! 148: if present, ! 149: will be returned in ! 150: .CW errno ! 151: by the failing ! 152: .IR ioctl . ! 153: .TP ! 154: .B M_PRICTL ! 155: (0107) ! 156: High-priority ! 157: device-specific control message. ! 158: .PD ! 159: .PP ! 160: .SH SEE ALSO ! 161: .IR stream (4) ! 162: .SH BUGS ! 163: The format of arguments to ! 164: .B M_IOCTL ! 165: is machine dependent. ! 166: .br ! 167: The amount of associated data ! 168: is limited, but large (>4K).
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.