From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: Ulli Horlacher <framstag@rus.uni-stuttgart.de>
Cc: cygwin@cygwin.com
Subject: Re: non-persistant storage?
Date: Mon, 16 Dec 2019 10:22:00 -0000 [thread overview]
Message-ID: <20191216102108.GN10310@calimero.vinschen.de> (raw)
In-Reply-To: <20191212120041.GA7699@tik.uni-stuttgart.de>
[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]
Hi Ulli,
On Dec 12 13:00, Ulli Horlacher wrote:
> I need to store some data (a few kB) non-persistant.
> On a real UNIX I would use /var/run, because after a shutdown all its
> content is lost.
> But on cygwin /var/run is stored on disk.
>
> I cannot use an environment variable, because different processes need to
> read/write the data.
>
> /proc is non-persistant (in respect to a reboot), but It is not a generic
> storage place.
>
> What can I use with cygwin instead?
>
> Installing third party software is not an option, it must work with a
> standard Windows (and cygwin).
Cygwin is just a user space DLL, it's not an OS. Creating RAM disk-like
storage is the job of the OS or an OS driver. Unfortunately, there's no
onboard RAM disk driver in Windows, just zillions of third-party solutions.
I see two options:
- Use XSI shared memory, as outlined in this thread already, or
- If you have the executables under source control, you can use
an O_TMPFILE on /dev/shm, and fork the worker process from there,
i.e.
fd = open ("/dev/shm", O_TMPFILE | O_RDWR, S_IRUSR | S_IWUSR);
if (fd >= 0)
{
write (fd, your_key, strlen (your_key));
switch (fork ())
{
case 0: /* child */
/* Use fd as you see fit */
break;
case -1: /* error */
default: /* parent */
close (fd);
wait (&status);
break;
}
}
Corinna
--
Corinna Vinschen
Cygwin Maintainer
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
prev parent reply other threads:[~2019-12-16 10:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-12 12:28 Ulli Horlacher
2019-12-12 21:27 ` Eliot Moss
2019-12-12 21:40 ` Ulli Horlacher
2019-12-12 21:59 ` Eliot Moss
2019-12-13 1:33 ` L A Walsh
2019-12-13 6:28 ` Brian Inglis
2019-12-13 9:34 ` L A Walsh
2019-12-13 10:06 ` Ulli Horlacher
2019-12-16 10:22 ` Corinna Vinschen [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191216102108.GN10310@calimero.vinschen.de \
--to=corinna-cygwin@cygwin.com \
--cc=cygwin@cygwin.com \
--cc=framstag@rus.uni-stuttgart.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).