Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 May 1996 07:35:45 -0700
From:      Tom Emerson <temerson@cyberpub.com>
To:        questions@freebsd.org
Subject:   IPC in release 2.0.5
Message-ID:  <31AF03C1.36A6@cyberpub.com>

next in thread | raw e-mail | index | archive | help
I am working on a shared memory application, client and server.
The system V shared memory system calls seem to be working correctly, 
but the semaphores I use occasionally do not.

First I build an array of semaphore operations to perform, then use:
/*      operations can block; if successful return, then all were done
 *      all array operations tried in order in kernel "atomically"
 */
        if( semop( id, sops, curops ) == FAILURE ) return( FAILURE );
        return SUCCESS;
to make the kernel call.

Often this works correctly...whichever (client or server) will be put to 
sleep by the kernel until the semaphore operation is freed and available 
to the caller.  When it seems to fail, the caller is given an error 
code.

Also, I tried the ftok() call, to create a unique key.  But the function 
does not appear to be in any of the /usr/include/sys header files.

Granted, I'm a version behind the current release, should I update our 
systems?  Or, perhaps I have an error in my coding?  Please let me know 
if you are confident that these semaphore calls do work correctly.

PS:  Tried my app under Solaris 2.4, didn't see same failure to 
the caller, rather my "binary" semaphore was suddenly a "counting" 
semaphore! (again, this may be due to error in coding)

TIA
Tom Emerson



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?31AF03C1.36A6>