mirror of
https://github.com/servalproject/serval-dna.git
synced 2024-12-20 05:37:57 +00:00
Measure free space on Android using statfs()
This commit is contained in:
parent
82b13caac4
commit
5df5a33721
@ -29,7 +29,7 @@ SERVALD_LOCAL_CFLAGS = \
|
||||
-DHAVE_JNI_H=1 -DHAVE_STRUCT_UCRED=1 -DHAVE_CRYPTO_SIGN_NACL_GE25519_H=1 \
|
||||
-DBYTE_ORDER=_BYTE_ORDER -DHAVE_LINUX_STRUCT_UCRED -DUSE_ABSTRACT_NAMESPACE \
|
||||
-DHAVE_BCOPY -DHAVE_BZERO -DHAVE_NETINET_IN_H -DHAVE_LSEEK64 -DSIZEOF_OFF_T=4 \
|
||||
-DHAVE_LINUX_IF_H -DSQLITE_THREADSAFE=0 \
|
||||
-DHAVE_LINUX_IF_H -DHAVE_SYS_STAT_H -DHAVE_SYS_VFS_H -DSQLITE_THREADSAFE=0 \
|
||||
-I$(NACL_INC) \
|
||||
-I$(SQLITE3_INC)
|
||||
|
||||
|
@ -93,6 +93,7 @@ AC_CHECK_HEADERS(
|
||||
sys/time.h \
|
||||
sys/ucred.h \
|
||||
sys/statvfs.h \
|
||||
sys/stat.h \
|
||||
sys/vfs.h \
|
||||
poll.h \
|
||||
netdb.h \
|
||||
|
@ -21,6 +21,12 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
#include <assert.h>
|
||||
#ifdef HAVE_SYS_STATVFS_H
|
||||
# include <sys/statvfs.h>
|
||||
#else
|
||||
# if defined(HAVE_SYS_STAT_H) && defined(HAVE_SYS_VFS_H)
|
||||
# include <sys/stat.h>
|
||||
# include <sys/vfs.h>
|
||||
# define statvfs statfs
|
||||
# endif
|
||||
#endif
|
||||
#include "serval.h"
|
||||
#include "rhizome.h"
|
||||
@ -158,7 +164,7 @@ static uint64_t store_get_free_space()
|
||||
const char *fake_space = getenv("SERVALD_FREE_SPACE");
|
||||
if (fake_space)
|
||||
return atol(fake_space);
|
||||
#ifdef HAVE_SYS_STATVFS_H
|
||||
#if defined(HAVE_SYS_STATVFS_H) || (defined(HAVE_SYS_STAT_H) && defined(HAVE_SYS_VFS_H))
|
||||
char store_path[1024];
|
||||
if (!FORMF_RHIZOME_STORE_PATH(store_path, "rhizome.db"))
|
||||
return UINT64_MAX;
|
||||
|
Loading…
Reference in New Issue
Block a user