From: djberg96@... (Daniel Berger) Date: 2002-04-18T21:46:53+09:00 Subject: Re: Help wanted for statvfs extension Mike Hall wrote in message > > I just uploaded my version for the Linux 'statfs' and 'getmntent' calls. > Might be OK for BSD, also? > It's modeled after the standard 'etc' extension. > > http://www.enteract.com/~mghall/ruby/filesystem-0.1.tgz I just downloaded and tried this. I made one adjustment first: - #include + #include Is the mntent.h file in different locations depending on the OS? That will need to be solved if that's the case. Next, I tried to make it: # make gcc -fPIC -g -O2 -I/usr/local/lib/ruby/1.6/sparc-solaris2.8 -I. -I/usr/local/include -c -o filesystem.o filesystem.c filesystem.c: In function `fs_stat': filesystem.c:56: storage size of `fs' isn't known filesystem.c: At top level: filesystem.c:76: warning: `struct mntent' declared inside parameter list filesystem.c:76: warning: its scope is only this definition or declaration, which is probably not what you want. filesystem.c: In function `setup_mount': filesystem.c:79: dereferencing pointer to incomplete type filesystem.c:80: dereferencing pointer to incomplete type filesystem.c:81: dereferencing pointer to incomplete type filesystem.c:82: dereferencing pointer to incomplete type filesystem.c:83: dereferencing pointer to incomplete type filesystem.c:84: dereferencing pointer to incomplete type filesystem.c: In function `fs_mounts': filesystem.c:101: warning: assignment makes pointer from integer without a cast filesystem.c:107: warning: assignment makes pointer from integer without a cast filesystem.c:108: warning: passing arg 1 of `setup_mount' from incompatible pointer type filesystem.c:114: warning: assignment makes pointer from integer without a cast filesystem.c:115: warning: passing arg 1 of `setup_mount' from incompatible pointer type *** Error code 1 make: Fatal error: Command failed for target `filesystem.o' I'll go back and look at these. Also, why did you create an internal struct to store basetypes (fsid)? Isn't that information already stored in the statvfs struct as 'basetype' (f_basetype)? It's in the Solaris version anyway. Seemed redundant to me. Just curious is all. Also, what happens if I don't send a path as an argument to stat()? Can I iterate over each filesystem? e.g. Filesystem.stat("/tmp") { |fs| p fs.size p fs.name } Regards, Dan