Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Feb 1998 12:53:43 -0500
From:      Dennis Rockwell <dennis@bbn.com>
To:        "hackers@FreeBSD.ORG" <hackers@FreeBSD.ORG>
Subject:   Re: Shared memory and signals 
Message-ID:  <199802041752.MAA23195@po1.bbn.com>
In-Reply-To: Message from Michael Schuster <Michael.Schuster@utimaco.co.at>  <34D8136F.CF845A68@utimaco.co.at> .

next in thread | previous in thread | raw e-mail | index | archive | help
On 4 Feb, Michael Schuster wrote:

> You probably wouldn't want to do that, since shmctl(IPC_RMID,..) really
> removes the shm segment, and other processes trying to use it wouldn't
> be very happy about that ...
> You could find out about the number of attached processes/threads using
> something like:
> 
> 	int fd;
> 	struct shmid_ds sInfo;
> 
> 	shmctl (fd, IPC_STAT, &sInfo);
> 
> 	if (sInfo.shm_nattch > 1)
> 		shmctl (fd, IPC_RMID, NULL);

Isn't this backwards?  (nattach <= 1)  Also, this looks like
a race condition just waiting to be lost.

Dennis Rockwell                 dennis@bbn.com
GTE Internetworking
BBN Technologies                +1-617-873-5745
Cambridge, MA                   +1-617-873-6091 (Fax)



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