Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] Trunk Commit Heads-up: New Common Shared Memory Component
From: Paul H. Hargrove (PHHargrove_at_[hidden])
Date: 2010-08-13 11:32:07


Rainer Keller wrote:
> Hi,
> On Thursday 12 August 2010 19:09:42 Jeff Squyres wrote:
>
>> On Aug 12, 2010, at 7:21 AM, Terry Dontje wrote:
>>
>>> Is there not a way to determine whether the fs is tmpfs or not?
>>>
>> I don't know -- Rainer?
>>
> Well, this is semi-portable ,-]
> But sure, it would work on Linux, where we'd want it:
>
> ./statfs /dev/shm
> --------------- statfs() output-----------------
> statfs() returned the following information
> about file system of path (/dev/shm):
> f_type : TMPFS (1021994)
> f_bsize : 4096
> f_blocks : 723663
> f_bfree : 723662
> f_bavail : 723662
> f_files : 723663
> f_ffree : 723661
> f_fsid : TMPFS (0x0)
> f_namelen : 255
>
> (the program detects most Filesystems according to their known magic).
>
> Regards,
> Rainer
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> devel mailing list
> devel_at_[hidden]
> http://www.open-mpi.org/mailman/listinfo.cgi/devel

I we only care about Linux then here is a simpler mechanism:
$ grep tmpfs /proc/mounts
none /dev/shm tmpfs rw 0 0

Conversion from grep to fopen/fread/fclose left as an exercise for the
reader :-)

-Paul

-- 
Paul H. Hargrove                          PHHargrove_at_[hidden]
Future Technologies Group
HPC Research Department                   Tel: +1-510-495-2352
Lawrence Berkeley National Laboratory     Fax: +1-510-486-6900