Module posix.sys.statvfs
Retrieve File System Information.
Where supported by the underlying system, query the file system. If the
module loads, but there is no kernel support, then posix.sys.statvfs.version
will be set, but the unsupported APIs will be nil
.
-
statvfs (path)
-
Get file system statistics.
Parameters:
- path
string
any path within the mounted file system
Returns:
PosixStatvfs
information about file system containing path, if successful
Or
-
nil
-
string
error message
-
int
errnum
See also:
Usage:
local statvfs = require "posix.sys.statvfs".statvfs
for a, b in pairs (statvfs "/") do print (a, b) end
-
PosixStatvfs
-
Files system information record.
Fields:
- f_bsize
int
file system block size
- f_frsize
int
fundamental file system block size
- f_blocks
int
number of *f_frsize* sized blocks in file system
- f_bfree
int
number of free blocks
- f_bavail
int
number of free blocks available to non-privileged process
- f_files
int
number of file serial numbers
- f_ffree
int
number of free file serial numbers
- f_favail
int
number of free file serial numbers available
- f_fsid
int
file system id
- f_flag
int
flag bits
- f_namemax
int
maximum filename length
-
posix.sys.statvfs
-
Statvfs constants.
Any constants not available in the underlying system will be
nil
valued.
Fields:
- ST_RDONLY
int
read-only file system
- ST_NOSUID
int
does not support
S_ISUID
nor S_ISGID
file mode bits
Usage:
for name, value in pairs (require "posix.sys.statvfs") do
if type (value) == "number" then
print (name, value)
end
end