MUX(3)                                                     MUX(3)

     NAME
          mux - server registry and service multiplexor

     SYNOPSIS
          bind #s /srv

          #s/service1
          #s/service2
           ...

     DESCRIPTION
          Mux is a replacement for srv(3) that allows a single file
          server to provide service to processes on both local and
          remote machines.  Mux performs all the functions of srv.

          Plain files created in the top level directory of mux behave
          exactly as described in srv(4).

          Creating a directory in mux produces a stream multiplexer.
          Many clients may write messages to a single server.  Mux
          prefixes each message with a connection number to allow the
          server to distinguish between clients.  Messages written
          back to mux by the server are prefixed by a destination con-
          nection number.  Mux removes the destination connection num-
          ber before passing messages back to its clients.

          When created, a mux directory contains two files, head and
          clone.  Opening the clone file allocates a new connection on
          the multiplexer.  The file descriptor returned is suitable
          for mounting (see mount in bind(1) or bind(2)). A file named
          by the new connection number is produced by opening the
          clone file.  The numbered connection file may be used to
          read and write messages to the server.  The head file should
          be used by the server to send and receive message from the
          clients.

          A file server must be linked with /$objtype/lib/libmux.a to
          use the device.  The library uses the connection numbers
          provided by the driver to map the fid space of the various
          client mount drivers into a single fid space for the server.
          Libmux replaces convS2M and convM2S (see fcall(2)) from the
          C library.  A server linked with libmux will work correctly
          with a normal srv entry.

          Mux's only use is to allow CPU servers to act as a gateway
          to a file system.  It is not normally configured in a sys-
          tem.

     BUGS
          This should be unnecessary but is required to overcome a

     Page 1                       Plan 9             (printed 4/19/24)

     MUX(3)                                                     MUX(3)

          failure of vision.

     SEE ALSO
          bind(2), srv(4)

     Page 2                       Plan 9             (printed 4/19/24)