PT(4)                                                       PT(4)

     NAME
          pt - interprocess I/O junctor files

     DESCRIPTION
          These special files, conventionally collected in directory
          /dev/pt, provide a facility for interprocess communication.
          The name `pt' comes from `pseudo-tty,' after vaguely similar
          mechanisms in other systems.

          Pt files come in even-odd pairs.  If one process opens an
          odd numbered pt file, and another opens the corresponding
          even file, then data written on one file is available for
          reading on its partner, in symmetrical full-duplex fashion.
          `Record' boundaries are preserved, where a record is the
          information presented in one write call.  Thus a reader
          attempting to read into a large buffer will receive chunks
          of data corresponding to the amounts generated by each call
          to write.

          The odd-numbered member of a pair is the master.  Masters
          and slaves differ only in the rules for opening; IO is sym-
          metrical.  Master pt files may be opened by at most one pro-
          cess.  Thus the following strategy is appropriate for estab-
          lishing communications: one process searches the /dev/pt
          directory for an odd-numbered file it can open; when it
          finds one, it publishes the name in some way.  Typically, it
          will either fork off a child process that knows the name by
          sharing variables, or place the name in some conventional
          place.  Then one or more slave processes may open the corre-
          sponding even-numbered file and communicate with the master.

          Once both even- and odd-numbered members of a pair have been
          opened, the communications channel is shut down when the
          file on either side is closed for the last time.  Thus a
          master process that expects several unrelated processes to
          open the even pt corresponding to its odd pt should keep the
          even pt open.

          Pt files are stream devices and line discipline modules (see
          stream(4)) may be attached to them.

     SEE ALSO
          stream(4), ptopen(3)

     BUGS
          Writes are not atomic, in general.  However, several slow
          writers may write small messages to a fast reader and
          achieve the illusion of atomicity.