From owner-freebsd-questions Thu Jun 13 07:10:04 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id HAA25552 for questions-outgoing; Thu, 13 Jun 1996 07:10:04 -0700 (PDT) Received: from relay-2.mail.demon.net (disperse.demon.co.uk [158.152.1.77]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id HAA25342 for ; Thu, 13 Jun 1996 07:06:59 -0700 (PDT) Received: from post.demon.co.uk ([158.152.1.72]) by relay-2.mail.demon.net id ai20929; 13 Jun 96 14:29 +0100 Received: from jraynard.demon.co.uk ([158.152.42.77]) by relay-3.mail.demon.net id aa08371; 13 Jun 96 11:40 +0100 Received: (from fqueries@localhost) by jraynard.demon.co.uk (8.7.5/8.6.12) id AAA15921; Thu, 13 Jun 1996 00:57:46 GMT Date: Thu, 13 Jun 1996 00:57:46 GMT Message-Id: <199606130057.AAA15921@jraynard.demon.co.uk> From: James Raynard To: eeg@telecom.at CC: FreeBSD-questions@freebsd.org In-reply-to: <199606122142.VAA02488@fh> (message from Franz Hollerer on Wed, 12 Jun 1996 21:42:14 GMT) Sender: owner-questions@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > 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 at the top of the file). -- James Raynard, Edinburgh, Scotland james@jraynard.demon.co.uk jraynard@FreeBSD.ORG