Here's an implementation of the SYSV semaphores and message passing facilities.

I wrote the semaphore facility earlier this year because I needed them.  In
early October, I was contracted by RTMX Uniflex to develop the message passing
facility (i.e.  they paid me to do it).  They've given me permission to
distribute the message passing facility.

To the best of my knowledge, these are complete implementations of both
facilities.  There is one minor deviation from the SVID (System V Interface
Definition, Third Edition, Volume 1):

    The SVID specifies that errno be set to EIDRM or ENOMSG in a few cases.
    BSD doesn't define EIDRM or ENOMSG.  This implemntation returns EINVAL
    instead of EIDRM and EAGAIN instead of ENOMSG.

Also, I've added a "semconfig" system call which is used by the ipcs utility
(see below) to freeze the semaphore facility while it pokes around inside).

If anyone finds any other deviations (or just plain bugs), please let me know.

This shar file also includes an implementation of the ipcrm and ipcs programs
found in SYSV.  The ipcrm program is quite similar to the SYSV ipcrm program
(I'm not aware of any differences).  The ipcs program is radically different.
It takes no parameters and prints information on the message passing and
semaphore structures in a rather verbose format.

I don't like the current approach used by ipcs.  It uses the old approach
of getting symbolic information from /bsd and using it to fish around inside
/dev/kmem.  I'll probably replace this with a cleaner approach someday.

A few notes are probably in order:

    - File names ending in "-diffs" are "diff -c" style diffs to be
      applied to the appropriate files.  I havn't assembled these into
      a big patch file (left as an exercise to the reader!).  You may
      have to do some minor fiddling.

    - All the files in the Kernel directory should be placed into the
      appropriate places under "/usr/src/sys".  All the files in the Lib
      directory belong under "/usr/src/lib/libc".  Also, the include files
      in the Kernel directory need to be placed into "/usr/include/sys" (I
      use symbolic links in "/usr/include/sys" that point to the real files
      in "/usr/src/sys/" to make sure that the two are always in sync).
      I've 'replaced' slashes in the file names with colons.  For example,
      "Kernel/sys:sem.h" should be copied in "/usr/src/sys/sys/sem.h".

    - Once you've installed all the files and patches, you'll want to build
      yourself a new kernel.  Make a copy of the kernel config file that
      you're currently using and add the following two lines (don't indent
      the lines in your config file):

	    options SYSVSEM
	    options SYSVIPC

      Then build and install the kernel in the usual way.

    - The next step is to build a new copy of "libc.a" so that you can
      write programs that access the new system calls.  Copy the files from
      my Lib directory into the appropriate places in your /usr/src/lib/libc
      directory tree and type "make" in "/usr/src/lib/libc".  This step takes
      a while (I've never measured it.  It seems like about 10 minutes although
      it is probably less).  When it is done, make a backup copy of your
      "/usr/lib/libc.a" and replace the original with the new one.

      Note:  if you make sure that there is a directory called "obj"
      in your "/usr/src/lib/libc" directory then all the .o, .po and .a files
      will go there.  This is generally a good idea because there are a lot
      of them (you probably don't want them cluttering up your /usr/src/lib/libc
      directory).

    - When you've built and installed a new libc.a, it's time to compile
      the ipcs and ipcrm programs in my Utils directory.  Once they are
      compiled, they should probably be installed in "/usr/local/bin".
      The ipcrm program requires no special privileges.  The ipcs program
      must be setgid to group kmem.

    - The Tests directory contains a bunch of test programs.  Read the comments
      at the top of each program for more info.  These programs need work...

If you need to contact me, I can be reached at:

    danny@BouletFermat.ab.ca

or

    403 449-1835 Canadian Mountain time zone (GMT-0700)
    		 Call in the evening my time.

-Danny
