summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/statfs64.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/statfs64.c')
-rw-r--r--libc/sysdeps/linux/common/statfs64.c50
1 files changed, 30 insertions, 20 deletions
diff --git a/libc/sysdeps/linux/common/statfs64.c b/libc/sysdeps/linux/common/statfs64.c
index 2a0a930c4..7d5060914 100644
--- a/libc/sysdeps/linux/common/statfs64.c
+++ b/libc/sysdeps/linux/common/statfs64.c
@@ -19,34 +19,44 @@
#include <features.h>
-#ifdef __UCLIBC_HAVE_LFS__
-#define __USE_LARGEFILE64
+#if defined _FILE_OFFSET_BITS && _FILE_OFFSET_BITS != 64
+#undef _FILE_OFFSET_BITS
+#define _FILE_OFFSET_BITS 64
+#endif
+#ifndef __USE_FILE_OFFSET64
+# define __USE_FILE_OFFSET64 1
+#endif
+#ifndef __USE_LARGEFILE64
+# define __USE_LARGEFILE64 1
+#endif
-#include <errno.h>
#include <string.h>
#include <stddef.h>
#include <sys/statfs.h>
+
+#if defined __UCLIBC_HAVE_LFS__
+
/* Return information about the filesystem on which FILE resides. */
int statfs64 (const char *file, struct statfs64 *buf)
{
- struct statfs buf32;
-
- if (statfs (file, &buf32) < 0)
- return -1;
-
- buf->f_type = buf32.f_type;
- buf->f_bsize = buf32.f_bsize;
- buf->f_blocks = buf32.f_blocks;
- buf->f_bfree = buf32.f_bfree;
- buf->f_bavail = buf32.f_bavail;
- buf->f_files = buf32.f_files;
- buf->f_ffree = buf32.f_ffree;
- buf->f_fsid = buf32.f_fsid;
- buf->f_namelen = buf32.f_namelen;
- memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
-
- return 0;
+ struct statfs buf32;
+
+ if (statfs (file, &buf32) < 0)
+ return -1;
+
+ buf->f_type = buf32.f_type;
+ buf->f_bsize = buf32.f_bsize;
+ buf->f_blocks = buf32.f_blocks;
+ buf->f_bfree = buf32.f_bfree;
+ buf->f_bavail = buf32.f_bavail;
+ buf->f_files = buf32.f_files;
+ buf->f_ffree = buf32.f_ffree;
+ buf->f_fsid = buf32.f_fsid;
+ buf->f_namelen = buf32.f_namelen;
+ memcpy (buf->f_spare, buf32.f_spare, sizeof (buf32.f_spare));
+
+ return 0;
}
#endif