Compare this file to the similar file:
Show the results in this format:

MPXIO(5)            UNIX Programmer's Manual             MPXIO(5)

     mpxio - multiplexed i/o

     #include <sys/mx.h>

     #include <sgtty.h>

     Data transfers on mpx files (see _m_p_x(2)) are multiplexed by
     imposing a record structure  on the io stream.  Each record
     represents  data from/to a particular channel or a control
     or status message associated with a particular channel.

     The prototypical data record read from an mpx file is as

          struct input_record {
               short     index;
               short     count;
               short     ccount;
               char data[];

     where _i_n_d_e_x identifies the channel, and _c_o_u_n_t specifies the
     number of characters in _d_a_t_a. If _c_o_u_n_t is zero, _c_c_o_u_n_t gives
     the size of _d_a_t_a, and the record is  a control or status
     message.  Although _c_o_u_n_t or _c_c_o_u_n_t might be odd, the operat-
     ing system aligns records on short (i.e. 16-bit) boundaries
     by skipping bytes when necessary.

     Data written to an mpx file must be formatted as an array of
     record structures defined as follows

          struct output_record {
               short     index;
               short     count;
               short     ccount;
               char *data;

     where the data portion of the record is referred to
     indirectly and the other cells have the same interpretation
     as in _i_n_p_u_t__r_e_c_o_r_d.

     The control messages listed below may be read from a multi-
     plexed file descriptor.  They are presented as two 16-bit
     integers: the first number is the message code (defined in
     <_s_y_s/_m_x._h>), the second is an optional parameter meaningful
     only with M_WATCH and M_BLK.

Printed 9/10/82                                                 1

MPXIO(5)            UNIX Programmer's Manual             MPXIO(5)

          M_WATCH - a process `wants to attach' on this channel.
               The second parameter is the 16-bit user-id of the
               process that executed the open.
          M_CLOSE - the channel is closed.  This message is gen-
               erated when the last file descriptor referencing a
               channel is closed.  The _d_e_t_a_c_h command (see _m_p_x(2)
               should be used in response to this message.
          M_EOT - indicates logical end of file on a channel.  If
               the channel is joined to a typewriter, EOT
               (control-d) will cause the M_EOT message under the
               conditions specified in _t_t_y(4) for  end of file.
               If the channel is attached to a process, M_EOT
               will be generated whenever the process writes zero
               bytes on the channel.
          M_BLK - if non-blocking mode has been enabled on an mpx
               file descriptor _x_d by executing _i_o_c_t_l(_x_d, _M_X_N_B_L_K,
               _0), write operations on the  file are truncated in
               the kernel when internal queues become full.  This
               is done on a per-channel basis: the parameter is a
               count of the number of characters not transferred
               to the channel on which M_BLK is received.
          M_UBLK - is generated for a channel after M_BLK when
               the internal queues have drained below a thres-

     Two other messages may be generated by the kernel.  As with
     other messages, the first 16-bit quantity is the message

          M_OPEN - is generated in conjunction with `listener'
               mode (see _m_p_x(2)).  The uid of the calling process
               follows the message code as with M_WATCH.  This is
               followed by a null-terminated string which is the
               name of the file being opened.
          M_IOCTL - is generated for a channel connected to a
               process when that process executes the _i_o_c_t_l(_f_d,
               _c_m_d, &_v_e_c) call on the channel file descriptor.
               The M_IOCTL code is followed by the _c_m_d argument
               given to _i_o_c_t_l followed by the contents of the
               structure _v_e_c. It is assumed, not needing a better
               compromise at this time, that the length of _v_e_c is
               determined by _s_i_z_e_o_f (_s_t_r_u_c_t _s_g_t_t_y_b) as declared
               in <_s_g_t_t_y._h>.

     Two control messages are understood by the operating system.
     M_EOT may be sent through an mpx file to a channel.  It is
     equivalent to propagating a zero-length record through the
     channel; i.e. the channel is allowed to drain and the pro-
     cess or device at the other end receives a zero-length
     transfer before data starts flowing through the channel
     again.  M_IOCTL can also be sent through a channel.  The
     format is identical to that described above.

Printed 9/10/82                                                 2