projects
/
musl
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
reintroduce riscv64 struct sigcontext
[musl]
/
src
/
stat
/
statvfs.c
diff --git
a/src/stat/statvfs.c
b/src/stat/statvfs.c
index
5fadb3b
..
f65d1b5
100644
(file)
--- a/
src/stat/statvfs.c
+++ b/
src/stat/statvfs.c
@@
-1,10
+1,10
@@
#include <sys/statvfs.h>
#include <sys/statfs.h>
#include "syscall.h"
#include <sys/statvfs.h>
#include <sys/statfs.h>
#include "syscall.h"
-#include "libc.h"
-int __statfs(const char *path, struct statfs *buf)
+
static
int __statfs(const char *path, struct statfs *buf)
{
{
+ *buf = (struct statfs){0};
#ifdef SYS_statfs64
return syscall(SYS_statfs64, path, sizeof *buf, buf);
#else
#ifdef SYS_statfs64
return syscall(SYS_statfs64, path, sizeof *buf, buf);
#else
@@
-12,8
+12,9
@@
int __statfs(const char *path, struct statfs *buf)
#endif
}
#endif
}
-int __fstatfs(int fd, struct statfs *buf)
+
static
int __fstatfs(int fd, struct statfs *buf)
{
{
+ *buf = (struct statfs){0};
#ifdef SYS_fstatfs64
return syscall(SYS_fstatfs64, fd, sizeof *buf, buf);
#else
#ifdef SYS_fstatfs64
return syscall(SYS_fstatfs64, fd, sizeof *buf, buf);
#else
@@
-26,20
+27,21
@@
weak_alias(__fstatfs, fstatfs);
static void fixup(struct statvfs *out, const struct statfs *in)
{
static void fixup(struct statvfs *out, const struct statfs *in)
{
+ *out = (struct statvfs){0};
out->f_bsize = in->f_bsize;
out->f_bsize = in->f_bsize;
- out->f_frsize = in->f_bsize;
+ out->f_frsize = in->f_
frsize ? in->f_frsize : in->f_
bsize;
out->f_blocks = in->f_blocks;
out->f_bfree = in->f_bfree;
out->f_bavail = in->f_bavail;
out->f_files = in->f_files;
out->f_ffree = in->f_ffree;
out->f_blocks = in->f_blocks;
out->f_bfree = in->f_bfree;
out->f_bavail = in->f_bavail;
out->f_files = in->f_files;
out->f_ffree = in->f_ffree;
- out->f_favail =
0
;
+ out->f_favail =
in->f_ffree
;
out->f_fsid = in->f_fsid.__val[0];
out->f_flag = in->f_flags;
out->f_namemax = in->f_namelen;
}
out->f_fsid = in->f_fsid.__val[0];
out->f_flag = in->f_flags;
out->f_namemax = in->f_namelen;
}
-int statvfs(const char *
path, struct statvfs *
buf)
+int statvfs(const char *
restrict path, struct statvfs *restrict
buf)
{
struct statfs kbuf;
if (__statfs(path, &kbuf)<0) return -1;
{
struct statfs kbuf;
if (__statfs(path, &kbuf)<0) return -1;
@@
-55,7
+57,7
@@
int fstatvfs(int fd, struct statvfs *buf)
return 0;
}
return 0;
}
-
LFS64(statvfs
);
-
LFS64(statfs
);
-
LFS64(fstatvfs
);
-
LFS64(fstatfs
);
+
weak_alias(statvfs, statvfs64
);
+
weak_alias(statfs, statfs64
);
+
weak_alias(fstatvfs, fstatvfs64
);
+
weak_alias(fstatfs, fstatfs64
);