Pipes, Ports and Philosophye

DBrown.TSDC%hi-multics at sri-unix.UUCP DBrown.TSDC%hi-multics at sri-unix.UUCP
Wed Oct 5 12:13:00 AEST 1983


)
    helo /ipc/user9
                               (on /ipc/user9)
                                 250 /ipc/mail3
  (on /ipc/mail3)
    mail To:<george>             250 ok
    rcpt From:<harry>            250 ok
    data                         250 ok
    Hello, george,...
    <lotsa words>
    .
                                 250 ok
    quit                         ipc mail clear

  The file names are obtained by the usual trick of trying to creat(1)
/tmp/user<n> until you get one that succeeds.  You use a common
negotiation channel to assign the "receiver" channel, and you use
read(1) and write(1) exclusively in the negotiation, so as to ensure
that (a) you never write half your message to the special file and then
have someone else splat the first part of his down immediatly after
yours, and (b) that you never get into a "I'm blocked receiving,
somebody *please* say something so I can start up again" situation.
  The drivers used have to have a chunk of memory to use, plus the same
interlocks as in pread(unix/pipe.c) and pwrite(ditto), so you don't get
EOFs or run out of buffer, etc...

  Yes, it is surprisingly easy, because the mechanism is well-known and
can be built up of existing code and facilities.  No, it isn't *easy*
easy, you have to debug it somehow.  But it doesn't depend on anything
you can't do yourself with the minimum tool set provided.
  --dave (and I ain't even a wizard) brown



More information about the Comp.unix.wizards mailing list