@@ -429,6 +429,27 @@ static inline int safe_statfs(const char *file, const int lineno,
#define SAFE_STATFS(path, buf) \
safe_statfs(__FILE__, __LINE__, (path), (buf))
+static inline int safe_statvfs(const char *file, const int lineno,
+ const char *path, struct statvfs *buf)
+{
+ int rval;
+
+ rval = statvfs(path, buf);
+
+ if (rval == -1) {
+ tst_brk_(file, lineno, TBROK | TERRNO,
+ "statvfs(%s,%p) failed", path, buf);
+ } else if (rval) {
+ tst_brk_(file, lineno, TBROK | TERRNO,
+ "Invalid statvfs(%s,%p) return value %d", path, buf,
+ rval);
+ }
+
+ return rval;
+}
+#define SAFE_STATVFS(path, buf) \
+ safe_statvfs(__FILE__, __LINE__, (path), (buf))
+
static inline off_t safe_lseek(const char *file, const int lineno,
int fd, off_t offset, int whence)
{
Signed-off-by: Wei Gao <wegao@suse.com> --- include/tst_safe_macros.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+)