Ignore:
Timestamp:
Jan 5, 2011, 4:41:19 AM (10 years ago)
Author:
jordan
Message:

(trunk, daemon) #3833 "'freespace' argument for 'session-get' RPC method" -- committing patch from taem, reardon, and rb07

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/platform.c

    r11599 r11627  
    3535#include <string.h>
    3636
     37#ifdef SYS_DARWIN
     38 #define HAVE_SYS_STATVFS_H
     39 #define HAVE_STATVFS
     40#endif
     41
    3742#include <sys/stat.h>
    3843#include <sys/types.h>
     44#ifdef HAVE_SYS_STATVFS_H
     45 #include <sys/statvfs.h>
     46#endif
    3947#ifdef WIN32
    4048#include <libgen.h>
     
    679687***/
    680688
     689int64_t
     690tr_getFreeSpace( const char * path )
     691{
     692#ifdef WIN32
     693    uint64_t freeBytesAvailable = 0;
     694    return GetDiskFreeSpaceEx( path, &freeBytesAvailable, NULL, NULL)
     695        ? (int64_t)freeBytesAvailable
     696        : -1;
     697#elif defined(HAVE_STATVFS)
     698    struct statvfs buf;
     699    return statvfs( path, &buf ) ? -1 : (int64_t)buf.f_bavail * (int64_t)buf.f_bsize;
     700#else
     701    #warning FIXME: not implemented
     702    return -1;
     703#endif
     704}
     705
     706/***
     707****
     708***/
     709
    681710#ifdef WIN32
    682711
     
    798827
    799828#endif
    800 
Note: See TracChangeset for help on using the changeset viewer.