Persistence of file implemented objects

Corinna Vinschen corinna-cygwin@cygwin.com
Mon Jul 2 08:03:00 GMT 2012


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



More information about the Cygwin mailing list