-
January 26th, 2004, 05:22 AM
#1
Check, if mounted devices
Hi,
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, ......)
Thanks,
Marco
-
January 26th, 2004, 09:31 AM
#2
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
#3
Okay thanks!
I will try it with this one!
Marco
-
January 26th, 2004, 09:47 AM
#4
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|