delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2012/07/02/04:03:57

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 2 Jul 2012 10:03:03 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: Persistence of file implemented objects
Message-ID: <20120702080303.GA17618@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4FEF7DB6 DOT 6040101 AT gmail DOT com> <20120701003530 DOT GA5390 AT ednor DOT casa DOT cgf DOT cx> <4FF0942B DOT 1030201 AT gmail DOT com>
MIME-Version: 1.0
In-Reply-To: <4FF0942B.1030201@gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
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

On Jul  1 19:17, Richard H Lee wrote:
> >Fifos persist on reboot on Linux or Cygwin.  They live on the
> >filesystem.  I don't see how POSIX IPC shared memory and semaphores
> >could persist.
> 
> Sorry, I meant unix/bsd sockets.

AF_UNIX/AF_LOCAL sockets are implemented on filesystem level as well,
not only on Cygwin.  If they are not explicitely unlinked, they will be
in the way when trying to create a new socket of the same name.

> Regarding the POSIX IPC's, they are stored in /dev . In regular
> *nix, /dev do not represent "physical" files on the filesystem,
> hence they do not persist over boot.
> 
> In cygwin, they actually do represent physical files. So if they are
> not freed correctly by the program, the persist over to the next
> boot.

Right.  The named POSIX IPC objects are created as normal files under
/dev/shm and /dev/mqueue.  These objects are supposed to follow POSIX
file name naming rules, and they are supposed to be persistent until you
call mq_unlink, sem_unlink, or shm_unlink respectively.  They are also
meant to persist if a process crashes(*).

So in contrast to XSI IPC implemented by running cygserver they also
persist when all Cygwin processes have stopped and even over reboot,
because they don't live on a virtual filesystem like on Linux, but on
the real filesystem.

From the POSIX point of view that's ok.  If you have a problems with
that, you might consider to create some autostart script which deletes
all files below /dev/shm and /dev/mqueue.


Corinna


(*) See http://pubs.opengroup.org/onlinepubs/007908799/xsh/mq_open.html
        http://pubs.opengroup.org/onlinepubs/007908799/xsh/sem_open.html
	http://pubs.opengroup.org/onlinepubs/007908799/xsh/shm_open.html

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

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

- Raw text -


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