From owner-freebsd-questions Wed Jun 12 12:47:29 1996 Return-Path: owner-questions Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id MAA25949 for questions-outgoing; Wed, 12 Jun 1996 12:47:29 -0700 (PDT) Received: from fh (async1.pinrt3.telecom.at [194.118.0.98]) by freefall.freebsd.org (8.7.5/8.7.3) with SMTP id MAA25929 for ; Wed, 12 Jun 1996 12:47:20 -0700 (PDT) Received: (from fh@localhost) by fh (8.6.12/8.6.12) id VAA02488; Wed, 12 Jun 1996 21:42:14 GMT Date: Wed, 12 Jun 1996 21:42:14 GMT Message-Id: <199606122142.VAA02488@fh> To: FreeBSD-questions@FreeBSD.ORG From: "Franz Hollerer" Subj: semaphore: SEM_UNDO Sender: owner-questions@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk Hi, 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? /* ============================================================ */ /* code fragment for locking share memory with a semaphore */ /* ============================================================ */ extern gshm_t *shm; #define SHM_UNLOCKED 0 #define SHM_RDLOCKED 1 #define SHM_WRLOCKED 2 static int shm_id, sem_id; static int lock=SHM_UNLOCKED; /* ============================================================ */