Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Jun 1996 00:57:46 GMT
From:      James Raynard <fqueries@jraynard.demon.co.uk>
To:        eeg@telecom.at
Cc:        FreeBSD-questions@freebsd.org
Message-ID:  <199606130057.AAA15921@jraynard.demon.co.uk>
In-Reply-To: <199606122142.VAA02488@fh> (message from Franz Hollerer on Wed, 12 Jun 1996 21:42:14 GMT)

next in thread | previous in thread | raw e-mail | index | archive | help
> I use semaphore to control read and write access to a
> shared memory.
> For the different semop() I set the SEM_UNDO flag.
> So the kernel should undo the semaphore operations if the
> process exits or is killed.
> With Linux and SCO this works. But under FreeBSD 2.1
> all other processes (which wait for the semaphore) hang.
> 
> *) Please, can someone tell me, if this is a bug in
>    my program or a bug in the FreeBSD kernel?

Yep, this is a bug in -release which has since been fixed. Apply the
following patch in /usr/src/sys/kern/kern_exit.c:-

*** kern_exit.c Tue May 30 17:05:25 1995
--- kern_exit.c.new     Wed Dec  6 15:12:28 1995

***************
*** 130,135 ****
--- 130,139 ----
         */
        fdfree(p);
  
+ #ifdef SYSVSEM
+       semexit(p);
+ #endif
+ 
        /* The next two chunks should probably be moved to vmspace_exit. */
        vm = p->p_vmspace;
  #ifdef SYSVSHM

(and also add #include <sys/sem.h> at the top of the file).

-- 
James Raynard, Edinburgh, Scotland
james@jraynard.demon.co.uk
jraynard@FreeBSD.ORG




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606130057.AAA15921>