[lkml]   [2009]   [Sep]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: (un)mount ramfs from C code
On 22.09.2009 09:04, Brian McGrew wrote:
> Good morning all!
> So I'm using a ramfs for temporary files, thank you whoever designed that,
> it works great!
> I can mkdir, mount, chmoud, readand write and then umount the thing from the
> command line just fine.
> What I need now is some method from within my C/C++ code to determine if the
> ramfs is mounted, if not, then mount it so I can use it and unmount it when
> I'm done, without making a system call.
> Can this be done? Is there any access to mount/unmount from C/C++?

The "/bin/mountpoint"-util appears to stat the mountpoint and it's
parent directory and compares if they have the same device-no (st_dev).
If they are different, then something is mounted.

Bis denn

Real Programmers consider "what you see is what you get" to be just as
bad a concept in Text Editors as it is in women. No, the Real Programmer
wants a "you asked for it, you got it" text editor -- complicated,
cryptic, powerful, unforgiving, dangerous.

 \ /
  Last update: 2009-09-22 19:31    [W:0.055 / U:0.400 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site