[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: ifupdown writes to /etc... a bug?



Hi,

On Wed, Mar 12, 2003 at 01:30:27PM +0000, Miquel van Smoorenburg wrote:

> In article <20030312125004.GA30066@evbergen.xs4all.nl>,
> Emile van Bergen  <emile-deb@evbergen.xs4all.nl> wrote:
> >I still think it's nice to offer applications (such as scripts that need
> >a /run) to offer a generic filesystem interface to virtual memory.
> >Scripts can't make syscalls to get at sysV memory segments, but they can
> >access files in /ram or /mem.
> 
> That has been standarized as /dev/shm

True, but only very recently and only on Linux.

> - need shared memory? use /dev/shm

I suspect that if you want a filesystem interface for a bit of memory,
you don't require it to have /dev/shm's exact semantics in the majority
of cases, but can make do with any mmap'able file, be it on tmpfs,
ext2-on-ramdisk or whatever; you just want to avoid I/O if at all
possible.

A /ram or /mem that would point to /dev/shm when available or to a
tmpfs, ramfs, ext2-on-ramdisk, or whatever your kernel offers otherwise,
would allow applications to use a filesystem interface to memory
regardless of kernel version or type.

> - need to put info somewhere that doesn't have to be kept between
>   boots? /var/run
> - same but need it before /var is mounted? /run
> - same but need it even when / is read-only ? /run, setup by the
>   sysadmin to be on a tmpfs

So what do I do when I'm writing an application or script that likes to
use a ram-based fs if any is available? Test for /dev/shm first, then
see if we're lucky enough to be on a system that has /run on tmpfs,
otherwise bug the admin to create a separate tmpfs? It's messy, and
requires each application to do these tests in order to take advantage
of an already mounted tmpfs.

I think /ram or /mem (perhaps still better because /ram seems to imply
it'd never swapped out) would also simplify the choices you outlined as
follows:

- need exact /dev/shm semantics? use /dev/shm

- need any type of storage really, but preferrably ram-based? use /mem
  (alternatively: need any storage, as long as it's ram-based? use /ram)

- need to put a small amount info somwhere that doesn't have to be kept
  between boots? use /mem (or /ram). The the type of / or /var is irrelevant.

- need to store a potentially larger amount of info, and don't mind to wait 
  until /var is mounted? use /var/run.

Again, your proposal is fine, but I still think offering a generic ram-based
fs is more elegant.

Cheers,


Emile.

-- 
E-Advies - Emile van Bergen           emile@e-advies.nl      
tel. +31 (0)70 3906153           http://www.e-advies.nl    

Attachment: pgpg2BMY6DOqk.pgp
Description: PGP signature


Reply to: