statvfs.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3  *
4  * Squid software is distributed under GPLv2+ license and includes
5  * contributions from numerous individuals and organizations.
6  * Please see the COPYING and CONTRIBUTORS files for details.
7  */
8 
9 #ifndef _SQUID_COMPAT_XSTATVFS_H
10 #define _SQUID_COMPAT_XSTATVFS_H
11 
12 #if HAVE_SYS_STATVFS_H && HAVE_STATVFS
13 #include <sys/statvfs.h>
14 #endif
15 
16 /* Windows and Linux use sys/vfs.h */
17 #if HAVE_SYS_VFS_H
18 #include <sys/vfs.h>
19 #endif
20 
21 /* BSD and old Linux use sys/statfs.h */
22 #if !HAVE_STATVFS
23 #if HAVE_SYS_STATFS_H
24 #include <sys/statfs.h>
25 #endif
26 /* statfs() needs <sys/param.h> and <sys/mount.h> on BSD systems */
27 #if HAVE_SYS_PARAM_H
28 #include <sys/param.h>
29 #endif
30 #if HAVE_SYS_MOUNT_H
31 #include <sys/mount.h>
32 #endif
33 #endif /* !HAVE_STATVFS */
34 
35 #if HAVE_STATVFS
36 #define xstatvfs statvfs
37 
38 #else
39 
40 typedef unsigned long fsblkcnt_t;
41 typedef unsigned long fsfilcnt_t;
42 
43 struct statvfs {
44  unsigned long f_bsize; /* file system block size */
45  unsigned long f_frsize; /* fragment size */
46  fsblkcnt_t f_blocks; /* size of fs in f_frsize units */
47  fsblkcnt_t f_bfree; /* # free blocks */
48  fsblkcnt_t f_bavail; /* # free blocks for unprivileged users */
49  fsfilcnt_t f_files; /* # inodes */
50  fsfilcnt_t f_ffree; /* # free inodes */
51  fsfilcnt_t f_favail; /* # free inodes for unprivileged users */
52  unsigned long f_fsid; /* file system ID */
53  unsigned long f_flag; /* mount flags */
54  unsigned long f_namemax; /* maximum filename length */
55 };
56 
57 #if defined(__cplusplus)
58 extern "C"
59 #endif
60 int xstatvfs(const char *path, struct statvfs *buf);
61 
62 #endif
63 
64 #endif /* _SQUID_COMPAT_XSTATVFS_H */
65 
fsfilcnt_t f_favail
Definition: statvfs.h:51
fsblkcnt_t f_bfree
Definition: statvfs.h:47
fsblkcnt_t f_blocks
Definition: statvfs.h:46
int xstatvfs(const char *path, struct statvfs *buf)
Definition: statvfs.cc:22
fsfilcnt_t f_files
Definition: statvfs.h:49
unsigned long f_flag
Definition: statvfs.h:53
unsigned long fsblkcnt_t
Definition: statvfs.h:40
fsfilcnt_t f_ffree
Definition: statvfs.h:50
unsigned long f_fsid
Definition: statvfs.h:52
unsigned long fsfilcnt_t
Definition: statvfs.h:41
unsigned long f_frsize
Definition: statvfs.h:45
fsblkcnt_t f_bavail
Definition: statvfs.h:48
unsigned long f_namemax
Definition: statvfs.h:54
unsigned long f_bsize
Definition: statvfs.h:44

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors