delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/08/11/04:50:54

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Wed, 11 Aug 2004 10:50:49 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: cygserver cleanup thread
Message-ID: <20040811085049.GA1819@cygbert.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <1092212025 DOT 4338 DOT 11 DOT camel AT bma DOT sysgo DOT com>
Mime-Version: 1.0
In-Reply-To: <1092212025.4338.11.camel@bma.sysgo.com>
User-Agent: Mutt/1.4.2i

On Aug 11 10:13, bertrand marquis wrote:
> Hello,
> 
> i'm making a program using shared memory and as a consequence i need to
> use the cygserver. But when i close my program the ipcs give me this
> output:
> 
> $ ipcs -ma
> Shared Memory:
> T     ID               KEY        MODE       OWNER    GROUP  CREATOR  
> CGROUP NATTCH  SEGSZ  CPID  LPID    ATIME    DTIME    CTIME
> m 262144                    0 --rw-------      bma     Kein      bma    
> [...]
> 
> In fact all the shared memory i used is still there and is used by
> nobody (NNATCH 0). I thought that the cleanup thread of the cygserver
> was supposed to clean those but i have to remove them myself. Is this a
> normal behavior ? Is there something to configure in cygserver to clean
> those ?

This is normal behaviour.  SYSV IPC is designed to keep the IPC elements
intact even if no process is accessing them.  If you want to get rid of
them, then you have to do this by using the appropriate IPC_RMID control
call:

	msgctl (msgid, IPC_RMID, NULL);
	semctl (semid, 0, IPC_RMID);
	shmctl (shmid, IPC_RMID, NULL);

If you're creating an application which needs shared memory only on
runtime, which should disappear when the last application using it
exits, consider to use simple mmap calls.  It's way easier than having
to run cygserver.


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Co-Project Leader          mailto:cygwin AT cygwin DOT com
Red Hat, Inc.

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019