The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > High Level Programming
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 08-07-2007
prasad11 prasad11 is offline
Registered User
 

Join Date: Aug 2007
Posts: 1
Exclamation need to help to test in linux

hi,

i have written the code to find free space for linux using native code of java like below.

#include <sys/statvfs.h>

JNIEXPORT jlong JNICALL Java_NativeUtils_getDiskFreeSpace
(JNIEnv *env, jclass obj, jstring path) {
struct statvfs fiData;
struct statvfs *fpData;
//char fnPath[128];
int i;
const char *str = (*env)->GetStringUTFChars(env, path, 0);
jlong ret;

if((statvfs(str,&fiData)) < 0 ) {
printf("Failed to stat %s:\n", str);
} else {
printf("\tblock size: %u\n", fiData.f_bsize);
}
(*env)->ReleaseStringUTFChars(env, path, str);
ret = (jlong)fiData.QuadPart;
return ret;
}

if any person is having the linux os and can u please test and get back to me

thanks,
prasad
Reply With Quote