January 26th, 2004, 05:22 AM
Check, if mounted devices
how can I check a directory, if it's on a mounted device or local?
Is there any c standard function?
It should be portable to differnt unix archs.
(Solaris, Solaris64, Solaris86, Tru64, HP1x, AIX, Linux, ......)
January 26th, 2004, 09:31 AM
The statvfs system call gives you information about the filesystem a file resides on. It's POSIX, so it should be portable, but I don't take guarantee for it.
January 26th, 2004, 09:35 AM
I will try it with this one!
January 26th, 2004, 09:47 AM
Just noticed that my answer was somewhat incomplete.
On Solaris, you can tell the filesystem by the f_basetype string and then have to use a table to decide if it is local or not (e.g. UFS = local, NFS = not). On other OSes you might not have f_basetype. So I don't think there is a really portable way.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.