Multiplexed Special Devices

Lawrence Plona plona at remus.rutgers.edu
Sat Oct 13 03:54:34 AEST 1990


   The folowing is mpx(2) from volume one of the UNIX programmer's manual
   (version 7). Ritchie's STREAMS has replaced this and other multiplexing
   facilities with a more flexible and well thought out system.

   - Larry Plona

------------------------------------------------------------


   NAME
      mpx - create and manipulate multiplexed files

   SYNOPSIS
      mpx( name, access )
         char *name;

      join( fd, xd )

      chan( xd )

      extract( i, xd )

      attach( i, xd )

      detach( i, xd )

      connect( fd, cd, end )

      npgrp( i, xd, pgrp )

      ckill( i, xd, signal )

      #include<sys/mx.h>
      mpxcall( cmd, vec )
         int *vec;

   DESCRIPTION
      mpxcall( cmd, vec ) is the system call shared by the library
      routines described below. cmd selects a commend using values defined
      in <sys/mx.h>. vec is the address of a structure containing the
      arguments for the command.

      mpx( name, access )

      mpx creates and opens the file name with access permission access
      (see creat(2)) and returns a file descriptor available for reading
      and writing. A -1 is returned if the file cannot be created, if name
      already exists, or if the file table or other operating system data
      structures are full. The file descriptor is required for use with
      other routines.

      If name designates a null string, a file descriptor is returned as
      described but no entry is created in the file system.

      Once created, an mpx file may be opened (see open(2)) by any process.
      This provides a form of interprocess communication whereby a process
      B can 'call' process A by opening an mpx file created by A. To B, the
      file is ordinary with one exception: the connect promitive could be
      applied to it. Otherwise the functions described below are used only
      in process A and descendants that inherit the open mpx file.

      When a process opens an mpx file, the owner of the file receives a
      control message when the file is next read. The method for
      'answering' this kind of call involves using attach and detach as
      described in more detail below.

      Once B has opened A's mpx file it is said to have a channel to A. A
      channel is a pair of data streams: in this case, one from B to A and
      the other from A to B. Several processes may open the same mpx file
      yielding multiple channels within the one mpx file. By accessing the
      appropriate channel, A can communicate with B and any others. When A
      reads (see read(2)) from the mpx file data written to A by the other
      processes appears in A's buffer using a record format described in
      mpxio(5). When A writes (see write(2)) on its mpx file the data must
      be formatted in a similar way.

      The following commands are used to manipulate mpx files and channels.

	 join - adds a new channel on an mpx file to an open file F. I/O on
	 the new channel is I/O on F.

	 chan - creates a new channel.

	 extract - file descripter maintenance.

	 connect - similar to join except that the open file F is connected
	 to an existing channel.

	 attach, detach - used with call protocol.

	 npgrp - manipulates process group numbers so that a channel can
	 act as a control terminal (see tty(4)).

	 ckill - send signal (see signal(2)) to process group through
	 channel.

      A maximum of 15 channels may be connected to an mpx file. They are
      numbered 0 through 14. join may be used to make one mpx file appear
      as a channel on another mpx file. A hierarchy or tree of mpx files
      may be set up in this way. In this case one of the mpx files must be
      the root of a tree where the other mpx files are interior nodes. The
      maximum depth of such a tree is 4.

      ------
      relentless implementation details deleted.
      ------

   FILES
      /usr/include/sys/mx.h
      /usr/include/sgtty.h

   SEE ALSO
      mpxio(5)

   BUGS
      mpx files are an experimental part of the operating system more
      subject to change and prone to bugs than other parts. Maintenance
      programs, e.g. icheck(1), diagnose mpx files as an illegal mode.
      Channels may only be connected to objects in the operating system
      that are accessible through the line discipline mechanism. Higher
      performance line disciplines are needed. The maximum tree depth
      restriction is not really checked. A non destructive disconnect
      primitive (inverse of connect) is not provided. A non blocking flow
      control strategy based on messages defined in mpxio(5) should not be
      attempted by novices; the enabling ioctl commend should be protected.
      The join operation could be subsumed by connect. A mechanism is
      needed for moving a channel from one location in an mpx tree to
      another.



More information about the Comp.unix.internals mailing list