public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* Persistence of file implemented objects
@ 2012-06-30 22:29 Richard H Lee
  2012-07-01  0:35 ` Christopher Faylor
  0 siblings, 1 reply; 5+ messages in thread
From: Richard H Lee @ 2012-06-30 22:29 UTC (permalink / raw)
  To: cygwin

Various objects like fifo pipes, POSIX IPC shared memory and semaphores 
that are implemented through the filesystem in cygwin persist when the 
program abnornally terminates. They also persist through reboots, which 
is different to the behaviour on linux. This is also different with the 
case of sysV IPC + cygserver on cygwin which clears after reboots.

If there anyway to clear out orphaned objects or to make sure they are 
released in the event of an abnormal termination?

Does the POSIX specification even require the release of these objects 
in these situations?

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Persistence of file implemented objects
  2012-06-30 22:29 Persistence of file implemented objects Richard H Lee
@ 2012-07-01  0:35 ` Christopher Faylor
  2012-07-01 18:17   ` Richard H Lee
  0 siblings, 1 reply; 5+ messages in thread
From: Christopher Faylor @ 2012-07-01  0:35 UTC (permalink / raw)
  To: cygwin

On Sat, Jun 30, 2012 at 11:29:10PM +0100, Richard H Lee wrote:
>Various objects like fifo pipes, POSIX IPC shared memory and semaphores 
>that are implemented through the filesystem in cygwin persist when the 
>program abnornally terminates. They also persist through reboots, which 
>is different to the behaviour on linux. This is also different with the 
>case of sysV IPC + cygserver on cygwin which clears after reboots.

Please be more precise about what you are talking about.

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.

cgf

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Persistence of file implemented objects
  2012-07-01  0:35 ` Christopher Faylor
@ 2012-07-01 18:17   ` Richard H Lee
  2012-07-01 23:35     ` Christopher Faylor
  2012-07-02  8:03     ` Corinna Vinschen
  0 siblings, 2 replies; 5+ messages in thread
From: Richard H Lee @ 2012-07-01 18:17 UTC (permalink / raw)
  To: cygwin

> 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.

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.

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Persistence of file implemented objects
  2012-07-01 18:17   ` Richard H Lee
@ 2012-07-01 23:35     ` Christopher Faylor
  2012-07-02  8:03     ` Corinna Vinschen
  1 sibling, 0 replies; 5+ messages in thread
From: Christopher Faylor @ 2012-07-01 23:35 UTC (permalink / raw)
  To: cygwin

On Sun, Jul 01, 2012 at 07:17:15PM +0100, 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.

...which also persist on linux.

>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.

what specific interface are you talking about which creates physical
files in /dev?

--
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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Persistence of file implemented objects
  2012-07-01 18:17   ` Richard H Lee
  2012-07-01 23:35     ` Christopher Faylor
@ 2012-07-02  8:03     ` Corinna Vinschen
  1 sibling, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2012-07-02  8:03 UTC (permalink / raw)
  To: cygwin

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-07-02  8:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-30 22:29 Persistence of file implemented objects Richard H Lee
2012-07-01  0:35 ` Christopher Faylor
2012-07-01 18:17   ` Richard H Lee
2012-07-01 23:35     ` Christopher Faylor
2012-07-02  8:03     ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).