int statvfs64 (const char *file, struct statvfs64 *buf) { /* `struct statvfs64' is in fact identical to `struct statfs64' so we can simply call statfs64. */ return __statfs64 (file, (struct statfs64 *)buf); }
/* Return information about the filesystem on which FILE resides. */ int __statvfs64 (const char *file, struct statvfs64 *buf) { struct statfs64 fsbuf; int res = __statfs64 (file, &fsbuf); #ifndef __ASSUME_STATFS64 if (res < 0 && errno == ENOSYS) { struct statvfs buf32; res = statvfs (file, &buf32); if (res == 0) { buf->f_bsize = buf32.f_bsize; buf->f_frsize = buf32.f_frsize; 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_favail = buf32.f_favail; buf->f_fsid = buf32.f_fsid; buf->f_flag = buf32.f_flag; buf->f_namemax = buf32.f_namemax; memcpy (buf->__f_spare, buf32.__f_spare, sizeof (buf32.__f_spare)); } } #endif if (res == 0) { /* Convert the result. */ struct stat64 st; __internal_statvfs64 (file, buf, &fsbuf, stat64 (file, &st) == -1 ? NULL : &st); } return res; }
int statfs(const char *path, struct statfs *buf) { return __statfs64(path, sizeof *buf, buf); }
/* Return information about the filesystem on which FD resides. */ int __fstatfs64 (int fd, struct statfs64 *buf) { return __statfs64 (frootdir(fd), buf); }